Skip to content
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

Raise exceptions in built-in functions #37

Closed
julianhyde opened this issue May 12, 2020 · 1 comment
Closed

Raise exceptions in built-in functions #37

julianhyde opened this issue May 12, 2020 · 1 comment

Comments

@julianhyde
Copy link
Collaborator

The specifications of built-in functions String.sub, String.extract, String.concat, String.concatWith, List.hd, List.tl, List.last, List.nth, List.take, List.tabulate require them to throw exceptions Empty, Subscript, Size. (See, for example, the String structure in Standard ML basis library.)

Change the implementations of those functions to raise exceptions. The exception is printed on the console, for example

String.sub("abc", ~1);
uncaught exception Subscript [subscript out of bounds]

This change does not allow the user to define, raise or handle exceptions (keywords exception, raise, handle).

@julianhyde
Copy link
Collaborator Author

Fixed in 0cedd58 (release 0.3).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant