Remix.run Logo
ivanjermakov a day ago

The drawback is that this approach elevates code blocks to first class. It means that there is a semantical difference between a value that is a block and a value that is a result of a block. This reduces code clarity, because now block def/result is discriminated by context instead of syntax.

- closures get tricky, i.e. having outer scoped variables within a block

- inter-block operators still need special care, e.g. return should return from a function or a nearest block, same for break/continue/etc.

danlitt 21 hours ago | parent [-]

This criticism seems at face value to also apply to first-class functions, which I thought was a totally uncontroversial pattern. Do you dislike those too?

ivanjermakov 21 hours ago | parent [-]

First-class functions are problematic too[1], but function is always a definition. While code block is usually meant to be executed right away.

[1]: https://github.com/ziglang/zig/issues/1048

em-bee 17 hours ago | parent [-]

can you please explain what the actual problem here is? i am trying to read through that issue discussion, but i am not quite getting what makes first-class functions problematic. as far as i am concerned, not having first-class functions would be a serious limitation to a language that would make me avoid using that language for anything serious.