|
|
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
|
|