Re: Anonymous class - I don't know how to...
- From: Andreas Leitgeb <avl@xxxxxxxxxxxxxxxxxxxxxxxx>
- Date: 29 Jun 2007 13:30:16 GMT
Twisted <twisted0n3@xxxxxxxxx> wrote:
You can work around it too, by using final arrays or final objects
with mutable fields. In fact, you can get closure-like behavior:
It's good that you mentioned the use of arrays for sharing
non-final data with a closure. I plainly forgot to mention this
workaround, myself.
However, I didn't understand the necessity of involving exceptions.
whenever the closure has done its job, you just access the array
element in the outer object, no matter if any exceptions were
thrown from the closure or whether it returned normally.
Even more, if you pass the closure to somewhere, where it is
supposed to be "used" more than once, then your exception-throwing
closure will break that after its first use.
Surely there are cases, where you want to throw exceptions
from the closure, but that isn't at all related to sharing data.
.
- Follow-Ups:
- Re: Anonymous class - I don't know how to...
- From: Twisted
- Re: Anonymous class - I don't know how to...
- References:
- Anonymous class - I don't know how to...
- From: kaja_love160
- Re: Anonymous class - I don't know how to...
- From: Andreas Leitgeb
- Re: Anonymous class - I don't know how to...
- From: Twisted
- Anonymous class - I don't know how to...
- Prev by Date: Re: Using mandatory libraries (custom class loading vs. expanding libraries)
- Next by Date: Re: NEED materials
- Previous by thread: Re: Anonymous class - I don't know how to...
- Next by thread: Re: Anonymous class - I don't know how to...
- Index(es):
Relevant Pages
|