-
Notifications
You must be signed in to change notification settings - Fork 3
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
Declarations #46
Comments
Actually… instead of
perhaps it would make more sense to have
possibly with Justification: while semantically, an attribute definition also declares the attribute, syntactically they’re different because a declaration without definition must be terminated by a semicolon. EDIT: And this of course also applies to functions. |
Actually, the “syntactically different ‘cause semicolon-terminated” argument means of course that there should be different classes for attributes with blocks and with specifiers ;) In fact, we could say that a declaration and a definition with specifier could have the same class, since they’re both semicolon-terminated – i. e., I would prefer three different classes for declaration, definition with specifier, and definition with block. But perhaps we don’t necessarily need a superclass for the two declaration classes. Something like this?
We’d then need something different for functions, because a function with a block is of course not a getter :)
|
Should an |
No subtypes yet… there’s kind of a circular dependency between Declaration and Body. I’ll properly add Body next, and then some proper declaration types. CC #46.
Yeah, perhaps |
Ah, I forgot about one thing: shared Value sum<Value>(values)
given Value satisfies Summable<Value> {
Value+ values;
…
} This one’s a bit weird. |
It is an ordinary value declaration, according to the spec. |
By the way, you should be calling values and functions |
Alright… with |
(Represented by AttributeDeclaration in the RedHat AST) CC #46.
RedHat’s AnyMethod, MethodDeclaration For #46.
Perhaps it should be called |
What do we do about dynamic interfaces?
Leaning towards 3, I think. A bit more inheritance-heavy, but AST creators don’t have to worry about any abstract classes, and AST consumers can choose if they care about the distinction or not. |
Actually, wrt dynamic interfaces I’m leaning more towards 2 now, I think. But still open for feedback! Meanwhile, I’m wondering if the alias type should perhaps be suffixed |
Oh shit, we already have |
OTOH, perhaps |
Well, even with the |
- Alias → ImportAlias - TypeAlias → ImportTypeAlias - FunctionValueAlias → ImportFunctionValueAlias in order to avoid - confusion - a name conflict with alias declarations See also #46.
(For the interface design, see the dedicated issue #57.) |
With type aliases having been added in 43b1e59, we’re now done with this issue! |
My current plan for the
Declaration
type hierarchy (pseudo syntax):Declaration(Identifier, Annotations)
TypeDeclaration(UIdentifier, TypeParameters?, TypeConstraint[])
ClassOrInterface(CaseTypes?, SatisfiedTypes?)
AnyClass(Parameters, ExtendedType?)
ClassDefinition(ClassBody)
ClassAlias(ClassSpecifier)
AnyInterface
InterfaceDefinition(InterfaceBody)
InterfaceAlias(TypeSpecifier)
TypeAlias(TypeSpecifier)
TypedDeclaration(LIdentifier, Type, AnySpecifier|Block? definition)
AnyValue
ValueDeclaration { actual Null definition = null; }
ValueDefinition(AnySpecifier definition)
ValueGetterDefinition(Block definition)
AnyFunction(TypeParameters, [Parameters+], TypeConstraint[])
FunctionDeclaration { actual Null definition = null; }
FunctionDefinition(Block definition)
FunctionShortcutDefinition(LazySpecifier definition)
ValueSetterDefinition(Block|LazySpecifier definition)
– but see Should we have several classes for value setter definitions? #55ObjectDefinition(ClassBody, ExtendedType?, SatisfiedTypes?)
Variable
? That’s the compiler node for thee
infor (e in thingy)
andif (exists e = foo)
. Not at all sure about that.TypeParameterDeclaration
– I don’t see why this is a subclass ofDeclaration
in the compiler, clearly it can’t be an element of a body / block.Auxiliary:
Body(<Declaration|Statement>[] content)
Block
InterfaceBody(Declaration[] content)
ClassBody
(I’ll be editing this comment as the plan for the class hierarchy changes; you can track these changes in this gist, if you’re interested.)
The text was updated successfully, but these errors were encountered: