POV-Ray : Newsgroups : povray.beta-test : Syntax extension: Passing multiple values out of a macro : Re: Syntax extension: Passing multiple values out of a macro Server Time
10 May 2024 00:09:35 EDT (-0400)
  Re: Syntax extension: Passing multiple values out of a macro  
From: clipka
Date: 18 Jan 2016 00:01:14
Message: <569c719a$1@news.povray.org>
Am 18.01.2016 um 01:16 schrieb Mike Horvath:
> On 2/28/2015 8:51 PM, clipka wrote:
>> I've just implemented a syntax extension that you might like: As of the
>> newest development version, you'll now be able to assign multiple
>> variables with a single #declare (or #local) statement, like so:
>>
>>    #declare (A,B,C) = (X,Y,Z);
...
> 
> I don't think you should use parentheses. A comma between each parameter
> should suffice.
> 
> For instance in Lua you can do
> 
> a, b = 10, 2*x

Thanks for bringing this up in such a timely fashion ;)

> Parentheses makes it look like a macro, which is confusing.

I don't think it looks like a macro, and I don't think it is confusing.

Furthermore, I think this makes it more consistent with the later
additions of using it for array and vector assignments, which use
delimiters as well:

    #declare (A,B,C) = (X,Y,Z);
    #declare <A,B,C> = MyVector;
    #declare {A,B,C} = MyArray;

Also, if you want to influence POV-Ray's syntax towards more beauty,
you're more than just 3/4 of a year late -- about two decades or so I'd
guess.

As a matter of fact, I for one actually /prefer/ the parenthesized
version, because it makes it much easier to see at a glance that there's
something more going on than just ordinary single assignment.


And, last not least, as a less aesthetical and more practical reason to
keep it this way: The above is how I implemented it; it appears to works
fine; it doesn't look /too/ bad (to me at least, and apparently to all
others who have read the post in the last 9 months); and changing it
will cost me another round tuit or two (especially since I've piled a
bit more syntactic sugar on top of it by now, which btw also appears to
work fine and isn't too shabby), which I'm short of these days anyway.
So even if I were inclined to agree, it would rank way, way low on my
list of pending changes.

I rest my case.


Post a reply to this message

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