Storing and Retrieving Point

Bert Freudenberg bert at isg.cs.uni-magdeburg.de
Fri Sep 28 10:35:39 UTC 2001


On Thu, 27 Sep 2001 raymondasselin at sympatico.ca wrote:

> > >pt _ Point new.
> > >pt _ 25 at 125.

There's a very simple explanation why the above code is suboptimal:
The second line does an *implicit* "Point new", which makes the first line
unnecessary.

> 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 ?

It still is.

> I'm a little bit 'confus' because before your note I was pretty sure
> that pt_ Point new. was the way to go !!!

The point is that Point creation is such a ubiquitous operation that there
was a shortcut invented - the "@" operator on numbers. This hides the fact
that a new point is created, but most people prefer it over the longer
version ("100 at 100" vs. "Point new x: 100; y: 100").


-- Bert





More information about the Squeak-dev mailing list