On Fri, Apr 29, 2011 at 10:28 AM, Hai-Nam Nguyen <[email protected]> wrote:
> On 29/04/11 04:52, Serge Stinckwich wrote:
>>
>> and in Smalltalk :
>>
>> 6/2*1+2
>> =>  5
>>
>> but :
>>
>> 2+6/2*1
>> =>  4
>>
>> Any ideas why ?
>>
>
> Yes, because in Smalltalk all binary operators have the same precedence
> (which is less prioritary than unary operators).

Yes good reply :-)

But in fact, there is no operator in Smalltalk ... +, *, etc are
message sending to objects
and ST don't care about the semantic associated.
You could add numbers but also colors or matrix if you want.

Color green + Color blue + Color red ?


-- 
Serge Stinckwich
UMI UMMISCO 209 (IRD/UPMC), Hanoi, Vietnam
Every DSL ends up being Smalltalk
http://doesnotunderstand.org/
_______________________________________________
POST RULES : http://wiki.hanoilug.org/hanoilug:mailing_list_guidelines
_______________________________________________
HanoiLUG mailing lists: http://lists.hanoilug.org/
HanoiLUG wiki: http://wiki.hanoilug.org/
HanoiLUG blog: http://blog.hanoilug.org/

Trả lời cho