News for hackers. Stuff that matters.
Re:I Believe Zig Has Function Colors by kaba0 on Saturday April 09, 2022 @05:37AM (#30966520)
I would say it is a huge disadvantage -- do is just syntactic sugar for a monad expression of binds, which is a native part of the language, you can write a simple function to manipulate it however you like. While you would need to effectively parse AST in case of JS.
Re:I Believe Zig Has Function Colors by inglor on Saturday April 09, 2022 @07:37AM (#30967139)
`yield` is just syntactic sugar for the two-way generator communication protocol where the consumer calls `.next(value)` which returns a value in turn. This is as expressive and you can build `do` semantics on top of stuff like lists/either/state/io on top of it. No AST parsing needed.
Re:I Believe Zig Has Function Colors by kaba0 on Saturday April 09, 2022 @08:20AM (#30967403)
And do syntax sugar is just nested calls of `bind` which is a function of the Monad trait. Lists are also a Monad, so do notation just works right now with lists, either, state everything in Haskell.

I really don’t get how is Haskell “behind”.