Syntax question about inlined functions/delegates/lambdas

2013-12-30 Thread Gordon
Hello, I have a syntax question regarding the correct usage of function/delegates/lambdas, arising after a used it incorrectly and it took a long time to debug and see what's going on. I found out there's a syntax which compiles OK but doesn't work (as I naively expected). The following is a

Re: Syntax question about inlined functions/delegates/lambdas

2013-12-30 Thread Maxim Fomin
On Monday, 30 December 2013 at 19:00:49 UTC, Gordon wrote: So I've learned that syntaxes in cases 2,4,6 are wrong, but they still compile. May question is - what do they do? what usage do they have (since they do not trigger a compilation warning)? Thanks, -gordon You could notice that synt

Re: Syntax question about inlined functions/delegates/lambdas

2013-12-30 Thread bearophile
Gordon: ... case 5. X = ",x); } )(); call_function!( (x) => { writeln("lambda, case 6. X = ",x); } )(); call_function!( (x) => writeln("lambda, case 7. X = ",x))(); } There is also the simpler syntax: x => writeln("lambda, case 8. X =

Re: Syntax question about inlined functions/delegates/lambdas

2013-12-30 Thread Ali Çehreli
On 12/30/2013 11:00 AM, Gordon wrote: Hello, I have a syntax question regarding the correct usage of function/delegates/lambdas, arising after a used it incorrectly and it took a long time to debug and see what's going on. I found out there's a syntax which compiles OK but doesn't work (as I nai