Re: Anonymous class - I don't know how to...



On Jun 29, 8:21 am, Andreas Leitgeb <a...@xxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
PS: full blown support for closures means direct support,
not just with help of explicit "containers/wrappers".

All that they need to do is write in some syntactic sugar for the
stuff I demonstrated in this thread. For the passing-in-mutable-locals
thing, silently autoboxing them in one-element arrays -- not unlike
the autoboxing of primitives put into container classes or otherwise
used with generics in 1.5. A return-from-context capability could use
an anonymous exception throw and catch under the hood, not allow the
exception to be absorbed by intervening code (even if it has "catch
(Exception e) {...}"; of course "finally" clauses would still execute
as for any exception propagating up the call chain), and provide a
simple syntax for returning from the enclosing method, say
methodname.return foo or to disambiguate Classname.methodname.return
foo (in case you've decided to get baroque and nest anonymous inner
classes, and from a deep down one return from any of the multiple
enclosing contexts).

In practise, I expect the requirement for "final" on the local
variables may be quietly dropped and nothing will be done to support
returning from enclosing contexts, though it could be done, as it just
isn't very useful in typical Java programming (to the point that I've
never used it aside from as proof-of-concept).


.



Relevant Pages

  • Could not load file or assembly every few days - asp.net 1.1
    ... Could not load file or assembly 'Foo, Version=1.0.2388.18427, ... An unhandled exception occurred during the execution of the ... Please review the stack trace for more information about ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Having to "print" before method invocation?
    ... Hey Fredrik, thanks for responding. ... foo that I've been using without much fuss for a few months now. ... if I add print statements before trying to invoke methods on ... the interpreter won't raise the exception immediately (since it expected you to ...
    (comp.lang.python)
  • Destructors and exceptions
    ... locals appears to be deferred to program exit. ... The only rationale I can think of is to speed up exception ... class Foo: ... def premature_exit: ...
    (comp.lang.python)
  • Re: Having to "print" before method invocation?
    ... foo that I've been using without much fuss for a few months now. ... any attempt to use the instance fails; ... if you get a spurious exception, it's very likely that your C extension sets the ... if you run interpreter code that does something like ...
    (comp.lang.python)
  • Re: compiler warnings for unconditional recursive calls
    ... Hey Jon, you are lightning fast as always:) ... void foo() ... You are right, an exception could terminate the thing, but I wouldn't consider it good style, so a warning wouldn't do any harm. ... Even if the throwwould be executed before the constructor chaining then the Exception would also prevent instantiation. ...
    (microsoft.public.dotnet.languages.csharp)