massivefermion / puddle

A resource pool manager for gleam
https://hex.pm/packages/puddle
5 stars 0 forks source link

Provide function based API #1

Closed lpil closed 1 year ago

lpil commented 1 year ago

It's a little unclear how to use this library at the moment as it has only 1 function, and 2 rather complex looking types.

Normally Erlang libraries do not expose a message based API, rather they have a function based one. I think we should follow this in Gleam too as it makes them much easier to understand and use, and permits the library to do things that are impossible with a single message type.

For example, this library could have functions called start, check_out, and check_in. I think most people would understand these. The messages could be made opaque to ensure they are not misused and to make the API and documentation simpler

Thanks!

massivefermion commented 1 year ago

Thanks for the feedback I think the new version adequately addresses this