Storing and Retrieving Point

raymondasselin at sympatico.ca raymondasselin at sympatico.ca
Fri Sep 28 01:18:35 UTC 2001


John M McIntosh <johnmci at smalltalkconsulting.com> wrote:
> >I'm having trouble storing and retrieving Points. What am I doing wrong?
> >
> >pt _ Point new.
> >pt _ 25 at 125.
> >dict _ Dictionary new.
> >dict at: 'first' put: #('text' pt).
> >readPt _ ((dict at: 'first') at: 2). "readPt is now a Symbol"
> >
> >Thx for any pointers.
> >Ken
> 
> Mmm I think some others missed just a little wee issue. I noticed 
> that you assign pt the value Point new, then assign it 25 at 125. 
> Sometimes I've seen this from folks that are use to declaring the 
> type of a variable. In Smalltalk the variable is just a reference to 
> an object, it has no typing information.
> 
> Therefore all you really  need to do is
> pt _ 25 at 125
> 
snip....

John
What you say is new to me 

-There is lots of examples in Smalltalk which suggest something like
Morph new, or Foo new, so for me this was not linked to the use of
declaring the type of a variable.
-I know that when you try to define new for a Class you defined, Squeak
answer a caution 'new is used in the existing class system......' I
usually ignore it and go forward. 

Your remark is intriguing to me...did this means that it's not a good
way to go to define a 'new' as a 'builder' Class method in Squeak ?
I'm a little bit 'confus' because before your note I was pretty sure
that pt_ Point new. was the way to go !!!

Raymond




More information about the Squeak-dev mailing list