Howard,
I agree that the --> is easier to read.
However, I am not sure why you want to use
blocks this way in the first place?
| x y z |
x := 2.
y := x * x.
z := y + 5.
z sqrt
or even:
| x |
x := 2.
x := x * x.
x := x + 5.
x sqrt
Cheers,
Wolfgang
Howard Oh wrote:
> Block is one of the reasons that makes Smalltalk so lovable. But
> sometimes, block can make expressions very hard to read, because we
> human read parameter object first and then read inside the block just
> like Smalltalk runtime would do. This makes our reading cursor jump to
> right end and then back to left.
>
> A guick example that can depict this point can be...
>
> [:x| x sqrt ] value: ([:x| x + 5 ] value: ([:x| x * x ] value: 2))
>
>
>
> An idea came up to me a few minutes ago,
>
> Define a method for Object
>
> ------------------------------------------------------------------------------------
> Object>>--> aBlock
>
> ^aBlock value: self
> ------------------------------------------------------------------------------------
>
> This new method can transform the example expression to...
>
> 2 --> [:x| x * x ] --> [:x| x + 5 ] --> [:x| x sqrt ]
>
>
>
> Have a good one
> Howard
>