POV-Ray : Newsgroups : povray.programming : language design (was Re: hash marks) : Re: language design (was Re: hash marks) Server Time
28 Jul 2024 16:15:37 EDT (-0400)
  Re: language design (was Re: hash marks)  
From: Thorsten Froehlich
Date: 15 Mar 2002 04:53:39
Message: <3c91c4a3@news.povray.org>
"Vadim Sytnikov" <syt### [at] rucom> schrieb im Newsbeitrag
news:3c90feae@news.povray.org...
> > > #local Rotate = transform { rotate ... }
> > > object { ... Rotate }
> >
> > I don't understand your answer at all.
>
> Sorry, I was probably unclear -- in that I have omitten several steps that
> seemed obvious to me... I'll try once again. Here is your code with my
> marks:
>
>   if(z>0)
>      sphere{0 1
>                  ^-------- (A)
>   else
>      box{-1 1
>            ^--------------(B)
>   end
>      rotate x* if ( vlength(<x,y,z> > 1 )  30 else (2+x+y+z) end
>    } <-------------------(C)
>
> If 'if' statement were a real statement, and not merely a pre-processor
> directive, then you would be unable to place parentheses like that (marks
> (A) and (B)). Such placement is always considered dangerous -- you are
> subdividing statement into pieces, AND pre-processor is unable to help you
> to find any bugs, since it has no notion of what is between its
> directives... Even if you have exceptional abilities and can maintain such
a
> code, other readers of your code may easily get confused with such
grouping
> (well, not with *that* example, but with a bit more complex...) That is
why
> such (once again, not this, but a more complicated code written in the
same
> manner) is often called a "write-only" code.
>
> You are not to blame for that -- since 'if', 'switch' etc. keywords are
> pre-processor directives rather than true language statements (that obey
> some syntax rules), you are almost encoraged to write like that.

I am sorry, but I am unable to follow you.  Given the example he gave is not
pre-processes but would be allowed by the language, where exactly would be
the problem?  The example is fictional and thus there cannot be the problem
you describe, at least assuming I understood what problem you are talking
about...

    Thorsten


Post a reply to this message

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