Is it really necessary to have a new feature. I would of thought a
convention that you don't catch something derived from Jump was
sufficient. Much like you are highly advised not to catch something
derived from Error at the moment. I say this because inner classes
give sufficient power to make non-local jumps fast at present, e.g.:

class Jump extends RuntimeException { ... }

class NonLocalReturn extends Jump {
  private Object value;
  Object getValue() { ... }
  void setValue() { ... }
}

interface Method1<R, A> { R call( A a ); }

class MyList<E> {
  <R> MyList<R> map( Method<R, E> f ) { ... }
  // rest
}

// Translated from a better syntax in to standard Java
Integer example( MyList<Integer> list ) {
  class ExampleReturn extends NonLocalReturn {
    static final ExampleReturn instance = new ExampleReturn(); // Pre-
made singleton
  }
  try {
    ...
    list.map( new Method1<Integer, Integer>() {
      public Integer call( Integer x ) {
        ...
        throw ExampleReturn.instance; // fast - pre made
      }
    } );
    ...
  } catch ( ExampleReturn e ) {
    return (Integer) e.getValue();
  }
}
}


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to