Horribly mutable compiled method litterals

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

Horribly mutable compiled method litterals

Stéphane Rollandin
Hello,

I just realized that one can change much too easily the behavior of some
compiled methods dynamically, which seems to me more like a bug than a
feature.

For example, if you do the following in a workspace:

Character constantNames at: 5 put: #hello

then until #constantNames is recompiled, it will return #(#backspace #cr
#delete #escape #hello #null #newPage #space #tab) instead of
#(#backspace #cr #delete #escape #lf #null #newPage #space #tab).

This allows horrible bugs horribly difficult to debug which is, IMHO,
horrible.

So, is it a feature ?


Stef


Reply | Threaded
Open this post in threaded view
|

Re: Horribly mutable compiled method litterals

Nicolas Cellier


2016-11-08 16:03 GMT+01:00 Stéphane Rollandin <[hidden email]>:
Hello,

I just realized that one can change much too easily the behavior of some compiled methods dynamically, which seems to me more like a bug than a feature.

For example, if you do the following in a workspace:

Character constantNames at: 5 put: #hello

then until #constantNames is recompiled, it will return #(#backspace #cr #delete #escape #hello #null #newPage #space #tab) instead of #(#backspace #cr #delete #escape #lf #null #newPage #space #tab).

This allows horrible bugs horribly difficult to debug which is, IMHO, horrible.

So, is it a feature ?


Stef



It may have been used as a hack for providing static storage with scope restricted to a method, but it's clearly not an official feature.

We will have immutaiblity in a very near future (or should I say we have?), so we might forbid this very soon now...

But anyway, what do you expect from a language that provides a #become: operation ?
We need to teach that superpowers implies super-responsibility.



Reply | Threaded
Open this post in threaded view
|

Re: Horribly mutable compiled method litterals

Stéphane Rollandin
> We need to teach that superpowers implies super-responsibility.

You're right, so I have to be able to look this super-horrible stuff in
the eye.

(sigh)

Stef

Reply | Threaded
Open this post in threaded view
|

Re: Horribly mutable compiled method litterals

Peter Crowther-2
I'm fascinated by the differences in opinion - I don't regard this as horrible; I regard it as useful, exciting, and a wonderful consequence of everything being an object.  But then I'm the kind of person who coded reasonably solid decompilation protection into the VisualWorks image some years ago...

- Peter

On 8 November 2016 at 16:21, Stéphane Rollandin <[hidden email]> wrote:
We need to teach that superpowers implies super-responsibility.

You're right, so I have to be able to look this super-horrible stuff in the eye.

(sigh)

Stef




Reply | Threaded
Open this post in threaded view
|

Re: Horribly mutable compiled method litterals

Stéphane Rollandin
> I'm fascinated by the differences in opinion - I don't regard this as
> horrible; I regard it as useful, exciting, and a wonderful consequence
> of everything being an object.

I fail to see how the fact that a compiled method can silently behave
differently than what its source code says can be useful and not just nasty.

Stef

Reply | Threaded
Open this post in threaded view
|

Re: Horribly mutable compiled method litterals

Stéphane Rollandin
In reply to this post by Peter Crowther-2
> a wonderful consequence of everything being an object.

I'm quite in love with Smalltalk, for several reasons. One is everything
being an object, as you point out, but another one is how easy it makes
debugging.

Now just do the following in a workspace:

Editor specialShiftCmdKeys at: 8 put: 30

Then delete the workspace and give the image to a experienced squeaker
of your liking, familiar with Editor and its usages, and ask him to
debug the thing. How long will it take, and how easy will it be ?

(don't forget to ask how wonderful was the experience)


Stef