Open ronaldtse opened 4 years ago
I think we should stick with object association declaration, so the first version looks better, but because we already have short hand notation for fields I think we should introduce keyword for values, something like this:
instance :Expression {
value symbol="+"
operand op1
operand op2
}
instance op1:LiteralInteger {
value value = 1
}
instance op2:LiteralInteger {
value value = 1
}
value value = 1
looks kind of clumsy here I guess but it will be easier to implement and I guess we don't always have value = 1
as values.
@w00lf in this case do we want to accept both "explicit" vs "implicit" syntax?
i.e. these two blocks are equivalent:
instance :Expression {
myvalue=1
}
// is same as
instance :Expression {
value myvalue=1
}
We can distinguish the case of value
because value = 1
is of the pattern {attribute name} {equal sign} {attribute value}
.
@w00lf in this case do we want to accept both "explicit" vs "implicit" syntax?
i.e. these two blocks are equivalent:
instance :Expression { myvalue=1 } // is same as instance :Expression { value myvalue=1 }
We can distinguish the case of
value
becausevalue = 1
is of the pattern{attribute name} {equal sign} {attribute value}
.
in that case, we can just use the implicit syntax as you described above.
in that case, we can just use the implicit syntax as you described above.
OK, so we now have established the syntax pattern of an attribute with value:
class {Class name, if any} {as ref name, optional} {
{attribute name} = {attribute value}
{attribute name}:{attribute class} = {attribute value}
}
instance :{Class name, if any} {as ref name, optional} {
{attribute name} = {attribute value}
{attribute name}:{attribute class} = {attribute value}
}
Value specification
Value specification-semantics
Proposal: