a convert to Seaside

Christopher Browne cbbrowne-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Mon Feb 19 19:50:35 UTC 2007


On 2/19/07, William Park <opengeometry-FFYn/CNdgSA at public.gmane.org> wrote:
> Can someone give short tutorial on Smalltalk syntax?  No GUI please!

That's fairly much futile; integrating new classes and object
instances into a Smalltalk image tends to be inextricably tied to the
GUI.

- You select a parent class;
- Create a subclass of that parent class;
- Indicate any variables/dictionaries intrinsic to the subclass
- Add methods to the new class

The syntax is extremely thin; the following shows a method
illustrating every part of Smalltalk method syntax except for
primitives...

http://www.esug.org/whyusesmalltalktoteachoop/smalltalksyntaxonapostcard/

exampleWithNumber: x
"A method that illustrates every part of Smalltalk method syntax
except primitives. It has unary, binary, and keyword messages,
declares arguments and temporaries, accesses a global variable
(but not and instance variable), uses literals (array, character,
symbol, string, integer, float), uses the pseudo variables
true false, nil, self, and super, and has sequence, assignment,
return and cascade. It has both zero argument and one argument blocks."

|y|
true & false not & (nil isNil) ifFalse: [self halt].
y := self size + super size.
#($a #a "a" 1 1.0)
do: [:each | Transcript show: (each class name);
show: ' '].
^ x < y

Wikipedia also has some reasonable examples...
http://en.wikipedia.org/wiki/Smalltalk
-- 
http://linuxfinances.info/info/linuxdistributions.html
"...  memory leaks  are  quite acceptable  in  many applications  ..."
(Bjarne Stroustrup, The Design and Evolution of C++, page 220)
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list