|
|
Am 22.11.2016 um 08:35 schrieb Mike Horvath:
> On 11/19/2016 7:34 PM, clipka wrote:
>> Am 20.11.2016 um 01:10 schrieb Mike Horvath:
>>> On 11/19/2016 2:26 PM, clipka wrote:
>>>> // alternative
>>>> #declare Fnord = dictionary {
>>>> .Foo: 42,
>>>> .Bar: sphere { <0,0,0>, 1 }
>>>> }
>>>
>>> Will the dotted syntax allow people to use strings like ".declare" or
>>> ".texture"? I don't think it should.
>>
>> No -- just like with variable identifiers, keywords are not allowed
>> there.
>
> I still think the dot is superfluous.
Think about it:
#declare Foo = "Dang";
#declare Bar = "What";
#declare Fnord = dictionary {
Foo: 42,
Bar: sphere { <0,0,0>, 1 }
}
Which of the following would that supposedly be equivalent to?
(A)
#declare Fnord = dictionary;
#declare Fnord.Foo = 42;
#declare Fnord.Bar = sphere { <0,0,0>, 1 }
(B)
#declare Fnord = dictionary;
#declare Fnord[Foo] = 42;
#declare Fnord[Bar] = sphere { <0,0,0>, 1 }
aka
#declare Fnord = dictionary;
#declare Fnord.Dang = 42;
#declare Fnord.What = sphere { <0,0,0>, 1 }
I think mandating the dot is a nice way to prevent such ambiguity; plus,
it makes things a tiny bit more consistent: Whatever you'd normally put
after the dictionary identifier, you just pop it into the initializer.
Post a reply to this message
|
|