Dot notation and a crazy idea

Jerome Garcia Jerome.Garcia at wj.com
Thu Mar 18 17:43:35 UTC 1999


     
On 3/18/99 Marcel Weiher wrote:

>
<crazy-idea>
     
In fact, the whole business of refering to objects via name is
really just a special case of selection.  Which object do you want?   
The one named 'bert'.
     
Let's generalize this back to saying that a dotted name is really a  
select statement.  So we could have something like:
     
        customers.[ name == 'Kay' ].name capitalize.
     
instead of
     
        customers select: [ :each | each name == 'Kay' ] do: [ :each  
| each name capitalize ].
     
with the square-brackets thingy in the dotted path being a 
simplified block, though maybe a full block would be better.  (Then  
again, why shouldn't both types co-exist?)
     
Add multiple method returns ( 'sendback' ), and ... wow!  Certainly  
all sorts of 'generate-and-test' programs become one-liners.
     
</crazy-idea>
>
     
     
I love this crazy-idea. It results in code which is both more readable 
and more concise.
     
     Jerome





More information about the Squeak-dev mailing list