Re: [Pharo-users] Hmmm sending at:put: to an undefined object (nil) gives a confusing error message

2019-03-11 Thread Richard O'Keefe
I understand #basicAt:[put:] being in Object, but I never understood #at:[put:] being there. GNU Smalltalk: st> nil at: 1 Object: nil error: Invalid value nil: object not indexable In my Smalltalk, you get a DNU. In Squeak you get a debugger window with title Error: instances of UndefinedObject are

Re: [Pharo-users] Hmmm sending at:put: to an undefined object (nil) gives a confusing error message

2019-03-12 Thread Marcus Denker
Hi, Yes, I do not like it… I think it is there so that you can just make a variable subclass and at: / at:put: will work without having to re-implement them… Marcus > On 12 Mar 2019, at 04:55, Richard O'Keefe wrote: > > I understand #basicAt:[put:] being in Object, but I never underst

Re: [Pharo-users] Hmmm sending at:put: to an undefined object (nil) gives a confusing error message

2019-03-12 Thread Ben Coman
On Tue, 12 Mar 2019 at 21:56, Marcus Denker wrote: > > Hi, > > Yes, I do not like it… I think it is there so that you can just make a > variable subclass and at: / at:put: will work without > having to re-implement them… So we should consider... * how often are variable subclasses created ? by

Re: [Pharo-users] Hmmm sending at:put: to an undefined object (nil) gives a confusing error message

2019-03-12 Thread Richard O'Keefe
Putting public methods in Object that it cannot honestly support makes #respondsTo: pretty unreliable. It is an obsolete practice, because having Traits means that those methods can be mixed in with (part of) a single line. On Wed, 13 Mar 2019 at 03:20, Ben Coman wrote: > On Tue, 12 Mar 2019 at

Re: [Pharo-users] Hmmm sending at:put: to an undefined object (nil) gives a confusing error message

2019-03-12 Thread K K Subbu
On 12/03/19 9:25 AM, Richard O'Keefe wrote: Squeak where (20 factorial at: 1) answers 0 (oh dear oh dear oh dear). Richard, Could you please elaborate on why this is an error? Large integers are place value encoded (base 256 little endian) and stored in byte arrays, so they need #at:/#at:put

Re: [Pharo-users] Hmmm sending at:put: to an undefined object (nil) gives a confusing error message

2019-03-13 Thread Richard O'Keefe
Let's start with portability. I have ST/X, VAST, VW, Squeak, Pharo, GST, Dolphin, and some minor systems. GST and ST/X do not define #at: on any kind of integer at all. Why would they? #basicAt: will do the job, will it not? Dolphin defines #at:[put:] on Integer as self shouldNotImplement and so

Re: [Pharo-users] Hmmm sending at:put: to an undefined object (nil) gives a confusing error message

2019-03-13 Thread Richard O'Keefe
Base 256: that's an implementation detail. Little-endian: that's an implementation detail. My Smalltalk uses base 65536 native-endian and takes some care not to let Smalltalk code find out. (Not least because on 64-bit machines I want to use base 2**32.) For *private* methods, depending on otherwis

Re: [Pharo-users] Hmmm sending at:put: to an undefined object (nil) gives a confusing error message

2019-03-13 Thread Sven Van Caekenberghe
> On 13 Mar 2019, at 08:15, Richard O'Keefe wrote: > > My Smalltalk Where can I have a look at that ?

Re: [Pharo-users] Hmmm sending at:put: to an undefined object (nil) gives a confusing error message

2019-03-13 Thread Richard O'Keefe
It's supposed to be on GitHub but I botched it. On Wed, 13 Mar 2019 at 21:08, Sven Van Caekenberghe wrote: > > > > On 13 Mar 2019, at 08:15, Richard O'Keefe wrote: > > > > My Smalltalk > > Where can I have a look at that ? > >

Re: [Pharo-users] Hmmm sending at:put: to an undefined object (nil) gives a confusing error message

2019-03-13 Thread K K Subbu
On 13/03/19 12:45 PM, Richard O'Keefe wrote: Base 256: that's an implementation detail. Little-endian: that's an implementation detail. Architecture-specific no. Implementation yes. But that should be fine for private methods. My Smalltalk uses base 65536 native-endian and takes some care n

Re: [Pharo-users] Hmmm sending at:put: to an undefined object (nil) gives a confusing error message

2019-03-13 Thread Richard O'Keefe
Byte arrays are not host specific. True. But integers are not byte arrays. They don't even contain byte arrays. Just like (boxed) Floats are not word arrays and don't contain word arrays. For what it's worth, I find that it's quite unusual for a method to change from private to public or vice ve