[Newbies] smalltalk and squeak
lists at dcorking.com
Fri Nov 18 12:21:10 UTC 2011
James you have accidentally stumbled on two different aspects of
Squeak. The first, your counter example, relates to the Smalltalk
workspace. The second relates to Morphic script tiles, which we now
call Etoys script tiles.
James O'Brien wrote:
> For example, I can
> code a counter with smalltalk in the workspace. When I do it a functioning
> counter appears. When I close the workspace the calculator still works, but
> what happens to the code? Where is it?
I think the misunderstanding that you made is that you created the
counter object in the workspace. A workspace is for creating an object
where you don't want to keep its source code: for example if you want
to examine a variable, or manipulate an instance for testing.
When you want to write Smalltalk, you _must_ write it in the Class
Browser, not in a workspace. At risk of causing offence by mentioning
the J-word, in this sense Smalltalk is more like Java than it is like
Hypercard. However, once you have made a live object, jump into its
code in the system browser and edit its methods as you please - they
The first chapter of Squeak by Example talks you through making and
debugging simple class in the class browser.
If the difference between a class and an object still doesn't make
sense, please ask again and we will have another attempt.
> I can also build a calculator with squeak as described at
> http://wiki.squeak.org/squeak/1827. But, again, where is the smalltalk code?
> I guess I'm thinking in terms of HyperCard. With HyperCard I could script a
> button, field, card, stack, etc. With Squeak, I can't figure out to change
> what the calculator’s buttons do. If had created the calculator with
> HyperCard, I could easily change how its buttons work. Just open them and
> there's the script.
The scripting language you used is now called Etoys. It is more like
Hypercard, in that there are no classes: you just edit the methods of
However there is Smalltalk code hiding behind it.
The easiest way for a novice to find it is probably this:
(1) Show the halo of your object
(2) Click the blue eye handle to bring up a viewer.
(3) If you made a tile script, there will be one or more script tiles
at the top of the viewer. Drag one onto the desktop. This makes a
(4) Click the menu button in the top right of the script editor.
(5) Select 'show code textually'. You should see a line or two of Smalltalk.
I hope that helps. There is a lot more to discover as you get deeper into it.
More information about the Beginners