-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failable types -> failable functions #642
base: main
Are you sure you want to change the base?
Conversation
@b1ek i think that we should keep failable types because later on we can match on them:
Or even in the future run methods on them:
|
Also I'm pretty confident that I'd want to do this:
And current state of things gives us ease of detecting failable value |
that can still be achieved with failable functions. my issue with failable types is that they exist only for a brief period of time, don't actually store any data and shouldn't even be considered types:
the only use case for it is when a function may fail, which i dont think should be treated as a data type internally:
|
i just want to clarify that i haven't changed the syntax one bit here. all code that has been written before will work exactly the same. but it will be handled differently internally |
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.
Assuming we decide to go with this approach, I cannot see anything major wrong with your changes, but have made some minor suggestions.
Co-Authored-By: hdwalters <[email protected]>
@b1ek I can't found a counterargument. You convinced me on this one |
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 think that the proposed message is the biggest common denominator:
- It is different enough (The two sentences start with a different letter)
- It's written the same way
Other changes look good
src/tests/erroring/function_failable_with_typed_nonfailable_return.ab
Outdated
Show resolved
Hide resolved
I implemented Failable as a type under an assumption that we might or might not turn it into an actual type. I have no issues with the idea of implementing them through an attribute of a function, but do note that this will cement the current way of handling failability (as a function attribute, rather than a type) — and that is probably a good thing. |
Co-authored-by: Phoenix Himself <[email protected]>
Looks good thanks. |
We can always pivot this logic if we hit the wall |
One question though. Are we releasing 0.4.1 with this or we implement it as a feature of 0.5? |
I thought we were not planning to target features for different releases, but instead merge everything to staging, and bump the version number according to impact of changes? |
as discussed in #478
i didn't actually change the syntax, just the way how it is handled internally: no more failable types, but failable functions instead