Managing Side Effects: A JavaScript Effect System in 30 Lines or Less (lackofimagination.org)
from Aijan@programming.dev to programming@programming.dev on 25 Nov 18:43
https://programming.dev/post/41337240

#programming

threaded - newest

TehPers@beehaw.org on 26 Nov 04:41 collapse

This is a super interesting approach to JS. Conceptually, it’s really cool. In practice, I don’t think I’d do it (at least for any projects I can think of) because explaining it to others would be difficult and representing complex logic as “commands” sounds a bit difficult.

In a weird way, it reminds me of actor frameworks though. The difference is of course the separation of effects.

One thing I wish the author would have done, though, is add some type hints. I know it’s about JS, but even some jsdoc types would have helped. It was a bit hard to know at first what the input types were to these functions.

Aijan@programming.dev on 26 Nov 09:21 collapse

Author here. In my experience, AI coding tools like Claude Code can write code in the Effect system style, and that could be a great starting point for getting developers not familiar with this approach on board.

I considered adding JSDoc type annotations, but that would make the code a bit verbose.

Kache@lemmy.zip on 27 Nov 04:51 collapse

Do you have a version with type annotations, perhaps in a gist?

Aijan@programming.dev on 28 Nov 21:28 collapse

I’ve added JSDoc type annotations to the library.