I just did a terrible thing :-)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

I just did a terrible thing :-)

Eliot Miranda-2
 
Hi Smalltalkers,

    I just made a Smalltalk := nil type blunder.  I wrote:

TVariableNode setName:
(node selector = #maxVal
ifTrue: ['MaxSmallInteger']
ifFalse: ['MinSmallInteger'])

and suddenly parse tree printing didn't work and TVariableNode was called MaxSmallInteger :-)

Once I wrote

TVariableNode new setName:
(node selector = #maxVal
ifTrue: ['MaxSmallInteger']
ifFalse: ['MinSmallInteger'])

normal service was resumed.  Normally we don't shoot ourselves in the foot, but when we do we can sometimes repair the damage perfectly by evaluating TVariableNode setName: #TVariableNode ;-)
_,,,^..^,,,_
best, Eliot
Reply | Threaded
Open this post in threaded view
|

Re: I just did a terrible thing :-)

Nicolas Cellier
 
If we want to avoid heart disease we can also use better constructors like TVariableNode named: ...  ;)

Le sam. 19 sept. 2020 à 17:41, Eliot Miranda <[hidden email]> a écrit :
 
Hi Smalltalkers,

    I just made a Smalltalk := nil type blunder.  I wrote:

TVariableNode setName:
(node selector = #maxVal
ifTrue: ['MaxSmallInteger']
ifFalse: ['MinSmallInteger'])

and suddenly parse tree printing didn't work and TVariableNode was called MaxSmallInteger :-)

Once I wrote

TVariableNode new setName:
(node selector = #maxVal
ifTrue: ['MaxSmallInteger']
ifFalse: ['MinSmallInteger'])

normal service was resumed.  Normally we don't shoot ourselves in the foot, but when we do we can sometimes repair the damage perfectly by evaluating TVariableNode setName: #TVariableNode ;-)
_,,,^..^,,,_
best, Eliot
Reply | Threaded
Open this post in threaded view
|

Re: I just did a terrible thing :-)

timrowledge
In reply to this post by Eliot Miranda-2
 


> On 2020-09-19, at 8:40 AM, Eliot Miranda <[hidden email]> wrote:
>
> Hi Smalltalkers,
>
>     I just made a Smalltalk := nil type blunder.  I wrote:
>
> TVariableNode setName:
> (node selector = #maxVal
> ifTrue: ['MaxSmallInteger']
> ifFalse: ['MinSmallInteger'])
>
> and suddenly parse tree printing didn't work and TVariableNode was called MaxSmallInteger :-)

This is just one of the reasons I'd really like properly done private methods; if the Class>setName: method were private you wouldn't have been able to do this. And a lot of other people (ie almost certainly absolutely every person the ever wrote any Smalltalk) wouldn't make a whole raft of mistakes.

I'm not sure we could do it without breaking so much code that we  exploded our brains. Sigh.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Strange OpCodes: UDF: Use Disk for Frisbee


Reply | Threaded
Open this post in threaded view
|

Re: I just did a terrible thing :-)

Tobias Pape
 

> On 19.09.2020, at 19:40, tim Rowledge <[hidden email]> wrote:
>
>
>
>
>> On 2020-09-19, at 8:40 AM, Eliot Miranda <[hidden email]> wrote:
>>
>> Hi Smalltalkers,
>>
>>    I just made a Smalltalk := nil type blunder.  I wrote:
>>
>> TVariableNode setName:
>> (node selector = #maxVal
>> ifTrue: ['MaxSmallInteger']
>> ifFalse: ['MinSmallInteger'])
>>
>> and suddenly parse tree printing didn't work and TVariableNode was called MaxSmallInteger :-)
>
> This is just one of the reasons I'd really like properly done private methods; if the Class>setName: method were private you wouldn't have been able to do this. And a lot of other people (ie almost certainly absolutely every person the ever wrote any Smalltalk) wouldn't make a whole raft of mistakes.
>
> I'm not sure we could do it without breaking so much code that we  exploded our brains. Sigh

The beauty is, tho, we can recover from these mistakes with the same tools we make them with.

-t

>
> tim



Reply | Threaded
Open this post in threaded view
|

Re: I just did a terrible thing :-)

Jakob Reschke
In reply to this post by timrowledge
 
Am Sa., 19. Sept. 2020 um 19:40 Uhr schrieb tim Rowledge <[hidden email]>:

>
> > On 2020-09-19, at 8:40 AM, Eliot Miranda <[hidden email]> wrote:
> >
> > Hi Smalltalkers,
> >
> >     I just made a Smalltalk := nil type blunder.  I wrote:
> >
> >                       TVariableNode setName:
> >                               (node selector = #maxVal
> >                                               ifTrue: ['MaxSmallInteger']
> >                                               ifFalse: ['MinSmallInteger'])
> >
> > and suddenly parse tree printing didn't work and TVariableNode was called MaxSmallInteger :-)
>
> This is just one of the reasons I'd really like properly done private methods; if the Class>setName: method were private you wouldn't have been able to do this. And a lot of other people (ie almost certainly absolutely every person the ever wrote any Smalltalk) wouldn't make a whole raft of mistakes.
>

...or more value objects that are immutable.
Reply | Threaded
Open this post in threaded view
|

Re: I just did a terrible thing :-)

Eliot Miranda-2
 


> On Sep 20, 2020, at 7:45 AM, Jakob Reschke <[hidden email]> wrote:
>
> 
>> Am Sa., 19. Sept. 2020 um 19:40 Uhr schrieb tim Rowledge <[hidden email]>:
>>
>>>> On 2020-09-19, at 8:40 AM, Eliot Miranda <[hidden email]> wrote:
>>>
>>> Hi Smalltalkers,
>>>
>>>    I just made a Smalltalk := nil type blunder.  I wrote:
>>>
>>>                      TVariableNode setName:
>>>                              (node selector = #maxVal
>>>                                              ifTrue: ['MaxSmallInteger']
>>>                                              ifFalse: ['MinSmallInteger'])
>>>
>>> and suddenly parse tree printing didn't work and TVariableNode was called MaxSmallInteger :-)
>>
>> This is just one of the reasons I'd really like properly done private methods; if the Class>setName: method were private you wouldn't have been able to do this. And a lot of other people (ie almost certainly absolutely every person the ever wrote any Smalltalk) wouldn't make a whole raft of mistakes.
>>
>
> ...or more value objects that are immutable.

+1000.  The next level of read-only was could indeed be classed and methods.  Method dictionaries, subclasses arrays and method properties could still be mutable, but the class objects and method objects themselves should be read-only, and eg the class builder and the source/changes condensing code could be modified to make things mutable temporarily.

Another nice thing to have is predictable identity hashes for symbols.  If symbols set their identity hash on initialization, for example as the least 22 bits of their strin hash, then method dictionaries don’t need rehashing on deserialization.

In VW we did this, changing the representation of method dictionaries to flat arrays of selector, method pairs, in symbol indentity hash order, using linear search for small dictionaries and binary search for larger.  This saved a whopping 8% of the base image size, which would go some way to reclaim the 10% or so Spur increased it by by having all objects have at least one slot internally even if they’re empty.

But the most significant thing we’re not doing right now is ephemerons, which will simplify file handling etc.  I have a change set in my image and would love to spend more time on it but Terf is pla pressing priority (hence my sound work).  If anyone is interested, reach out and I can give you the changes and maybe together we could make progress here.  One of the first tasks in realizing EphemeronDictionary is tidying up adding associations to dictionaries (again see the VW code for this done right).  Ours is a mess, and we don’t yet consistently use a pair of exceptions, one for key not found, (which can be used for sequential collection out of bounds too), and one for key already exists.
Reply | Threaded
Open this post in threaded view
|

Re: I just did a terrible thing :-)

Tobias Pape
In reply to this post by Jakob Reschke
 

> On 20.09.2020, at 16:45, Jakob Reschke <[hidden email]> wrote:
>
>
> Am Sa., 19. Sept. 2020 um 19:40 Uhr schrieb tim Rowledge <[hidden email]>:
>>
>>> On 2020-09-19, at 8:40 AM, Eliot Miranda <[hidden email]> wrote:
>>>
>>> Hi Smalltalkers,
>>>
>>>    I just made a Smalltalk := nil type blunder.  I wrote:
>>>
>>>                      TVariableNode setName:
>>>                              (node selector = #maxVal
>>>                                              ifTrue: ['MaxSmallInteger']
>>>                                              ifFalse: ['MinSmallInteger'])
>>>
>>> and suddenly parse tree printing didn't work and TVariableNode was called MaxSmallInteger :-)
>>
>> This is just one of the reasons I'd really like properly done private methods; if the Class>setName: method were private you wouldn't have been able to do this. And a lot of other people (ie almost certainly absolutely every person the ever wrote any Smalltalk) wouldn't make a whole raft of mistakes.
>>
>
> ...or more value objects that are immutable.

Here you are:
https://github.com/shiplift/RSqueakOnABoat
 ;)