On Sun, 30 Jan 2011 12:42:11 +0100
Holger Hans Peter Freyther <[email protected]> wrote:

> Hi all,
> 
> OrderedCollection := OrderedCollection new.
> OrderedCollection new.
> 
> triggers a infinite loop because an instance now has the name of a class and
> has hidden the class... Should GST do somethig to protect against this?

really, a loop?

heh ... fun! But it looks like to be more a problem of error handling
than with the shadowing of the class.

st> OrderedCollection := OrderedCollection new
OrderedCollection ()
st> OrderedCollection new
Object: OrderedCollection new: 16 "<0x7f844fd6c140>" error: did not understand 
#new
MessageNotUnderstood(Exception)>>signal (Object: OrderedCollection new: 16 
"<0x7f844fd6c140>" error: did not understand #new
MessageNotUnderstood(Exception)>>signal (Object: OrderedCollection new: 16 
"<0x7f844fd6c140>" error: did not understand #new
MessageNotUnderstood(Exception)>>signal (Object: OrderedCollection new: 16 
"<0x7f844fd6c140>" error: did not understand #new


stefan@g128 ~ % gst
GNU Smalltalk ready

st> [ OrderedCollection := OrderedCollection new. OrderedCollection new. 
OrderedCollection inspect ] on: MessageNotUnderstood do: [ :ex | 'neener' 
printNl ]
'neener'
'neener'
st> OrderedCollection inspect
An instance of OrderedCollection
  firstIndex: 8
  lastIndex: 7
  contents: [
  ]
OrderedCollection ()


So I vote "no". Protection prevents Learning :-)

s.

_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to