News for hackers. Stuff that matters.
Re:I Believe Zig Has Function Colors by kaba0 on Saturday April 09, 2022 @05:30AM (#30966487)
I'm not necessarily disagreeing with you, but is there an example for a function that doesn't make sense to call from both an async and non-async function, other than an implementation detail of the programming language?

But continuing on your idea, one colouring I would really like to see everywhere is pureness. C++'s `const` comes close, and perhaps Haskell does it right by having everything be (mostly) pure by default and using the type system to encode other properties. And yeah - different monads (like IO) are likely a good way to handle this whole topic in a user-definable way, but not many people like them (at least when they know they are using them, because unknowingly many programmer do use it, eg. most async syntactic sugar is basically a do notation for a single hard-coded Monad)

Re:I Believe Zig Has Function Colors by kubb on Saturday April 09, 2022 @05:50AM (#30966574)
in javascript's programming model, literally everything that's running in response to user action (clicks, etc.) absolutely has to complete immediately (from the browser user's point of view), or it will hang the UI. async event handlers really help with that. a non-async handler blocking until a long standing operation is complete (i.e awaiting an async function) is unacceptable

the async/non async functions in javascript are good and well designed. the whole colored functions thing is nonsense and it's weird that it gained so much traction on here

Re:I Believe Zig Has Function Colors by kaba0 on Saturday April 09, 2022 @08:35AM (#30967507)
Starting up a new virtual thread and writing “blocking” code in it, while the VM schedules it on top of a single thread is entirely possible and will make everything happen quasi-instantly, the same way as async is.
Re:I Believe Zig Has Function Colors by feanaro on Saturday April 09, 2022 @07:25AM (#30967088)
I think that people that dislike monads mostly fall in one of two categories: those that know about a fancier alternative such as algebraic effects and those that are scared off by an alien-looking unfamiliar concept.

Those two groups are minorities in the set of all people that are even aware of monads.