Print debugging statement: Difference between revisions

m
(→‎Insitux: inclusion)
m (→‎{{header|Wren}}: Minor tidy)
 
(One intermediate revision by one other user not shown)
Line 384:
 
<syntaxhighlight lang="insitux">
(for s (-> (symbols) (filter about) (remove ["print" "mock" "unmocked" "unmock" "do" "reset"]))
(filter about)
(remove ["print" "mock" "unmocked" "unmock" "do" "reset"]))
(mock s (fn (let result ((unmocked ...) (unmocked s) args))
(print "(" s " " ((unmocked join) " " args) ") => " result)
Line 1,170 ⟶ 1,172:
 
What is generally done in practice is to hard-code some location indicator (such as the line number itself) at which a variable's value is being obtained. The Go example code then looks like this when translated to Wren.
<syntaxhighlight lang="ecmascriptwren">import "./fmt" for Fmt
 
class Point {
Line 1,234 ⟶ 1,236:
{{libheader|Wren-debug}}
We can also rewrite this code using the above module which, whilst still quite basic, provides a more structured approach to debugging than the first version.
<syntaxhighlight lang="ecmascriptwren">import "./fmt" for Fmt
import "./debug" for Debug
 
9,485

edits