[Baypiggies] Frequently Argued Objections

Warren Stringer warren at muse.com
Mon Jun 23 18:12:56 CEST 2008


This is what I was hoping for (except for offhand comment about a  
whining, though I'll attribute that to Alex's inimitable charm ;-) as  
it put's Objections in context of other languages.

Unfortunately, I have people awaiting some code, so, due to time  
constraints, I must defer and (implicitly) demure. Am looking forward  
to rereading this comment in the near future.

\~/

On Jun 23, 2008, at 8:40 AM, Alex Martelli wrote:

> On Mon, Jun 23, 2008 at 7:41 AM, Warren Stringer <warren at muse.com>  
> wrote:
>   ...
>> My guess is that:
>>       1)  9 times out of 10 the var in self.var is blindingly  
>> obvious,
>>       2) 99 times out of 100 it is obvious after a 10 second search,
>
> I think that there are way more than 1 in 100 uses even just for the
> simplest example that shows this guess to be unfounded: "self.var = x"
> which would allowed to become "var = x"  under a deleterious "implicit
> self" rule.
>
> Right now, "var = x" sets a local variable in the method, "self.var =
> x" sets an instance variable: zero ambiguity, zero chances for error,
> zero problems -- well let's say epsilon problems rather than zero,
> because there IS the issue of having to listen to whines against
> "mandatory explicit self";-).
>
> There are good ways and bad ways to address this issue during language
> design. The best way -- as in Modula-3, Python, Perl-5, Ruby -- is to
> explicitly mark instance variables (self.var in Modula-3 and Python,
> $self->{var} in Perl-5, @self in Ruby); a somewhat inferior way -- as
> in Squeak -- is to give up some of the language's dynamic nature by
> forcing variables to be declared; a worse way would be to break
> symmetry by using the explicit mark in assignment but not in
> reference.
>
> The very worst way is shown by Javascript's "with" statement -- within
> a Javascript "with zap", the meaning of "zop = 23" is essentially
> unguessable as it depends on whether zap already did have a zop
> attribute (in which case it rebinds it) or not (in which case it binds
> a global variable -- unless there was an earlier declaration of "var
> zop" in this function, in which case it binds the local variable
> instead) -- a mix of forced declaration and blind guessing that good
> books on Javascript (e.g. the short and useful "Javascript, the good
> parts") strive to convince the reader to never, ever use that accursed
> statement.
>
> Within the "explicit mark" camp, Ruby's "@var" is typographically
> concise but conceptually bends Occam's razor -- it makes the language
> introduce one more rule (on the meaning of a "@" prefix) where the
> choice that Python took from Modula-3 just reuses an existing rule
> (whatever.var means exactly the same in all cases, whether "whatever"
> is "self" or something other than "self" -- no special cases, no extra
> rules).
>
>
> Alex
>



More information about the Baypiggies mailing list