Newsgroups: comp.lang.c++,comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!uhog.mit.edu!bloom-beacon.mit.edu!spool.mu.edu!howland.reston.ans.net!ix.netcom.com!netcom.com!milod
From: milod@netcom.com (John DiCamillo)
Subject: Re: Smalltalk @ Operator in C++
Message-ID: <milodD5pF9x.EBE@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
References: <3k7rdd$drs@News1.mcs.com> <patrick_d_logan.172.000FB864@ccm.jf.intel.com> <3kfhuq$o8b@News1.mcs.com>
Date: Sun, 19 Mar 1995 20:22:44 GMT
Lines: 51
Sender: milod@netcom12.netcom.com
Xref: glinda.oz.cs.cmu.edu comp.lang.c++:118430 comp.lang.smalltalk:21930

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

>In article <patrick_d_logan.172.000FB864@ccm.jf.intel.com>, 
>patrick_d_logan@ccm.jf.intel.com says...
>>
>>In article <3k7rdd$drs@News1.mcs.com> jim.fleming@bytes.com (Jim Fleming) 
>writes
>>:
>>
>>>How do I convert Smalltalk programs that heavily use the @ method
>>>selector to C++?
>>
>>>For example,
>>>a := 150 @ 200.
>>
>>>How do I do this in C++?
>>
>>a = new Point(150, 200);
>>
>>

>It seems that several people have come up with solutions similar
>to the one shown above.

>Can we conclude that the @ operator can not be used in C++?

Yes.

>Is there any reason why?

Yes.  Because the at-sign is not a legal character in C or C++.
Furthermore, C++ operator overloading does not allow the programmer
to define new operator symbols, just new meanings for the existing
operators.  If you want to know why this is the case, I suggest
you read more of D&E than just the index.

>Do people really think that the above is "clearer".

Yes.

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

Because somebody thought it was a neat idea at one time, and
everybody else ultimately got used to it.

-- 
    ciao,
    milo
================================================================
    John DiCamillo                        Pinin' for the fjords?
    milod@netcom.com                  What kind of talk is that?
