[Newbies] Best place to ask Smalltalk questions?

Sean Allen sean at monkeysnatchbanana.com
Sat Aug 2 14:43:11 UTC 2008

On Aug 2, 2008, at 12:44 AM, Matthew Fulmer wrote:

> On Sat, Aug 02, 2008 at 12:08:51AM -0400, Sean Allen wrote:
>> you have an instance variable you only want to allow to set once,
>> never again ( in that fashion its like variable binding in erlang. )
>> what is the accepted smalltalk way to do this? is there one?
> ivar: aValue
>    ivar ifNotNil: [self error: 'variable already set'].
>    ^ ivar := aValue

so what i was doing is the correct way to do it.
>> how are the equivalent of c++ virtual methods handled in smalltalk?
>> what is the standard idiom for that design pattern?
> All methods in Smalltalk are virtual, i.e., looked up when
> called.

let me clarify that question.

if I have class foo that is meant to only be descended from,
never instantiated directly. and it has method bar that needs
to made concrete by its descendents, what is the standard idiom for

is there a specific error that should be thrown or just:

   self error: 'any old error here'

is there a particular error that is common practice to use?

More information about the Beginners mailing list