Invoking the "default" behavior of an interface concept Follow
Perhaps it is a bad design, but I arrange my concepts such that there is an interface concept IDeclarations that contains definitions of fields and methods, much like a Java class. I make it extend ScopeProvider to provide scope for its members.
interface concept IDeclarations extends ScopeProvider
Then there is a concrete concept which implements this concept but is itself a ScopeProvider:
concept InstanceDef extends BaseConcept
Now how could I call the "default" behavior implementation of getScope() of IDeclarations in the body of the getScope() for InstanceDef? I tried this:IDeclarations.getScope() but it resulted in StackOverflowError. The Java 8 way of IDeclarations.super.getScope() also does not work since IDeclarations is not an interface.
Thanks in advance.
Please sign in to leave a comment.
I believe it was super<ScopeProvider>.getScope();
Be aware that super comes up twice in the completion menu, once as super node, and once as super concept. You need the "super node" version.
Thanks. I tried both super<ScopeProvider>.getScope() and super<IDeclarations>.getScope(). The former does not work but the latter works.
By the way, I checked the generated code, and it reveals the differences between parent scope, super<ScopeProvider>.getScope(), and super<IDeclarations>.getScope(). So parent scope is not really the same as super<ScopeProvider>.getScope() as I understood earlier.