snow-deprecated
snow-deprecated copied to clipboard
`return it` in block doesn't work
trafficstars
When creating a Function returning the magic variable it, nil is returned:
a: [n] { n }
b: { it }
c: [n] { return n }
d: { return it }
puts("a: " + a(60)) //→ a: 60
puts("b: " + b(60)) //→ b: 60
puts("c: " + c(60)) //→ c: 60
puts("d: " + d(60)) //→ d:
Interestingly, this works in interactive Snow:
{ return it }(60) //→ 60
This is probably related to #26; I will look into it.
Also, please provide revision and architecture. :)
The reason this works in Interactive Snow
{ return it }(60) //=> 60
is an error in the parser.
This would give the same result:
{ return 78 }(60) // => 60
Hahaha, that's pretty messed up.
Sorry about the lack of info. Architecture is x86_64, revision is current HEAD, 3489b36551e3f426ac7e0885fd8d9eb19a4dca35.
Made a separate ticket about the parser issue - see #29.