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

Missing documentation and module autoload for Exception #81

Open
BertLisser opened this issue Apr 16, 2013 · 0 comments
Open

Missing documentation and module autoload for Exception #81

BertLisser opened this issue Apr 16, 2013 · 0 comments
Labels

Comments

@BertLisser
Copy link
Owner

Created 2009-11-30 by [email protected] assigned to [email protected]

The paragraph "Exception" of the Rascal documentation should contain a (simple) example to explain the use of the "try-catch" structure for beginners, especially regarding the "PatternWithAction" (and also link to the respective paragraph). Also a backlink from PatterWithAction towards Exception is missing.

Furthermore some unexpected behaviour can occur because the module "Exception" is not loaded by default.

Let's assume the following program:

module BugTest import Map; import IO; public int main() { try invertUnique(("a": 3, "b": 6, "c": 6 )); catch "some text": println("catch str"); catch 11: println("catch Mark int"); catch PathNotFound: println("catch PathNotFound"); catch MultipleKey: println("catch MultipleKey"); catch: println("catch default"); finally println("finally block"); return 0; }

Let's start the program:

[1] rascal>import BugTest; ok

[2] rascal>main()
catch PathNotFound
finally block
int: 0

The Exception is wrongly caught by the statement "catch PathNotFound".
now let's add the statement "import Exception;" to the above program and rerun the program.

[3] rascal>import BugTest; ok

[4] rascal>main();
catch MultipleKey
finally block
int: 0
rascal>

The Exception is now correctly identified as a MultipleKey Exception as is should always be.

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

No branches or pull requests

1 participant