|
|
|
|
|
by codesnik
580 days ago
|
|
You can have indentation based syntax and ; for multiple statements in one line, or something even more powerful. But it doesn't matter. Main power of blocks is not being multiline or being closure-like, many languages have this. But blocks are not just anonymous functions or lambdas, they have ability to return from the outer method (or from the method to which it was passed with break), acting as a powerful tool for creating your own flow control structures if needed, or just replacing "for". Of the languages I know or heard of only smalltalk does the same. You can live without those, you can live even without early return, but blocks are not a misfeature, it's a great and intuitive tool. And python's rudimentary lambdas make me cry a little. |
|
https://docs.toit.io/language/blocks-and-lambdas