[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bindings and assignments (was: Re: continuations)







Guy: On this particular issue -- it really depends on whom you define as
"user" :)
Sun has had a history of defining users somewhat arbitrarily -- you only
need to look at the JDC bug reports and the lamentations of various "users"
(there's that word again) wrt. some of these sorts of issues and bugs
reported against the JDK. You can ask a VB programmer what he or she thinks
is important relative to this issue, and I suspect you might get different
answers than if you ask people with significant "closure" experience.

Unlike Scott though, I wouldn't ascribe this sort of end result to
laziness.. people get awfully defensive w/ words like that after all. I
have personally rationalized a lot of the decisions in Java (and Lisp) as
decisions/judgements made wrt. allocation of resources under the
constraints that particular groups of people faced at particular points in
time. It's not right or wrong.. it's just reasonable .. and it's the way
the world works. And of course, we can make it better next time around.



                                                                           
             Guy Steele - Sun                                              
             Microsystems Labs                                             
             <Guy.Steele@sun.c                                          To 
             om>                       dbtucker@cs.brown.edu,              
             Sent by:                  swm@itasoftware.com                 
             owner-ll1-discuss                                          cc 
             @ai.mit.edu               dherman@ccs.neu.edu,                
                                       sk@cs.brown.edu,                    
                                       ll1-discuss@ai.mit.edu              
             08/21/2003 01:43                                      Subject 
             PM                        Re: bindings and assignments (was:  
                                       Re: continuations)                  
                                                                           
             Please respond to                                             
             Guy Steele - Sun                                              
             Microsystems Labs                                             
             <Guy.Steele@sun.c                                             
                    om>                                                    
                                                                           
                                                                           





   X-Sender: swm@mta.itasoftware.com
   Date: Thu, 14 Aug 2003 11:31:23 -0400
   To: "David B. Tucker" <dbtucker@cs.brown.edu>
   From: Scott McKay <swm@itasoftware.com>
   Subject: Re: bindings and assignments (was: Re: continuations)
   Cc: David Herman <dherman@ccs.neu.edu>, Shriram Krishnamurthi
<sk@cs.brown.edu>, ll1-discuss@ai.mit.edu

   At 10:45 AM -0400 8/14/03, David B. Tucker wrote:
   >  > I imagine, though I don't have statistical evidence, that the
   >>  requirement of declaring local variables to be final in order to
   >>  reference them within anonymous inner classes (closures) is almost
   >>  entirely unknown and unused in practice.
   >
   >Out of curiosity, does anyone know why Java only allows final variables
   >to be referenced from within anonymous classes?

   If you allow the captured variables to be side-effected,
   it means that you have to work harder to ensure that the
   the captured variable is properly shared between multiple
   inner classes that share the lexical environment.  That
   is, if you only allow final variables to be captured,
   you can just copy the value into the "environment" object,
   but if they can be written to, you have to introduce a
   "cell".  To this outside observer, this is a classic
   example of implementor laziness -- it would have been
   "hard" to do the right thing, so they did the wrong thing,
   and everyone who wants inner classes to be useful has
   to introduce a bunch of Cell classes manually.

But, as my previous message explains, your assumption
was incorrect.  We (or, more specifically, John Rose,
who had previously worked on C* and other languages
using Symbolics Lisp Machines) were far from lazy: he
did the whole shebang. and user feedback made us back off.

--Guy Steele