Nim is a compiled, garbage-collected systems programming language which has an excellent productivity/performance ratio. Nim's design focuses on efficiency, expressiveness, elegance (in the order of priority).
proc `[]`*(s: ustring, i: int): ustring = ustring"foo"
@kaushalmodi the reason is that if you simply use result.add(arg)
, you will add arg
as a new node to the statement list, i.e. resulting in the following code (excluding the newline part):
StmtList
Call
Sym "styledWrite"
Sym "stdout"
Curly
Sym "styleBright"
Sym "styleUnderscore"
StrLit "test"
However, what you want is that the Curly
and StrLit
nodes are also parts of the Call
tree, since they are the arguments to that function, i.e.:
StmtList
Call
Sym "styledWrite"
Sym "stdout"
Curly
Sym "styleBright"
Sym "styleUnderscore"
StrLit "test"