Ask Your Question
1

Default case in a visit?

asked Dec 19 '11

Johanneke gravatar image Johanneke
77 4 10

I just tried to use the default case in a visit, but get a "java.lang.UnsupportedOperationException". The code below all results in the error.

visit({}) {case {3} : println("a"); default : println("b"); }

visit({}) {default : println("b"); } 

visit({}) {default: ; }

According to the tutor, this is correct syntax. What is going wrong here?

delete close flag offensive retag edit

Comments

I had the same problemen, solved it by adding all cases (which is a workaround i guess).

Dennisb (Dec 19 '11)edit

You can also add the 'case _', which will always match. But it's still a workaround, not a solution ;)

Johanneke (Dec 19 '11)edit

1 Answer

Sort by ยป oldest newest most voted
0

answered Dec 26 '11

JurgenVinju gravatar image JurgenVinju flag of Netherlands
554 6 20
http://jurgen.vinju.org/

The default in a visit is not supported by design, but perhaps that was a mistake? Do you think its useful to have?

link delete flag offensive edit

Comments

I think it might be useful, but in any case the documentation should be updated. Because at the time of my question it said that the default could be used in a visit.

Johanneke (Dec 27 '11)edit

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
[hide preview]
Also see the Rascal Tutor.

Question tools

Follow

subscribe to rss feed

Stats

Asked: Dec 19 '11

Seen: 20 times

Last updated: Dec 26 '11