(1 to: 10) + 5

is a shortcut for (1 to: 10) collect:[:number | number + 5]

(1 @ 5) + 5

is a shortcut for (1 @ 5) + (5 @ 5)



On Tue, Aug 24, 2010 at 6:02 PM, Guillermo Polito <guillermopolito@gmail.com> wrote:
But... What do they do? They are not clean.

Does the collection one add the element to the collection?

Does the point one add the number to the first, the second or both components?� I remember that a point might be added to other point, multiplied by another point or a scalar :).


On Tue, Aug 24, 2010 at 5:53 PM, Carla F. Griggio <carla.griggio@gmail.com> wrote:
I think 5 + 'hello' is plain wrong.

In these cases:


5 + (1 to: 10)

5 + (1@5)

the message shouldn't be conmutative. What I mean is that I don't want that to be the same as:

(1 to: 10) + 5

(1 @ 5) + 5


On Tue, Aug 24, 2010 at 5:44 PM, Guillermo Polito <guillermopolito@gmail.com> wrote:
I feel these pieces of code aren't really explicit in what they do

5 + 'hello'

5 + (1 to: 10)

5 + (1@5)



On Tue, Aug 24, 2010 at 5:42 PM, Guillermo Polito <guillermopolito@gmail.com> wrote:
Well Collection and Point understand that message too.

One step at a time, but an issue entry now so we don't forget about it.

http://code.google.com/p/pharo/issues/detail?id=2858


On Tue, Aug 24, 2010 at 5:20 PM, Carla F. Griggio <carla.griggio@gmail.com> wrote:
What we've been discussing with Guille is that sometimes the 'type checking' (or actually, the conversion) is done, and sometimes not.

For example:

5 + true

true does not understand 'adaptToNumber:andSend:', so no magic conversion is done, but strings understand that message so we get things like:

5 + 'foo' = 5

This should be consistent regardless the type of the parameter.

Cheers,
Carla



On Tue, Aug 24, 2010 at 5:10 PM, Guillermo Polito <guillermopolito@gmail.com> wrote:
Do we reeeeeally want to do

5 + '4'

5 + 'hello'

?