help-smalltalk
[Top][All Lists]
Advanced

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

Re: [Help-smalltalk] Should GST protect from stupidity?


From: Stefan Schmiedl
Subject: Re: [Help-smalltalk] Should GST protect from stupidity?
Date: Sun, 30 Jan 2011 17:39:51 +0100

On Sun, 30 Jan 2011 12:42:11 +0100
Holger Hans Peter Freyther <address@hidden> 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


address@hidden ~ % 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.



reply via email to

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