|
|
Am 17.09.2016 um 20:18 schrieb Mike Horvath:
>> Future plans:
>>
>> - Support for an array-like syntax, e.g. `MyFrobnitz["Foo"]` (originally
>> intended to be the primary syntax, with the dot notation planned as a
>> later syntactic sugar extension, but the parser's internals got in my
>> way, so I decided to go for the easier part first)
>>
>> - Support for initializers (if you have any suggestions for the syntax
>> to be used, please let me know)
>>
>
> Will there be a shorthand syntax too? Like:
>
> MyFrobnitz =
> {
> Foo = 42,
> Bar = "FTW!"
> }
See the "Support for initializers" future plan.
Currently, I intend to implement the following syntax:
#declare MyFrobnitz = dictionary {
.Foo = 42,
.Bar = "FTW!"
}
I've come to the conclusion that the leading dots should be mandatory
(at least for now), to avoid potential ambiguities in case a
string-based initialization is also implemented, which /may/ ultimately
be specified to allow the following:
#declare MyFrobnitz = dictionary {
"Foo" = 42,
"Bar" = "FTW!"
}
Since this would probably not be limited to string literals, but would
allow for arbitary string expressions, this would also allow for:
#declare FooKey = "Foo";
#declare BarKey = "Bar";
#declare MyFrobnitz = dictionary {
FooKey = 42,
BarKey = "FTW!"
}
That would obviously be ambiguous if the identifier-based initializer
syntax wouldn't use leading dots.
Post a reply to this message
|
|