-
Notifications
You must be signed in to change notification settings - Fork 463
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
Add throw
#7346
base: master
Are you sure you want to change the base?
Add throw
#7346
Conversation
runtime/Stdlib_Exn.res
Outdated
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.
Should we add @@deprecated
to this module?
It has the same content as https://github.com/rescript-lang/rescript/blob/master/runtime/Stdlib_Error.res
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.
it doesn't have exactly the same content though, Error
is missing the definition of a JS exception that today is catched with Exn.Error(obj)
, but I agree the current situation is not ideal, maybe we could merge the two?
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 will explore this in another PR
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.
thanks for doing this @aspeddro, I think that's a nice improvement. I'm just not sure if we should also deprecate raise
, having both without any explanation feels a bit weird to me. I'm also not sure about what we should do for Stdlib.Exn
module, but I'd advise to keep this work for another PR to avoid bikeshedding on this topic.
runtime/Pervasives_mini.res
Outdated
@@ -1,5 +1,6 @@ | |||
/* Exceptions */ | |||
external raise: exn => 'a = "%raise" |
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.
should we deprecate raise or keep both for now?
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 will remove
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.
Done
We can add to deprecated attribute?
|
runtime/Stdlib.res
Outdated
@@ -100,6 +100,7 @@ async function main() { | |||
external import: 'a => promise<'a> = "%import" | |||
|
|||
let panic = Error.panic | |||
let throw = Error.throw |
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.
This is not zero-cost (causes a $$throw
function to be emitted in Stdlib.js). I am afraid we need to repeat the external
definition here.
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.
Done
runtime/Stdlib.res
Outdated
} | ||
``` | ||
*/ | ||
external throw: Error.t => 'a = "%raise" |
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.
Should I add the external here or just leave it in the Stdlib_Error.res
module?
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.
Maybe clearer to add it in Pervasives on top of the deprecated raise
instead?
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.
Done
CHANGELOG updated |
@aspeddro did you see my comment?
|
Yes, I will adjust |
Should we also have a |
Good idea. |
Deprecate
raise
and rename references.Close #7113