POV-Ray : Newsgroups : povray.beta-test : I have a hunch some of you may like this... : Re: I have a hunch some of you may like this... Server Time
29 Apr 2024 19:42:40 EDT (-0400)
  Re: I have a hunch some of you may like this...  
From: Mike Horvath
Date: 17 Sep 2016 23:45:31
Message: <57de0ddb@news.povray.org>
On 9/17/2016 11:09 PM, clipka wrote:
> Am 18.09.2016 um 04:14 schrieb Mike Horvath:
>> On 9/17/2016 4:41 PM, clipka wrote:
>>> But I /will/ say more:
>>>
>>>       #declare MyFrobnitz = dictionary {
>>>         .Foo = 42,
>>>       };
>>>       #declare Key = "Bar";
>>>       #declare MyFrobnitz[Key] = "FTW!";
>>>
>>
>> I don't like the dot before the identifier.
>
> On a scale from 0 to 10, how much do you not like it?
>
> Also, what alternative would you suggest for the following syntax, and
> how would you avoid conflicts between the two initializer syntax variants?
>
>      #declare MyFrobnitz = dictionary {
>        "Foo" = 42,
>        "Bar" = "FTW!"
>      }
>
> Bear in mind that it should be possible to replace the string literals
> with arbitrary string expressions, including simple string identifiers.
>
> Also bear in mind that the following syntax variants for individual
> element access are to be considered (almost) a given:
>
>      #declare MyFrobnitz.Foo = 42;
>      #declare MyFrobnitz["Foo"] = 42;
>

I don't understand what you're saying. But Lua (sort of) does it like this:

method 1

     #declare MyFrobnitz = dictionary {
       Foo = 42,
       Bar = "FTW!"
     }

method 2

     #declare MyFrobnitz = dictionary {
       ["Foo"] = 42,
       ["Bar"] = "FTW!"
     }

method 3

     #declare Key1 = "Foo";
     #declare Key2 = "Bar";
     #declare MyFrobnitz = dictionary {
       [Key1] = 42,
       [Key2] = "FTW!"
     }


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.