-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Name clashes during inheritance #97
Comments
Note: This can lead to different semantics than e.g. Java. Consider the following Java interfaces: interface A {
String getF();
}
interface B {
String getF();
}
class X implements A, B {
public String getF() {
return "hello";
}
} Java merges This doesn't work any more if they return different types: interface A {
String getF();
}
interface B {
Integer getF();
}
class X implements A, B {
// compiler error: 'getF()' in 'X' clashes with 'getF()' in 'B'
public String getF() {
return "hello";
}
} (This is the disallow case.) That's why we treat this differently in LIonWeb:
|
Maybe a bit late, but the decision to treat the two f's in the first example as two properties is very different to the way this is done in most (at least Java and TS/JS) languages and e.g MPS (and probably EMF) and therefore users/developers will be confused by this. In e.g. TS (which I mainly use these days) it is quite common to implement multiple interfaces with the properties with the same name. I I don't understand/remember why we decided to use this non-standard way of dealing with this. |
This is documented in the comment above.
All the variants are discussed at https://github.com/LIonWeb-org/organization/blob/main/lioncore/conceptinterface.adoc#33-name-clashes In short: Existing languages have the same issue, as soon as the two With this decision, we let the mapping to each language decide what's most suitable for that language. |
I see the discussion, but I do not see a decision in https://github.com/LIonWeb-org/organization/blob/main/lioncore/conceptinterface.adoc#33-name-clashes. If we take the decision above it becomes very hard to generate code for the meta-model. You can solve this in several ways:
Therefore from the perspective that we want to be able to generate a typed language API (Java, TS, ...) we should consider solution https://github.com/LIonWeb-org/organization/blob/main/lioncore/conceptinterface.adoc#331-merge-compatible-names or https://github.com/LIonWeb-org/organization/blob/main/lioncore/conceptinterface.adoc#334-disallow-conflicts Maybe there are better solutions than the two I described, but I don't see them yet. |
@joswarmer Can we close this? |
Should close this |
Name-clash problem as described in section 3.3
Example: concept
X
inherits from conceptsA
andB
who both define a feature namedf
Decisions:
A.f
andB.f
as distinctf
's inX
(semantically they are different)f
, because the name (not the feature) is ambiguous (relevant for situations where we accessf
by name and not by key; ie., generated code)X
; close to 3.3.2. Rename conflicting names)The text was updated successfully, but these errors were encountered: