Re: Is this valid Nim code or a typo?

2018-08-11 Thread Stefan_Salewski
Ah yes, I see. Thanks!

Re: Is this valid Nim code or a typo?

2018-08-11 Thread mashingan
I bet he only forgot about that. I usually limit myself of not using parenthesis when the proc only need one argument, while when writing anonymous proc in parenthesis entirely e.g. (proc), thankfully it didn't parsed as a single element tuple, (or did it? :/ )

Re: Is this valid Nim code or a typo?

2018-08-11 Thread dom96
https://nim-lang.org/docs/manual.html#procedures-anonymous-procs

Re: Is this valid Nim code or a typo?

2018-08-11 Thread jyapayne
@Stefan_Salewski, to further clarify, you could replace that code with the equivalent: proc onDestroy(p: pointer) = let x = cast[var T](p) `=destroy`(x.le) `=destroy`(x.ri) dealloc(p) proc `=destroy`(x: var T) = lazyDestroy(cast[pointer](x),

Re: Is this valid Nim code or a typo?

2018-08-10 Thread Araq
It's an anonymous proc.

Is this valid Nim code or a typo?

2018-08-10 Thread Stefan_Salewski
Yesterday I read [https://nim-lang.org/araq/destructors.html](https://nim-lang.org/araq/destructors.html) Was some fun, but I still have no idea what the second line in proc `=destroy`(x: var T) = lazyDestroy cast[pointer](x), proc (p: pointer) = let x = cast[var