Symbol and Array printOn:

Stephane Ducasse ducasse at iam.unibe.ch
Wed Jan 12 08:27:56 UTC 2000


Hi Bolot

Thanks for the explanation 
But #() is for literal array and {} or Array are for dynamic array so where is 
the problem. 
I agree with David Smith and Bert.

For me this is really important that array or symbol have a coherent printed 
form. Espcecilly if you think that they are entities that can be self evaluated.
The value of a symbol being the symbol itself the texttual representation should 
be the same if the symbol is typed or printed. As bert mentioned the side effect 
is that we can really use convenently the inspector, printed information
just because this is the good textual representation. 

I think that it could be great if we could extract the solution proposed by 
david and  incorporated it into squeak. What do you think David ? 
David I do not know in VA but in VW we can have symbol like that
#'abd - hjhkjkjh' 
So I would love to see your proposition included in Squeak. 

You are right there is somethign wrong here
Printing 
#'a b c' prints a String ;(


I also was thinking that if there is a difference between Squeak and other 
Smalltalk for basic stuff it should be because of an enhancement of Smalltalk.
Here I just see that this was forgotten.

For #(#a #b #c) I guess that there is no simple solution.
This one is at least coherent (even if for complete coherence when should be 
forced to type #(#a #b #c) instead of #(a b c) but this is just the semantics
of #(). So we can consider that #(a b c) is a gift ;)

> Inspect this:
>   Array with: FileDirectory default with: Color white
> 
> Now, put # in front of the (...) expression
>   #(DosFileDirectory on 'D:\bolot\games' (Color r: 1.0 g: 1.0 b: 1.0) )
> inspect it. You get back an array of 4 elements, e.g.
>   (DosFileDirectory on 'D:\bolot\games' (Color r: 1.0 g: 1.0 b: 1.0 ) )
> It's because #() syntax only supports literals (the (Color ....) element is
> actually an array of literals).
> 
> You could also inspect
>   self storeString
> of the original array, and get
> '((Array new: 2) at: 1 put: (DosFileDirectory basicNew instVarAt: 1 put:
> ''D:\bolot\games''; yourself); at: 2 put: (Color r: 1.0 g: 1.0 b: 1.0);
> yourself)'
> which evaluates into the right thing.
> 
> Bolot
> 
> ----- Original Message -----
> From: "Bert Freudenberg" <bert at isgnw.CS.Uni-Magdeburg.De>
> To: <squeak at cs.uiuc.edu>
> Sent: Tuesday, January 11, 2000 9:44 AM
> Subject: Re: Symbol and Array printOn:
> 
> 
> > On Tue, 11 Jan 2000, Stephane Ducasse wrote:
> >
> > > Is there a reason why symbols and arrays are not printed with # like in
> VW
> >
> > There is a reason, but I don't remember it, it wasn't obvious (perhaps it
> > looks more "natural"?). There was a discussion some time ago that didn't
> > convince me. So count this as a vote for making this change.
> >
> > > This has the main advantage that we can reuse a printed result while
> > > evaluating another expression.
> >
> > Exactly. This is almost essential for all who love to tweak objects in
> > inspectors :-)
> >
> >   -Bert-
> >
> >
> >
> 

Stephane DUCASSE (ducasse at iam.unibe.ch) http://www.iam.unibe.ch/~ducasse/
"if you knew today was your last day on earth, what would you do 
different? ... especially if, by doing something different, today 
might not be your last day on earth" Calvin&Hobbes

University of Bern, Institut fuer informatik and Mathematik
IAM-SCG, 10 neubruckstrasse, CH-3012 Bern, Switzerland.






More information about the Squeak-dev mailing list