Thanks for that post, it definitely gave me a lot of insight into what is going
on in Nim. I'm working with a lot of pixel data and wanted to return it from a
function as a seq[uint8]. I want to avoid it doing an necessary copy (on
return) for a lot of data (which I assume is happening right now
> I guess that one could put the return value as the first one on the stack
> frame, so there is no copy involved. It seems to me that this is safe to do
> when one uses the special variable result. It depends on the calling
> convention, but I think it should be doable?
This is close to how mo
If there is a poof and Nim is Java, then I am out. Java is horrible.
> Technically, values are always copied when returned from a procedure -
> there's not really any other way.* If values were to be always passed by
> pointer/reference, how would values that are stored on the function call
> stack persist after the procedure has returned?
I guess that one could
Good post. Def would say "look at the generated code". This is what i got:
proc fillWith(n, count: int): seq[int] =
var s: seq[int] = @[]
for i in countup(0, count - 1):
s.add(n)
return s
proc main =
let counter = fillWith(7, 3)
e
Yes, the --run (or -r) will run after compiling helloworld.nim. nim --run
helloworld.nim won't just run your script.
Yes, there are several posts about how to set things up for using Nim with ARM
(either on the device or cross-compiling). Search the forum for ARM and take a
look at some of those posts.
**TL;DR**: Strings and sequences, like objects and integers, are copy on
_assignment_. References are not.
Technically, values are always copied when returned from a procedure - there's
not really any other way.* If values were to be always passed by
pointer/reference, how would values that are
How does Nim return values from a proc? Are basic datatypes (like int and
float) returned by copy? What about more complex structures like sequences and
strings?
For example, would this proc:
proc fillWith(n, count: int): seq[int] =
var s: seq[int] = @[]
for i in count