Re: [Pharo-project] Surprising binary messages!

2011-01-18 Thread Stéphane Ducasse
Yes man. Stef > You're right. It looks like I need to sleep more :-D > > Noury

Re: [Pharo-project] Surprising binary messages!

2011-01-18 Thread Schwab,Wilhelm K
[bouraq...@gmail.com] Sent: Tuesday, January 18, 2011 6:29 AM To: Pharo-project@lists.gforge.inria.fr Subject: [Pharo-project] Surprising binary messages! 5 is the surprising answer of the expression: 6 + 4 / 2 It should be 8 But, I got 5 in both 1.1 and 1.2. Noury

Re: [Pharo-project] Surprising binary messages!

2011-01-18 Thread Noury Bouraqadi
You're right. It looks like I need to sleep more :-D Noury On 18 janv. 2011, at 12:38, Stéphane Ducasse wrote: > but this is normal. It was always like that. No operator precedence just > messages > > binary are evaluated from right to left > 6 + 4 > 10 / 2 >

Re: [Pharo-project] Surprising binary messages!

2011-01-18 Thread Pietro Maggi
On Tue, Jan 18, 2011 at 12:40 PM, Stéphane Ducasse wrote: >> >> I'm just starting to learn smalltalk (thanks to PbE), but I'm pretty >> sure I know why this happens :-) > > Excellent! I like that our energy helps people. > It really does! Thanks to all the Pharo/Squeak community for the great eff

Re: [Pharo-project] Surprising binary messages!

2011-01-18 Thread Stéphane Ducasse
> > I'm just starting to learn smalltalk (thanks to PbE), but I'm pretty > sure I know why this happens :-) Excellent! I like that our energy helps people. > Smalltalk has no knowledge of mathematics order, just operation order. > In this case + and / are both binary operators so the operations

Re: [Pharo-project] Surprising binary messages!

2011-01-18 Thread Igor Stasenko
On 18 January 2011 12:29, Noury Bouraqadi wrote: > 5 is the surprising answer of the expression: > 6 + 4 / 2 > > It should be 8 > But, I got 5 in both 1.1 and 1.2. > this is first thing all smalltalkers learn: smalltalk syntax does not using math operators precedence rules. because #+ and #/ is j

Re: [Pharo-project] Surprising binary messages!

2011-01-18 Thread Stéphane Ducasse
but this is normal. It was always like that. No operator precedence just messages binary are evaluated from right to left 6 + 4 10 / 2 5 > 5 is the surprising answer of the expression: > 6 + 4 / 2 > > It should be 8 > But, I got 5 in b

Re: [Pharo-project] Surprising binary messages!

2011-01-18 Thread Pietro Maggi
On Tue, Jan 18, 2011 at 12:29 PM, Noury Bouraqadi wrote: > 5 is the surprising answer of the expression: > 6 + 4 / 2 > > It should be 8 > But, I got 5 in both 1.1 and 1.2. > > Noury > Hi, I'm just starting to learn smalltalk (thanks to PbE), but I'm pretty sure I know why this happens :-) Smallt

Re: [Pharo-project] Surprising binary messages!

2011-01-18 Thread Tudor Girba
Why should it be 8? #+ and #/ have the same priority and they will be evaluated from left to right. Cheers, Doru On 18 Jan 2011, at 12:29, Noury Bouraqadi wrote: > 5 is the surprising answer of the expression: > 6 + 4 / 2 > > It should be 8 > But, I got 5 in both 1.1 and 1.2. > > Noury >

Re: [Pharo-project] Surprising binary messages!

2011-01-18 Thread Stanislav Paskalev
There is no such priority in smalltalk. + / - * are just normal binary messages - they take precedence over keyword messages and are second in line after unary ones. And everything is executed left to right so 5 is an expected answer here. Regards, Stanislav Paskalev On Tue, Jan 18, 2011 at 1:

Re: [Pharo-project] Surprising binary messages!

2011-01-18 Thread Marcus Denker
On Jan 18, 2011, at 12:30 PM, Noury Bouraqadi wrote: > 5 is the surprising answer of the expression: > 6 + 4 / 2 > > It should be 8 > But, I got 5 in both 1.1 and 1.2. Why? 6 + 4 is 10 and devided by 2 is 5. (there is no operator precedence) Marcus -- Marcus Denker -- http://www.ma

[Pharo-project] Surprising binary messages!

2011-01-18 Thread Noury Bouraqadi
5 is the surprising answer of the expression: 6 + 4 / 2 It should be 8 But, I got 5 in both 1.1 and 1.2. Noury