A still sensible question about _ and :=

Stephane Ducasse ducasse at iam.unibe.ch
Tue Apr 24 07:38:51 UTC 2001


Fun to see your answer before my post ;)
Can you see into the future? because I have a lot of questions for you then.

> It's just faster to type. That's all. I used to do VW all the time and some
> of my older code uses := but once you get really into it it's just one
> character less to type. More efficient. Now I'm not saying it's good but I
> believe that is the reason - it's because those guys who are doing a lot of
> Squeak hacking have learned to value the increased efficiency. And nothing
> prevents you from writing := if you wish.

I really understand that point because I liked it also when I started in
Squeak. Then I realized that this was a bad way of not being ansi
even if Squeak will certainly evolve in the future.

I have the impression that this _ speed key could be solved at the level of
the IDE rather than the language. Imagine that the key ctrl _ produce :=
you would be as fast and we could get rid of that stuff.


>> I let the discussion of { . } for another email but I think from the
>> experience I had looking at ObjectStudio industrial application code
>> (ObjectStudio proposes also { } and programmer loved it to write
>> amazingly ugly code) that { . } is absolutely *not* a cool shortcut for
>> dynamic array creation.
> 
> No?! Is 
> Array with: (Array with: 1 with: 2)
> with: (Array with: 3 with: 4).
> 
> any better than
> 
> { {1. 2}. {3. 4} }
> ?! Just wondering...

Yes I agree when I saw that I said really cool. I started to like it. Then
I saw horrible code in an industrial project with

    {[ ablock capturing variables] [another block]
     [ ablock capturing variables] [another block]
     [ ablock capturing variables] [another block]
     [ ablock capturing variables] [another block]
     [ ablock capturing variables] [another block]} cond

The list was much more than tha and with nested cond ;(((((
Here you could say anybody can write bad code sure.

For the project I started to see how I could use the refactoring browser
scanner to see if I could import objectStudio code into VisualWorks because
I wanted to analyse it with our own VW tools.

Then I stopped because the fact that you can put anything and not simply
true false nil into a dynamic array makes the parse much more complex.
It was not straightforward to fix teh RB scanner to handle such a code
because true nil false and literals are easy to parse and recognize not full
block cpaturing variable).
By the way one of the porter of RB to ObjectStudio was not aware of the
semantic of {} and we have some nice emails. May be I was not clever enough
but I learned to pay attention to first impressions.

So you see this is not a simple rich kid attitude. I was just saying to
myself. If something makes the language simpler I prefer even if the live
of the programmer is a bit more difficult. So I agree with you that I prefer
to type { {1. 2}. {3. 4} } than its normal form but is it worth.
I have the impression that this is not because we can do it that this is
worth doing it. 

For me {} are like macro expansion. Why don't we have macros like in Scheme
then, why only {}?



> Cheers,
> - Andreas
> 





More information about the Squeak-dev mailing list