From: Oren Ben-K. <or...@ri...> - 2001-06-05 13:21:19
|
Clark C . Evans [mailto:cc...@cl...] wrote: > | > That's why I don't like Clark's idea of a list having a > | > default value of the first element; it forces one to always > | > pay this price, when for most lists it isn't required. I also > | > don't think it is useful to evolve a scalar into a list; > | > that's not part of the "color" idiom, anyway. > > I think it may be useful for times when something originally > thought to be single value (such as an address) turns out > to be multi-valued. If you only allow "extensions" using > the map construct, this forces a particular way to extend > the scalar (use a map, and then a list) instead of just > converting the scalar into a list. I've had this case > pop up before... An example would be nice... > | > Clark? > > Well, if it seems problematic... I'll compromise here. ;) So can we say its settled, subject to Brian confirming it is implementable? Brian? > | Also, it doesn't seem to make sense that a !Foo could morph > | into a !Bar does it. Maybe if !Bar were a subclass...??? Do > | we support subclasses? > > Hmm. Suppose you were expecting... > > tag: > a: "hello" > > and someone gave you, > > tag: > a: "hello" > b: "world" > > Then the second case is substutable for tag. Hmm. > How can this be codified? Well, as long as you only add data members you are basically OK. I wouldn't worry too much about it: - If both classes aren't recognized, then as long as you just add members you are OK; - If both classes are recognized, then the language itself provides you with compatibility. Presumably, the implementation of 'Foo' and 'Bar' will be compatible if they are supposed to be. In C++, 'Bar' will derive from 'Foo' and all will be well; in Perl, 'Bar' just has to provide all of 'Foo's methods and members, etc. So far, so good. The problems are: - If 'Foo' is recognized and 'Bar' isn't, a twisted and heavyweight mechanism may be able to help you somewhat; - If 'Bar' is recognized and 'Foo' isn't, no force in the world can help you. I say the 80/20 solution here is just ignore these last two cases. Have fun, Oren Ben-Kiki |