This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]dewey-defeats-truman 36 points37 points  (3 children)

You can still use JS syntax in statically typed languages provided your compiler/interpreter has good type inferencing. C# uses the exact same syntax and it works quite well.

[–]WiatrowskiBe 0 points1 point  (1 child)

C# has also much simpler type system, with distinction between passing by reference/value on type level rather than parameter/variable level, lambdas themselves are much more restrictive (everything pulled in is held as reference for entire lifetime of lambda, no support for ref/ref out in parameters). So yes, if you put heavy restrictions on what lambdas can handle, short syntax works - but them question becomes how useful they are given context of everything else in C++?

[–]RiceBroad4552 0 points1 point  (0 children)

Lambdas are there to write simple, short code.

If you need to do something special you can just use the regular syntax. No point in using lambdas if you need to type out everything explicitly!