Open dslmeinte opened 2 years ago
Regarding the first point: you are right. Actually, both interfaces are redundant, and I have removed them
For point 2, I thought that Typedef should not extend PrimitiveType but refers to it: a Typedef would be a Datatype created by providing an alias to a PrimitiveType (they are built-in) and optionally constraining it. It would not be per se a PrimitiveType.
For the cardinalities, I always get confused. What I wanted to state is that each Typedef refers to exactly one PrimitiveType, but each PrimitiveType can be referred by multiple Typedef (or none). To express that, should I invert the cardinalities? If you can confirm that I will invert them (or you can send a PR or do the change directly, as you prefer). Regarding the extension vs reference, perhaps we should clarify that at the next discussion. What do you think?
Cardinalities also apply to point 3. You are right that we should allow the case in which a Containment or a Reference do not specialize anything. Again I may have inverted the cardinalities. Can you confirm this is the case? If so, should I do the change or do you prefer to write a PR or just change the code?
My understanding of <entity1> <card1> -- <card2> <entity2>: <prop>
is as follows:
So, the “from”-cardinality is at the other end of the arrow.
I'll update my code somewhere later today, so I can check your proposals.
I can make a suggestion through a PR, which would be what the TS code generates. As part of that, I'd suggest to sort the declarations in alphabetic order (with objects first, and then relations). That makes things easily diffable, without having to parse PlantUML and perform a tree-based diff. Is that alright with you?
Yes, that sounds great. Thank you!
Also found the following:
NamespacedEntity
can't be a ConceptInterface because it has the non-derived feature simpleName
.FeaturesContainer
with the containment features
. FeaturesContainer
could be folded into AbstractConcept
without problems, I think.See PR #21
I also worked on the TS implementation, including some constraints checking: https://github.com/LIonWeb-org/lioncore-typescript/tree/feature/m3
If we kept the name FeaturesContainer
, the confusion between AbstractConcept
and Concept { abstract: boolean }
would be resolved.
In other words: How about renaming AbstractConcept
to FeaturesContainer
?
@enikao That's a good idea. I'm trying to think of a better name than the slightly unimpressive “container”, though, but for now (=as long as we didn't release this in any “offical” way) we can stick with it.
What about renaming Typedef
to TypeDefinition
? It's the only shortened name so far...
+1 for renaming AbstractConcept in something else, but don't we need a common ancestor to both InterfaceConcept and Concept but not Annotation?
Because an Annotation should not be the target of an Annotation? In general, I prefer to use constraints for that (rather than having an “extra” type), but I'm curious what that alternative would look like.
What about renaming
Typedef
toTypeDefinition
? It's the only shortened name so far...
We should get rid of this inconsistency. I'm not sure about TypeDefinition
: If I hear Typedef
, I have a concrete idea what we're talking about. TypeDefinition
could also be a common supertype of Class
/ Enum
/ Record
(using Java lingo).
In C11 Standard (section 6.7.8) they are called Type definition
, though.
The closest thing in MPS is ConstrainedDataTypeDeclaration
, which IMHO points in the right direction.
At the moment, Typedef
has no semantics yet, so I'm not quite sure which way to go, or even if we already should have it in. We could just remove it for now...
At the moment,
Typedef
has no semantics yet
I think we had a good purpose for them: The compromise between "we're specifying a protocol, so we need to serialize everything" and "I want to express things like Date
or Point
in a sensible way that also fits each platform". So a typedef
solves the serialization part by referring to one of the primitive types, the express part by being a first-class citizen, and the platform-specific part by annotations like
@Implementation(Java, "java.util.Date")
@Implementation(Typescript, "http://no.idea/how:this.works.in.ts")
typedef Date: JSON
Let's put that in the GDoc. Phrased like this SerializationHint
is more to the point as a name, though.
I think the original comments from @dslmeinte have been addressed by his PR. Later we discussed about typedefs. Did we reach a conclusion about that? Is there any other topic left open in this issue?
Yes: my original comments are addressed.
As for the Typedef
-discussion: the M3 GDoc mentions “TODO: add an entry for Typedef”, so I guess that still stands ;)
I will rename the issue, so that it will be easier to notice what topic is left to discuss
implements FeatureContainer
is not necessary becauseAnnotation
extendsAbstractConcept
which does the same.PrimitiveType "1" o-- "*" Typedef: constraints
?Reference "1" -- "*" Reference: specializes
andContainment "1" -- "*" Containment: specializes
: shouldn't these be"*" -- "0..1"
? AReference
/Containment
can optionally specialize one other, but the target could be specialized by any number.