-
-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add process names, refocus scope, rework API #71
base: main
Are you sure you want to change the base?
Conversation
General note: There's a lot of really good QOL stuff happening in this PR :) |
Made a small PR with some minor docs changes so you don't have to bother copying them over: #72 |
Co-authored-by: Giacomo Cavalieri <giacomo.cavalieri@icloud.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i like these changes. RIP rescue
🙏🏻
Since we're introducing breaking changes, would it make sense to include #67 also? It contains changes from I can rebase it on top of this branch, if it helps. |
Good idea @sbergen! I wonder if there's any further improvements we could make to those types... |
I still find the asymmetry of |
What are some uses you have for decoding the exit reason?
This would mean we have it completely unchecked by the type system, and the programmer just have to get the correct magic values! |
The uses I've had would be to report a more structured error from a process that should terminate. E.g. when using a process to communicate with a server, where the protocol specifies that the connection should be immediately closed on any protocol violations, it would be nice to be able to report if the reason to terminate was due to a) a protocol violation from the server, or b) one of our own assertions about situations that shouldn't happen (e.g. Erlang timers often lead me to add assertions like this). You could argue that these could/should be reported through a
I know, but as I pointed out in #67, the string in I guess some kind of API where you could have typed processes, |
It sounds like a mistake to me to be using non-local error handling in such a fine-grained way.
The message is a debug convenience rather than a tool for exception based flow control, the same as the text message one can give to a Something being unstructured is not an argument in favour of removing useful structure from a related thing. The Erlang design is informative but replicating it is not a goal as we are focusing on types and making invalid use impossible, while the Erlang API attempts neither.
Pids are not typable with their messages as it makes Now is the time to make large changes! There will be no other time to do so. |
OK, I am convinced @sbergen ! I have merged your changes into this branch. :) |
As a package author, I was thinking of it more as a HTTP 500 (oops, my bad) vs 502 (I can't do my job because of a third party) that could be reported to the user of the package...
...but indeed, this sort of information could be included in strings also. I just like types a lot more than strings :)
I think you could have one typed variant of
|
Reworking the API of this package for a v1 release! The big new feature is named processes, which will make writing OTP programs much easier in Gleam.