View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Sp2002 Midterm Review: Explaining the Booms

Back to Spring 2002 Midterm Review

Comments/questions/answers?

1. Smalltalk seems to be a SystemDictionnary. "I represent a special dictionary that supports protocol for asking questions about the structure of the system. Other than class names, I contain (print this)..."

So setting it to nil wouldn't crash anything that was already created, but the classes would no longer exist, so I guess you couldn't create anything else from that point on.

Hank Wilde

1. This should freeze the squeak enviroment. This is because the enviroment is managed by the smalltalk instance, I would guess, and therefore by setting it to nil, the current working instance gets garbage collected. Maybe?

2. Most instances wouldn't work sice '+' is a common operator. By changing it, a lot a of instances would send get an error due to the fact that SmallInteger wouldn't know how to handle the '+' for any code written before you updated the '+' operator.

3. This one I'm not sure of. At first I thought that maybe you would get a message not understood error for the message new. But I don't think that is right. Depending on nil, I would think that the new message will just create a new instance of nil. This will probably cause the box class to crash if we type joe but the actual creation of joe should just be the equivalent of joe:=nil.

Randy Rockinson
#1 - Nope (try it). #2 - Nope, should continue running. #3 - Nope. (Hint: VM Crash, but why?) Mark Guzdial


Hmm, I tried #1 and it did, in fact, freeze squeak. I did get a warning that I was not allowed to modify a read-only binding, but that is easily circumvented by removing the check in ReadOnlyVariableBinding's value: message.

D. Hilley
But WHY? What is Smalltalk and what is it used for? Mark Guzdial

Well, simply inspecting Smalltalk reveals that it is SystemDictionary containing the symbols representing all of the class names in the system. So setting it to nil is probably a bad idea. As for why it freezes, I am not really sure. Setting Processor to nil creates a different kind of crash and, while inspecting Smalltalk, removing #SystemDictionary or #Smalltalk from Smalltalk's collection does not crash the system, so my guess would be that it has something to do with infinite recursion.

D. Hilley
Nice exploration, David. Yes, that's it: Smalltalk is the global Dictionary used to look up all globals! Squeak can keep running if it's nil, but the UI will go away (can't find Sensor or Display anymore) and you can't define anything new (can't find any classes). On Randy's 2 and 3 above: For 2, what's the difference between a method and a primitive? For 3, when is the superclass link needed? Mark Guzdial


2. I might be way off, but is '+' a compiler short cut that is built in to speed up things (SmallInteger doesn't have to look up '+' method)?

Wes

Is number 3 similar to number 1 in that setting the super class to nil makes it impossible to record variables. So Box would not be able to keep its size or any information about itself, making it pretty useless.
#19


1. Smalltalk is the actual class. So if that is deleted the instance of Smalltalk that you're running currently should still run. Unless that is, the instance calls upon the class to do various things either directly or indirectly. It probalby does and since the code for Smalltalk is no longer there, you get a freeze. Right?

2. The way I see it things should continue to run smoothly. Nobody else cares how SmallInteger implements '+' right? They just use it. As long as it does what it's supposed to it shouldn't be a problem. That's beauty of abstraction.

3. Box's superclass is Object. But I don't think Object implements new directly. This would still be a problem though. If a method is not found in a subclass, I think the call goes up the heirarchy sequentially looking for the implementation of the method. So when box says go look for 'new' in Object and it's not there... Actually Object now points to nil. I don't think nil understands the message new so maybe you'd just get a messageNotUnderstood error.

Marco Rogers

Later that night...

"Workspace code"
nil new. "DoIt"

"Ha! Simply a messageNotUnderStood error"


Link to this Page