|
Re: I am a total beginner with some questions: msg#00079lang.smalltalk.squeak.beginners
Michael Haupt wrote: Hi, A little bit more explanations: Why this nil? If you take a look further at a formal description of Smalltalk syntax, you will see that this sentence: gdkDKeyDown. can only be interpreted as a variable, and in this case an undeclared variable (from the workspace, only global variables from the Smalltalk SystemDictionary are visible, also as variables attached to the workspace as explained below). When you evaluate ("doIt") from a workspace, then such undeclared variables are automatically declared as workspace variables. And since no value has ever been assigned to this workspace variable, it is initialized with an instance of UndefinedObject, that is nil (the sole instance of UndefinedObject in fact). When you think of it, the meaning is simply undefined, something like the NULL pointer in other languages... except that in Smalltalk this is just an object among other objects. Yes as if you could operate on the NULL pointer without crashing the application with a segmentation fault. Isn't it a nice property? You now need to find to which object you should send the gdkDKeyDown message... Please look at "Squeak by Example"; I really feel you need to do that I strongly second Michael advice. Cheers Nicolas
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: I am a total beginner with some questions, Michael Haupt |
|---|---|
| Next by Date: | Magma and Tweak, Dr Keith A. Morneau |
| Previous by Thread: | Re: I am a total beginner with some questions, Michael Haupt |
| Next by Thread: | Re: I am a total beginner with some questions, kennellgr |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |