[squeak-dev] ||

David T. Lewis lewis at mail.msen.com
Tue Feb 3 04:35:52 UTC 2015


On Mon, Feb 02, 2015 at 12:47:45PM -0800, Eliot Miranda wrote:
> Hi All,
> 
>     code as in the double bars forming the end of block arguments and the
> beginning of block temporaries in
> 
> convertInstances
> | new old |
> old := Binding allInstances.
> new := old collect: [:ea | ClassBinding key: ea key value: ea value].
> old elementsForwardIdentityTo: new.
>  old := ReadOnlyVariableBinding allInstances.
> new := old collect: [:ea | ClassBinding key: ea key value: ea value].
> old elementsForwardIdentityTo: new.
>  Environment allInstancesDo:
> [:env |
> #('contents' 'bindings' 'public' 'undeclared') do:
> => [:var || dict |
> old := Array new writeStream.
> new := Array new writeStream.
> dict := env instVarNamed: var.
> dict associations do:
> [:binding |
> binding class == Association ifTrue:
> [old nextPut: binding.
> new nextPut: binding key => binding value]].
> old contents elementsForwardIdentityTo: new contents]]
> 
> is legal but highlighted as a syntax error by shout.
> 
> What do you prefer, editing the source to | | or fixing Shout to accept the
> syntax?  The right answer should be fixing shout but the fix will be ugly
> because || is a binary selector and so this will need to be special cased.

If anything needs to be fixed, I would vote for fixing Shout. The syntax is
legal, and to me it intuitively looks like it *should* be legal.

On the other hand, adding some whitespace between the vertical bars is a
good idea for readability, even if it is not a necessary part of the syntax.
So it does not bother me if Shout complains about the missing whitespace.
But I have to admit that it is confusing if Shout displays an apparent
syntax error when in fact nothing is wrong with the syntax.

Dave



More information about the Squeak-dev mailing list