gleam-lang / otp

📫 Fault tolerant multicore programs with actors
https://hexdocs.pm/gleam_otp/
Apache License 2.0
443 stars 49 forks source link

Add pid_from_dynamic to process module #33

Closed edkelly303 closed 2 years ago

edkelly303 commented 2 years ago

As discussed a couple of days ago on Discord, I thought I would have a go at adding a pid_from_dynamic function to the process module. I think this is a handy function for certain use cases, for example if you have an Erlang or Elixir process that sends its own pid in a message to a Gleam actor, and you want to reply to it using process.untyped_send.

You mentioned that you would prefer to write the decoder in Erlang, so I had a go at that - it's the first Erlang I've ever written, so apologies if there are any blunders. I wrote a couple of tests and they seem to pass, so hopefully it's ok.

This my second pull request on any project ever, so apologies if I have done anything stupid :)

edkelly303 commented 2 years ago

Thank you! I've updated the error value as requested.

edkelly303 commented 2 years ago

Sure! Changelogged :+1: