Some Self ideas

Jesse Welton jwelton at pacific.mps.ohio-state.edu
Thu Jan 18 19:53:58 UTC 2001


Matthew S. Davis wrote:
> 
>      Hmmm - when I read the original post I still get the impression that
> the intent is to remove blocks from ifTrue:ifFalse:.  Maybe I'm just
> missing something in the original post.  Could you clarify what you mean
> for me then?  It's the first example that has me thinking that the
> intent is to remove blocks...  Here's the relevant part of the original
> post:
> 
> >I think that Squeak can include two messages (like Self) in Object that
> >can be very usefull.
> >
> >One is:
> >
> >Object>>value
> >    ^ self
> >
> >In these way, all objects become polymorphic with blocks, so we can
> >type:
> >
> >someVar := someCondition ifTrue:1 ifFalse:2.
> >
> >instead of
> >
> >someVar := someCondition ifTrue:[1] ifFalse:[2].
> >
> >Actually the Squeak compiler does not permit other parameters than a
> >Block in these expression

It looks to me like the idea is intended to reduce the syntax overhead
when the values to be returned are already known - constants or
variables.  In this case, there is nothing to compute, hence no
computation to delay and no need for blocks.  I do think it's likely
that this could lead to carelessness and oversight of wrapping an
expensive computation in a block, which is undeniably bad.

-Jesse





More information about the Squeak-dev mailing list