Should GST protect from stupidity?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Should GST protect from stupidity?

Holger Freyther
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?

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Should GST protect from stupidity?

Stefan Schmiedl
On Sun, 30 Jan 2011 12:42:11 +0100
Holger Hans Peter Freyther <[hidden email]> 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
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk