On Oct 22, 10:44 am, Charles Oliver Nutter <[EMAIL PROTECTED]> wrote: > The problem is that there's already code out there that catches > Exception or Throwable, which will break any language implementation > using RuntimeException subclasses to do non-local flow control. Scala > opted to go with Error subclasses, but even here there's the possibility > someone could be catching Error for other reasons. The fact that Jump > would be new and that there would be no other valid reason for catching > it other than intercepting non-local flow control is exactly the point. > We're not overloading an existing feature in ways incompatible with > current usage patterns. We're accepting that non-local flow control is a > fact of life for many language implementations, and that a first-class > construct is needed.
OK these are valid points. So why not make a new subclass of Throwable called Jump that acts like a checked exception, Exception, in Java and recommend that people don't catch it (but importantly allow them to catch it - see below). I doubt that any mechanism is totally bullet proof, so I don't see a problem with a simple recommendation in the Java context. For other languages it may be appropriate to enforce that Jump cannot be caught in that language. I am deliberately putting forward a Java and a non-Java viewpoint since in the ideal world multiple languages can co-exist and call each other and therefore control flow needs to have identical semantics in all cases. If it is a specific non-Java feature then a method that uses it cannot be called from Java, if on the other hand it is like a checked exception then Java can call it (and catch or throw Jump if that is what it takes to deal with the non-Java method). --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
