"D-Man" <dsh8290 at rit.edu> wrote in message news:mailman.988076385.11192.python-list at python.org... > On Mon, Apr 23, 2001 at 04:49:01PM -0700, James_Althoff at i2.com wrote: > | > | <jim response> > | > | In Java unnamed (anonymous, inner) classes > | are used all over the place in Swing-GUI code. > | Not advocating -- just pointing it out. :-) > | > | </jim response> > > IMO that is a kludge to work-around for a significant language > deficiency -- if functions (and classes) were first-class objects the > function object itself could be passed as the event handler! It seems that when one CAN does something, one DOES do it:-). I have never agreed with the Borland/Microsoft position that the lack of first-class callables is a "huge gaping hole" in Java (the same excellent software architect who did Delphi for Borland then moved to Microsoft to do similar frameworks for them -- first for Java enriched with first class callables called "delegates", then for C# who also has such constructs -- may be responsible for both firms' "position" in this:-). I think first-class callables are nice-to-have, and I'm glad Python and C++ give them to me, but when I worked in Java I didn't really feel deprived at all, particularly not after they introduced inner classes. OTOH, leaving inner-class instantiation anonymous always rather grated on me. In my limited experience tutoring/mentoring others in Java, I kept seeing misunderstandings based on that -- people who thought they were instantiating an interface, rather than an anonymous inner class implementing that interface -- not to mention the trouble explaining to debuggers what anonymous class you actually MEANT:-). My employer ended up not pursuing Java seriously enough to warrant coding guidelines, else I would have pushed for naming to be recommended here. I do have an example where I'm _exceedingly_ glad I can leave something unnamed, although it *DOES* keep giving debugger problems -- instantiations of C++ templates, particularly method-templates of a class, and PARTICULARLY when the compiler is deducing argument types on my behalf. In this case, if I had to give names to the instantiations, the type-deduction work of the compiler would be for naught... so there is a very specific reason for "leaving nameless"! (It _does_ give problems too, but, here, having to name WOULD substantially diminish power -- so, there IS a tradeoff of some sort). Alex
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4