Re: [q-lang-users] Types and multiple inheritance
Brought to you by:
agraef
From: Albert G. <Dr....@t-...> - 2005-06-27 21:42:47
|
Hi, John, John.Cowan wrote: > As I understand it, variable references with a type guard T match only > expressions whose operators are declared in the type declaration for T > or inherited from T's supertype, if any. s/operators/constructors/ Nope, it's just the other way round. A variable of type T matches the constructor patterns of T itself, as well as those of all its _subtypes_. So that effectively makes the supertype the union of all of its subtypes. Conversely, with multiple inheritance you'd have that a certain constructor pattern would match different supertypes (i.e., the common subtype belongs to the intersection of its supertypes). That does make perfect sense. (It won't buy you much, though, unless you design all involved datatypes as ADTs, but I take this for granted when you're programming the OOP way.) At least the pattern matching automaton generator algorithm in the bytecode compiler and the runtime symbol table would have to be changed to accommodate for this. That should be doable, but, as it won't be a walk in the park to implement this in an efficient manner, please understand that it's not very high on my priority list, until someone comes up with a good usage scenario. ;-) Cheers, Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikwissenschaft.uni-mainz.de/~ag |