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

Fall2001 Midterm Review: Explaining the Booms

Link back to Fall 2001 Midterm Review

1. You essentially kill the compiler.
2. I would think this would work just fine. You can change anything in small talk, and if you change + to do the operation of mode I still think the system would work fine
3. I would suspect that this would through an error, when box goes looking for its parent class(from call super new) it would look first for the first link in the heirarchy and doesn't find it. This has to cause some sort of systems error.
Robert Schierholz
1 - how? 2 - I agree it would work, but not "just fine." There will be a significant difference. 3 - close, but more severe. Mark Guzdial

1. Smalltalk is a global variable that is an instance of SystemDictionary. This dictionary holds the symbols for all Classes that are in the System. If you inspect it you can even see the symbols for the classes that you created. This would cause problems whenever you tried to execute anything after that because the envrionment could not longer do look ups.

2. The problem here is that overriding it won't do a thing if the result is a SmallInteger(i.e. Error free). The reason is that SmallInteger + is part of a No Lookup pair. This means that once the interperter recognizes that class pair is SmallInteger + it jumps to a predefined routine in the interperter that can execute this method quickly and effeciently. Even deletign the primitive inside this method will not have an effect on this behavior because the method is not looked up. The method is only looked up if there is an error executing the predefined routine in the VM. So, as long as the addition is error free redefining the method will have no effect.

The only way that I could reason this would occur is if the result was too big to fit into a SmallInteger. I'm guessing that would throw an error and cause the + method to be looked up. In that case it would be pointless to continue trying to add them as SmallIntegers so you should execute Integer's + message(which is what SmallInteger does). So I can't really see a big difference that will be created by changing this method as long as the resulting method works correctly except for a speed one if the predefined interperter routine fails.

(Large parts of this arguement were taking from Object's documentation)

3. Do you mean set Object to nil or to inside Joe the box set super to nil?
Jared Parsons

1. Smalltalk is essential for doing anything in Squeak. Without the instance of Smalltalk, any instance of a class that uses Smalltalk, directly or indirectly, would fail and would want to through an error. But, the error requires Smalltalk, I believe. So you can't get any of the objects to function properly, because they all use Smalltalk in some level of their design (I believe Object might use Smalltalk). The effect is everybody knows nothing.

"Human sacrifice, dogs and cats living together, mass hysteria!"
Dr. Peter Venkman, Ghostbusters (the Script)

3. This one is a little funnier. I was thinking about how the message new would attempt to travel up the inheritance chain and through an error, but the error "Message not Understood" is throw by the object Object (or ProtoObject, I don't know for sure). So, I don't believe that an error handler would come up saying message not understood. But if you tried to inspect this "object" that you now reference, all hell breaks lose. Can you imagine what the inspector does to find this guy. First of all, he's got to be an Object, but he didn't go through the standard "You've been annointed an Object" ritual. So the inspector is going to through an error. I don't even want to know how the heirarchical browser is going to puke on this one.
Christopher Henke

On 2, you're missing something essential about compiling a method to bytecodes and how SmallInteger's + is implemented now. On 3, we're talking about setting the superclass of ANY class to nil. What happens when you send a message to instance of the class? It's actually VM specific what happens, but that it's a VM issue is key here. Mark Guzdial
I just dont' understand how this could affect anything since the method is never looked up anyways Jared Parsons

When you send a message to any class without it's superclass being defined, the message does nothing. All messages result in some sort of interaction with the interpretter or VM. Although you may think that a message can be caught by one object in the heirarchy and that's where is end, your wrong. That message that is caught results in one or more messages directed to other classes. These messages and resulting messages eventually get to the most basic of classes that interact with the VM and interpretter directly. This is evident through the use of primitive. If the messages never result in an interaction with the VM or interpretter, then nothing takes place. You may ask the object to do something, but nothing happens in the interpretter that doesn't go through objects.

The messages at this point can be separated into two classes. One class of messages are those that travel through the superclass. These never result in anything. The other class of messages are those that go through other objects that bypass the superclass of Box. Assuming Box's superclass is not Object, the message can have some impact on the VM and environment as long as it does not depend on any of the Box superclass's methods or attributes.
Christopher Henke


I tried 1 and 3. 1's most obvious effect is that all the windows cease to work, probably because the UI uses the system dictionary for a lot. 3 causes a lot of text to get drawn quickly on the bottom of the screen just before Squeak immediately exits, probably due to an inability to catch the error this would generate.
Brandon Yarbrough
I'm thinking for 2, things would continue to work correctly, but they would happen MUCH more slowly, since it was no longer being handled as a primitive operation?
Brandon Yarbrough

In continuation with my earlier point on 2. I redefined SmallInteger's plus to simply print out into the transcript a message and then call Integer's plus. I recompiled it and executed
5 + 7
There was no apparent affect on the system. No output was ever printed even if I used huge numbers
Jared Parsons



Link to this Page