[Pharo-project] Why String>>adaptToNumber: rcvr andSend: selector
Noooo, we dooon't want to. Nicolas 2010/8/24 Guillermo Polito <guillermopolito@gmail.com>:
Do we reeeeeally want to do
5 + '4'
5 + 'hello'
?
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
:) I accept code. We are in unstable so this is the time to shake the system. On Aug 24, 2010, at 10:17 PM, Nicolas Cellier wrote:
Noooo, we dooon't want to.
Nicolas
2010/8/24 Guillermo Polito <guillermopolito@gmail.com>:
Do we reeeeeally want to do
5 + '4'
5 + 'hello'
?
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Wow, morphic doesn't allow me to change the point aritmethic :D. I supossed it ¬¬. Here is already some code: http://code.google.com/p/pharo/issues/detail?id=2858 On Wed, Aug 25, 2010 at 4:35 AM, Stéphane Ducasse <stephane.ducasse@inria.fr
wrote:
:)
I accept code. We are in unstable so this is the time to shake the system.
On Aug 24, 2010, at 10:17 PM, Nicolas Cellier wrote:
Noooo, we dooon't want to.
Nicolas
2010/8/24 Guillermo Polito <guillermopolito@gmail.com>:
Do we reeeeeally want to do
5 + '4'
5 + 'hello'
?
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
(5 @ 1 ) + 5 doesn't really bother me :S In fact, when I started working with points, some kind of magic made me write that hoping it would work. 2010/8/25 Guillermo Polito <guillermopolito@gmail.com>
Wow, morphic doesn't allow me to change the point aritmethic :D. I supossed it ¬¬.
Here is already some code: http://code.google.com/p/pharo/issues/detail?id=2858
On Wed, Aug 25, 2010 at 4:35 AM, Stéphane Ducasse < stephane.ducasse@inria.fr> wrote:
:)
I accept code. We are in unstable so this is the time to shake the system.
On Aug 24, 2010, at 10:17 PM, Nicolas Cellier wrote:
Noooo, we dooon't want to.
Nicolas
2010/8/24 Guillermo Polito <guillermopolito@gmail.com>:
Do we reeeeeally want to do
5 + '4'
5 + 'hello'
?
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
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'
?
There are two superposed problems there 1) let String auto convert to Number when implied in arithmetic 2) let any malformed String asNumber answer zero To my sense, both features: * are not really necessary nor worth * are a source of problems * should better be removed. Nicolas 2010/8/24 Carla F. Griggio <carla.griggio@gmail.com>:
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'
?
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
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'
?
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'
?
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'
?
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'
?
(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'
?
On 2010-08-24, at 2:02 PM, Guillermo Polito wrote:
5 + (1 to: 10)
5 + (1@5)
I would think that becomes 5 to: 15 and 6@11 BTW don't let 'garbage' asNumber -> 0 that just is a hassle when importing character data that should be a number, but because of a mistake upstream it's not a number. Silently converting to zero is just evil... -- =========================================================================== John M. McIntosh <johnmci@smalltalkconsulting.com> Twitter: squeaker68882 Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com ===========================================================================
+1 On Aug 24, 2010, at 11:07 PM, John M McIntosh wrote:
On 2010-08-24, at 2:02 PM, Guillermo Polito wrote:
5 + (1 to: 10)
5 + (1@5)
I would think that becomes 5 to: 15 and 6@11
BTW don't let 'garbage' asNumber -> 0 that just is a hassle when importing character data that should be a number, but because of a mistake upstream it's not a number. Silently converting to zero is just evil...
-- =========================================================================== John M. McIntosh <johnmci@smalltalkconsulting.com> Twitter: squeaker68882 Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com ===========================================================================
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
participants (5)
-
Carla F. Griggio -
Guillermo Polito -
John M McIntosh -
Nicolas Cellier -
Stéphane Ducasse