POV-Ray : Newsgroups : povray.general : Parse Error: No matching } in 'union', object identifier found instead : Re: Parse Error: No matching } in 'union', object identifier found instead Server Time
26 Apr 2024 17:30:49 EDT (-0400)
  Re: Parse Error: No matching } in 'union', object identifier found instead  
From: clipka
Date: 21 Jan 2019 10:59:50
Message: <5c45ec76$1@news.povray.org>
Am 21.01.2019 um 14:08 schrieb Kenneth:
> "kendfrey" <nomail@nomail> wrote:
>> I'm getting this error when trying to create a union of predefined objects.
> 
> A simpler form of this quirk actually does work:
> #declare Foo = sphere { <0, 0, 0>, 0.1 };
> 
> Foo // no object wrapper needed
> 
> But I don't know if this trick works if there is any intervening code between
> the #declare and Foo. Give it a try ;-)

Don't get used to it.

This works at the scene level, but not inside unions or the like. 
Instead, when you use

     #declare Foo = sphere { ... }
     union { Foo }

this only works because it happens to be interpreted as

     #declare Foo = sphere { ... }
     object { Foo }

Also, this only works with a limited number of object keywords, and only 
as an unintended side effect. The originally intended syntax seems to 
have been:

     #declare Foo = sphere { ... }
     sphere { Foo }

     #declare Bar = box { ... }
     box { Bar }

     #declare Fnord = union { ... }
     union { Fnord }

This may have been the oldest form of the syntax, and `object` may have 
been introduced later as an afterthought, to serve as a common alias for 
`sphere`, `box`, etc. in such contexts.

This is just speculation though, and I'm not sure if even David K. Buck 
remembers how this syntax feature evolved. In DKBTrace 2.01 (1990), it 
had already taken pretty much the shape we see today.


Post a reply to this message

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