POV-Ray : Newsgroups : povray.bugreports : Why does sphere { Object } work? : Re: Why does sphere { Object } work? Server Time
18 Apr 2024 11:31:05 EDT (-0400)
  Re: Why does sphere { Object } work?  
From: clipka
Date: 7 Nov 2018 17:33:15
Message: <5be3682b$1@news.povray.org>
Am 06.11.2018 um 23:19 schrieb Cousin Ricky:

> I noticed what seemed to be a syntax error: two spheres in 
> a union, each of which contained a declared object!  Why did it not halt 
> with a parse error?

Because someone somewhen implemented it that way.

I could dig in old code to find out when it was first introduced, but I 
doubt whether that information would be of any added value: Current 
versions support it, we know old versions supported it, and now you 
present evidence that scenes used it. Under these circumstances this 
undocumented feature is here to stay, at least for now.

Maybe I'll add warnings (if I find the time and don't forget about it) 
but that'll be it.

> This renders to completion with all POV versions and #versions from 3.5 
> through 3.8.0-alpha.9893777.  Replacing 'sphere' in either line with 
> other object types also does not cause a parse error; whatever shaped is 
> defined in the #declare is rendered.
> 
> I admit this is a minor issue, as it does not cause a correct scene file 
> to fail.  Still, it does not appear legal according to the syntax diagrams.

The syntax diagrams are a very one-sided thing: They only document what 
you can expect to /work/ - they do /not/ document what you can expect to 
/fail/.

(This is a bit different from, say, C++ where the language specification 
also mandates what a compiler must reject.)


Post a reply to this message

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