POV-Ray : Newsgroups : povray.general : #declared Object Usage : Re: #declared Object Usage Server Time
11 Aug 2024 15:12:57 EDT (-0400)
  Re: #declared Object Usage  
From: Ron
Date: 1 Jul 1999 18:22:29
Message: <377bea25@news.povray.org>
Ken wrote in message <377A9568.2DB7F817@pacbell.net>...
>
>
>David Wilkinson wrote:
>>
>> On Wed, 30 Jun 1999 14:43:09 -0700, Ken <tyl### [at] pacbellnet> wrote:
>> >
>> >  When did this become legal syntax and why ?
>> >
>> >#declare B = box {-1,1}
>> > B
>> >
>> >  I have always been under the impression a declared object needed
>> >to be wrapped in an object statment to work properly.
>> >
>> >e.g. object {B}
>>
>> Yes, this surprised me too Ken.  When I first saw the code I thought -
this will
>> never work - but it did! It certainly isn't consistent, but I'm not sure
that
>> it's bad.
>> David
>>
>> ------------
>> dav### [at] cwcomnet
>> http://www.hamiltonite.mcmail.com
>> ------------
>
>There are limits to this insanity. For example this will not work for
>what should be obvious reasons --
>
> #declare B = box {-1,1}
>   B translate y*2
>
>  I'm going to try a few other variations and see what if any other little
>caveats are possible with this new found loophole. If I find anythig else
>worth sharing I will post the results here.
>
>--
>Ken Tyler
>
>mailto://tylereng@pacbell.net

Hmm, I'm not really sure how the POV parser works but I can only imagine.
I'm guessing that by #declare'ing, you're defining a keyword for a whole
bunch of text. Now, everytime that word is encountered, it is simply
replaced by that text and the POV does its thing with it.
Thus, by declaring that box of yours and typing:
B
It probably simply replaces it with the text and then it works. But when you
type:

B translate y*2

It's like typing:
box {-1,1} translate y*2
Which is, of course, illegal by the POV language and that's why the object
keyword is required.
Again, this is just a guess after seeing how some other programmnig
languages work.
Hope this may have cleared thing a bit,

                        - Ron


Post a reply to this message

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