#Taskle - Elixir Task analogue

1 messages · Page 1 of 1 (latest)

visual steppe
#

Since gleam_otp removed the task module in v1.0, I decided to build a replacement with mostly the same API, as I especially needed to run parallel tasks without blocking and with a single point of synchronization.

https://hexdocs.pm/taskle/index.html

river root
#

neat! in elixir I'd mostly use supervised tasks – do you have plans for supporting something like that or nah?

visual steppe
#

not for now. I'm mostly using it for short-lived tasks and side effects
and current implementation already has monitoring built-in, so you get crash reasons without restart complexity

#

do you have specific use cases where you'd want the restart behavior?

coral kite
#

You should probably remove the unsupervised API and only have a supervised one

#

Supervisors are for more than just restarts, and all processes in a well made program are supervised

#

The start function should not return a Task as doing so makes it possible to await a value that will never return

#

So the only thing it can be used for is causing bugs!

#

It also leaks the down message, which is a memory leak and makes reduces the parent process performance, or makes it log a warning if it’s an actor

#

It looks like this package replicates a lot of the design bugs that made us remove task in favour of process. It would be good not to bring them back

#

This sort of concurrent building block is quite challenging to make without subtle bugs. I’d recommend studying the Elixir supervised task system throughly and then using that as the reference for a Gleam implementation