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
that?

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

foo
  self error: 'any old error here'

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


_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to