|
Re: Error in "Building More Flexible Types with Mixins"
|
Posted: Jan 1, 2006 9:25 PM
|
|
I might be wrong, and I am not sure that I completely understood your article "Building More Flexible Types with Mixins", but here is my two cents...
The problem seems to be in the class IterableConcept, where the type Iterator is required, but this type is different for each concrete implementation. I once thought it could be nice to have a language where types are first-class entities. Then you could have a pointer-to-type, which is just what may be required for Iterator. Making type a first class entity should not be too hard, it should be something like a pointer to type's vtable.
This would be cool, as the following code would work:
main() { int n; type arrayOfTypes[]={Stack_array, Stack_vector, Stack_other};
scanf ("%d",&n); AbstractStack* stack=new arrayOfTypes[n]; ..... }
where 0<=n<3, Stack_array, Stack_vector and Stack_other implement AbstractStack, and keyword type is a type that can hold type :) .
|
|