According to the documentation you can pattern match parameters in a function declaration, and the pattern for tuples is <first,second,etc>.
Then why is the following code giving a "java.lang.UnsupportedOperationException"?
public void insertRelation(hierarchy(hr), <to,from>) {
println("hai");
}
When I change it into the following, it does work:
public void insertRelation(hierarchy(hr), tuple[Entity,Entity] r) {
println("hai");
}
What is going on?
This is a bug, which has now been fixed. It should work in the next release. Note that, to "future-proof" the code, you will want to include types on any new variables you introduce inside the patterns, so you would want the tuple pattern to be specified as < Entity to, Entity from > instead of just < to, from >.
Asked: Dec 19 '11
Seen: 21 times
Last updated: Dec 30 '11
Copyright CWI, 2010-2012. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.