From: Martin DeMello Date: 2002-11-28T02:48:35+09:00 Subject: Re: RCR: Stack, Queue alias methods in Array On Wed, 2002-11-27 at 16:20, Hal E. Fulton wrote: >> I wonder: Would there be any value in Stack and >> Queue classes that inherited from Array? Nat Pryce wrote: > If anything, Stack and Queue classes should encapsulate an array. > > Even better, there should be different Stack and Queue classes that have > the same API and are implemented using different data structures: > arrays, linked lists, heaps, etc. etc. And matz wrote > I think Array is too big, and has too much methods unnecessary to > Stack and Queue. The following quote from Paul Graham made quite an impression on me - I wonder what other people think about it: In Common Lisp I have often wanted to iterate through the fields of a struct-- to comb out references to a deleted object, for example, or find fields that are uninitialized. I know the structs are just vectors underneath. And yet I can't write a general purpose function that I can call on any struct. I can only access the fields by name, because that's what a struct is supposed to mean. A hacker may only want to subvert the intended model of things once or twice in a big program. But what a difference it makes to be able to. - Paul Graham, from 'Being Popular' http://www.paulgraham.com/popular.html martin