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
27 Apr 2024 00:46:46 EDT (-0400)
  Re: Parse Error: No matching } in 'union', object identifier found instead  
From: clipka
Date: 21 Jan 2019 03:52:04
Message: <5c458834$1@news.povray.org>
Am 21.01.2019 um 01:00 schrieb kendfrey:
> I'm getting this error when trying to create a union of predefined objects.
> 
> --------------------------------------------------
> #declare Foo = sphere { <0, 0, 0>, 0.1 };
> #declare Bar = sphere { <1, 0, 0>, 0.1 };
> union
> {
>      Foo
>      Bar // Parse Error: No matching } in 'union', object identifier found
> instead
> }
> --------------------------------------------------
> 
> This seems like it should be fine. It parses successfully if I put each
> identifier inside object { }. Why isn't this allowed?

It's just how POV-Ray's language rolls: Pretty much wherever you use a 
non-trivial variable (i.e. not a number, vector, colour or string), you 
need to wrap that variable into a statement telling POV-Ray what to 
expect in that variable.

For example, consider the following code:

     union {
         Foo
         Bar
         Fnord
     }

If such code were allowed, you would have to take a closer look at the 
variable `Fnord` to tell whether it is supposed to be another object, or 
rather e.g. a texture, transformation or what-have-you.

As for why it was designed this way, I can only speculate; it might have 
been intended to make scenes easier to read for humans (back in the days 
when good variable names were short and cryptic), or easier to read for 
the parser.

At any rate, this syntax quirk has survived the ages, and nobody has 
ever bothered enough to actively do anything about it.


Post a reply to this message

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