Login  Register

Re: printing collections

Posted by Andreas.Raab on Nov 02, 2009; 11:37pm
URL: https://forum.world.st/printing-collections-tp360853p360866.html

Nicolas Cellier wrote:

> While at isSelfEvaluating, I wonder why we do not abuse {..} notation
> a bit more.
> Instead of printing 'aSet( 0@0 1@2 )'
> we could just make it evaluate proof '{0@0. 1@2} asSet'
>
> Of course, with limited stream, we take the risk of loosing trailing '
> asSet' information.
> So we can also print using a less nice but still evaluating 'Set
> newFrom: {0@0. 1@2}'.
>
> As a bonus, generalizing this behaviour might also eliminate a few
> bytecodes and methods from the Kernel.
>
> Same for storeOn:
>
> What do you think ?

-1. The goal of printing isn't to make parsing easier. In fact I find
this to be the least useful application of {} - the advantage of the
syntax form is that it is immediately recognized and consequently
requires less effort than having "an Array(". That you can also evaluate
it in some situations is a useful side effect but no more.

Cheers,
   - Andreas