[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] basic syntax questions

From: LordGeoffrey
Subject: [Help-smalltalk] basic syntax questions
Date: Sat, 14 Nov 2009 12:24:09 +1000
User-agent: Thunderbird (X11/20090817)

I am trying to get started with gnu-smalltalk, and i have a couple trivial questions. I can't find a sample st script that uses the [ ] delimiters rather than the fileOut ! version.

The following code works. But if i move the definition of new into the definition Account init is not called. Don't know why.
Also i do a snapshot at the end, is that the right approach?

The code>>
Object subclass: Account [
   | balance |
   hi [
       'hi i am ok' printNl
Account class extend [
   new [
       | r |
       <category: 'instance creation'>
       r := super new.
       r init.
Account extend [
   init [
       <category: 'initialization'>
       balance := 0.
       'is initialized' printNl
   setBalance: newBalance [
       balance := newBalance
   getBalance [
ObjectMemory snapshot: ''

reply via email to

[Prev in Thread] Current Thread [Next in Thread]