Unclear edge cases of type features
Is Type a cotype? Are inner or inherited features of Type type features?
Since all cotypes inherit from Type and their inner features are type features, the features a cotype inherits from Type are type features by definition.
Type has no explicit parent, so it inherits from Any which means it inherits the features from Any, some features it redefines (e.g. as_string) some it doesn't (e.g. prefix $).
Type does also define new features, e.g. name.
It is possible to call Type.type.as_string and $Type.type but not Type.as_string or $Type. (EDIT: this is actually due to the the visibility module:public of Type.)
Its also possible to call Any.type.as_string.
Any.type.name works but not Any.name, also see #3637.
The method isTypeFeature() in AbstractFeature.java currently acts like "is cotype" and it returns false for Type.
How to check if a feature is a type feature when a cotype inherits it from Type but it is implemented in Any i.e. its outer feature is Any?
And should the above examples work as described?
Type is a normal feature, not a cotype. But Type does have a cotype Type.type.
Inner features of Type are normal features, but once inherited by a cotype, I think we should consider them type features.
It is possible to call
Type.type.as_stringand$Type.typebut notType.as_stringor$Type. Its also possible to callAny.type.as_string.
I guess Type.as_string results in an ambiguous call, right? If so, does the error suggest alternatives that are unambiguous and do they work? If not, please create a bug issue.
Any.type.nameworks but notAny.name, also see #3637.
If Any.type.name works, I think Any.name should work as well unless ambiguous, please create a bug issue if this is not the case.
The method
isTypeFeature()inAbstractFeature.javacurrently acts like "is cotype" and it returns false forType.
That is a general cleanup issue, the Fuzion sources still mix up the term type feature to refer to either type features or cotypes.
How to check if a feature is a type feature when a cotype inherits it from
Typebut it is implemented inAnyi.e. its outer feature isAny? And should the above examples work as described?
Features inherited from Any by a feature fshould appear twice, as inner features of f and as type features of f (i.e., inner features of f's cotype).
Features inherited from
Anyby a featurefshould appear twice, as inner features offand as type features off(i.e., inner features off's cotype).
But how to do the check for an AbstractFeature in the Java code? For prefix $ using af.outer().isTypeFeature() does not work, because for both Any and the cotype of Any the outer feature of is Any (because it is never redefined).
E.g. classify() in Util.java
But how to do the check for an
AbstractFeaturein the Java code?
@fridis what was the solution to this? I remember we talked about it but I forgot what it was.
But how to do the check for an
AbstractFeaturein the Java code?@fridis what was the solution to this? I remember we talked about it but I forgot what it was.
TLDR: Can you repeat what you mean by this.
Features from Any appear as normal and as type features and if they are never redefined, their outer feature is Any in both cases. How to differentiate those features and check if such a feature is a type feature?
Closing this because points have been clarified or moved to separate issues.