Segmentation faults and friends.

Bryce Kampjes bryce at kampjes.demon.co.uk
Tue Mar 28 21:22:38 UTC 2006


Michael van der Gulik writes:

 > Another way is the following, done in the workspace:
 > 
 > b := BlobMorph class.
 > m := Metaclass new.
 > m superclass: (b superclass) methodDictionary: (b methodDictionary) 
 > format: 2.
 > t := m new.
 > t class printIt.
 > 
 > In this case, format is invalid. It should be 152. Here, I was just 
 > being stupid.
 > 
 > So the question, again, is: should the VM *never* crash and protect 
 > against very curious, stupid programmers like myself, or should it work 
 > fine until the programmer becomes curious and stupid?

In this case I'd say it's OK for the VM to crash. It might
be better for #superclass:methodDictionary:format: to validate
the format argument.

Ideally, we want the system to be robust but we also want it
to be flexible, live changeable, and fast. There are many things
that the VM doesn't check which can easily cause crashes but
are normally checked elsewhere. The size of the stack when pushing
arguments is an example. The stack size is checked by by the
byte code compiler.

Try editing the collection hierarchy. It's easy to break the system
without needing to involve the VM. The system robust in normal use.
It is also easy to change. It shouldn't crash when people are doing
normal programming but if you want to experiment in the guts of it it
also shouldn't stop you.

Crashes are a learning experience.
Bryce



More information about the Squeak-dev mailing list