Newsgroups: comp.lang.c++,comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!news.alpha.net!uwm.edu!cs.utexas.edu!sdd.hp.com!hplabs!hplextra!hplb!gw
From: gw@hplb.hpl.hp.com (Gunther Walther)
Subject: Re: Smalltalk @ Operator in C++
Sender: news@hplb.hpl.hp.com (Usenet News Administrator)
Message-ID: <D5uAFs.Exs@hplb.hpl.hp.com>
Date: Wed, 22 Mar 1995 11:26:15 GMT
References: <3k7rdd$drs@News1.mcs.com> <patrick_d_logan.172.000FB864@ccm.jf.intel.com> <3kfhuq$o8b@News1.mcs.com>
Nntp-Posting-Host: gwalther.hpl.hp.com
Organization: Hewlett-Packard Laboratories, Bristol, England
X-Newsreader: TIN [version 1.2 PL0.7]
Followup-To: comp.lang.c++,comp.lang.smalltalk
Lines: 54
Xref: glinda.oz.cs.cmu.edu comp.lang.c++:118854 comp.lang.smalltalk:22005

Jim Fleming (jim.fleming@bytes.com) wrote:

: If Smalltalk programmers can do it *either* way then,
: 	why do they choose to use the @ format?

It might *just* be more efficient (in the current implementations).
Points are a very important part of the Smalltalk system, and
their efficiency is likely to affect the overall system performance.

1)  The following is how it works in PP VisualWorks:

	aNewPoint:= Point x: 4 y: 5

    causes several keyword message sends:
	x:y:, basicNew, setX:setY

	aNewPoint:= 4@5.

    using @ causes the @ message to be send to an integer. This
    operation is implemented as a primitive. 

2)  Binary messages might (wild guess) be faster than keyword message.

3)  Binary messages should be faster than a keyword message with
    two arguments.

4)  Application programmers might just prefer it for typing efficiency:
    Point x: y: -> 9 characters
    @           -> 1 character

5)  Application programmers imitate the way the system classes are
    written. While there might have been runtime efficiency reasons
    for using @ in the system classes, the application programmers
    don't really care, but just follow a tradition.

6)  It might (wild guess) that at one time people were planning to
    do the instantiation of points at compile time and this would
    have been more convenient if there was a operator which only
    dealt with points.

7)  Points are a basic concept and programers like to express
    this fundamental concept using a special '@' syntax. 

gunther

PS: I'm doing it because of 4), 5) and 7)

--
------------------------------------------------------------------
Gunther Walther                 | Phone: +44 117 9228518 (direct)
Hewlett-Packard Laboratories,   |    or: +44 117 9799910 x28518  
Filton Road, Stoke Gifford,     | FAX:   +44 117 9228972
Bristol, BS12 6QZ, U.K.         | EMAIL: gw@hplb.hpl.hp.com
NOTE THAT BRISTOL HAS NOW A NEW AREA CODE: 117 9 CHANGE YOUR RECORDS
