POV-Ray : Newsgroups : povray.programming : language design (was Re: hash marks) Server Time
28 Jul 2024 14:28:58 EDT (-0400)
  language design (was Re: hash marks) (Message 24 to 33 of 33)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Thorsten Froehlich
Subject: Re: language design (was Re: hash marks)
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

From:
Subject: Re: language design (was Re: hash marks)
Date: 15 Mar 2002 05:07:56
Message: <hfh39ukd7a4pernugq2trhcssrjv16hp3g@4ax.com>
On Fri, 15 Mar 2002 10:55:25 +0100, "Thorsten Froehlich" <tho### [at] trfde>
wrote:
> The example is fictional

That's it. I've connected keyword and features of "if" with "select"
application as he suggested (or at least as I understand his suggestions). And
it clearly showed how it can confuse. Loosing features of current "if"
(spliitting closed statements) could be of course possible but completly
useless imo. Directives _with features_ state power of L in SDL whatever
syntax they have.

And btw Thorsten, thanks for "select" extraction. It helped me a lot in my
current #switch work :-)

ABX


Post a reply to this message

From: Vadim Sytnikov
Subject: Re: language design (was Re: hash marks)
Date: 15 Mar 2002 10:12:47
Message: <3c920f6f$1@news.povray.org>
> Given the example he gave is not
> pre-processes but would be allowed by the language, where exactly would be
> the problem?

The example that ABX gave us would *not* work in a language that has normal
scope rules (which even BASIC and Fortran have these days -- to some
extent). Below, left (opening) parenthesis opens scope for the 'sphere'
statement. If the 'if' and 'else' keywords were true language statements,
and not merely pre-processor directives, then it would be necessary to have
a right (closing) parenthesis before the 'else' statement.

>   if(z>0)
>      sphere{0 1
>                ^-------- (A)
>   else

That is, if we had a consistent language, the example should have looked
like this (extra parentheses added to just make scopes more clear; I do not
insist language syntax should necessarily require that):

if( z>0) {
  sphere {
    // sphere definition goes here
  }
} else {
  // another shape definition
}

In other words, the 'sphere' scope should have been closed before the 'else'
keyword. Therefore, transform definition should have been specified before
the 'else' keyword as well. Therefore, the only way to avoid duplicating
transform definition would be to declare it beforehand, and then reference
from within sphere definition, etc. (as I wrote earlier).


Post a reply to this message

From: Jérôme Grimbert
Subject: Re: language design (was Re: hash marks)
Date: 15 Mar 2002 10:32:19
Message: <3C921403.2821705A@atosorigin.com>
Vadim Sytnikov wrote:

>   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 you want something different from:

union {
 intersection {
   sphere { 0,1 }
   plane { -z,0}
   }
 intersection {
  box {-1,1}
  plane { z,0}
 }
 rotate ....
}

then you are doomed to work with mesh or rewrite the whole pov-engine.
Especially if you absolutlely want the non-linear transform from the second if.
Then you could make your own SDL, without preprocessor visible level if you wish.

-- 
Non Sine Numine
http://grimbert.cjb.net/
Puis, s'il advient d'un peu triompher, par hasard,






Post a reply to this message

From:
Subject: Re: language design (was Re: hash marks)
Date: 15 Mar 2002 11:19:21
Message: <9g649uo3vk0dmqnklkvl6fsa1ed1kd3qrd@4ax.com>
On Fri, 15 Mar 2002 18:12:46 +0300, "Vadim Sytnikov" <syt### [at] rucom> wrote:
> The example that ABX gave us would *not* work in a language that has normal
> scope rules (which even BASIC and Fortran have these days -- to some
> extent).

But POV-SDL isn't normal language. It's mix of language and description so it
don't have to have "normal" _language_ scope rules. Again going back to
HTML/script example. Did you use php ? You can open HTML tag inside php
condition statement and close it outside. Something like:
    <?php if (a>3) { ?>
      <p align="left" style="color:#123456">
    <?php } else { ?>
      <p align="right">
    <?php } ?>
      important text
    </p>
is valid and php works like preprocesor for webserver. There are probably some
leyers in processing but they are invisible for both: surfer and designer. The
same is valid for other server-side scripts. So POV-SDL works typically for
such combinations - just  all-in-one.

ABX


Post a reply to this message

From:
Subject: Re: language design (was Re: hash marks)
Date: 15 Mar 2002 11:36:07
Message: <ol849u8lrhhf1ua7hvdk04phba2ku8dq12@4ax.com>
On Thu, 14 Mar 2002 22:50:01 +0300, "Vadim Sytnikov" <syt### [at] rucom> wrote:
> The interpreter would *not* allow you break pairs of
> parentheses like that. And guess what? I think that that would be right!

BTW: I think You will not convince me but I can't say You are or are not right
at all. Mainly becouse my opinion is subjective - I like power which appear in
ability to write short scripts like for example sigs :-)

ABX


Post a reply to this message

From: Vadim Sytnikov
Subject: Re: language design (was Re: hash marks)
Date: 15 Mar 2002 11:39:05
Message: <3c9223a9@news.povray.org>

> But POV-SDL isn't normal language. It's mix of language and description so
it
> don't have to have "normal" _language_ scope rules.

You have to have well-defined scope rules to just cope with the complexity.
To make your scenes editable by someone else -- that is, to share code
(models etc.) Have you been using someone else's POV-Ray model recently?
Were you able to edit it?

> Did you use php ? You can open HTML tag inside php
> condition statement and close it outside.

Have you been editing someone else's php code recently? Were that easy?

I'm not talking about what is possible (has precedents etc.) and what isn't.
I'm talking about what's better (== easier, more reliable).


Post a reply to this message

From: Vadim Sytnikov
Subject: Re: language design (was Re: hash marks)
Date: 15 Mar 2002 12:00:47
Message: <3c9228bf$1@news.povray.org>

> I like power which appear in
> ability to write short scripts like for example sigs :-)

I see... and I would like to assure you that I... err, share your desire for
poerful features. The *only* question is -- how is that power unleashed?

I, for one, cannot be convinced not to use forward goto's in C at all --
there is simply no other efficient way to escape deeply nested loop. In
Java, one can demand that there must be no goto's at all -- since there are
labeled loops AND you can always 'break' the loop you want (by its label).
In C, you sometimes have no alternative, especially in a time-critical
code...

So, as to POV-Ray, the challenge is just provide powerful AND
well-structured featureas which will render puwerful BUT unreliable features
obsolete.


Post a reply to this message

From:
Subject: Re: language design (was Re: hash marks)
Date: 15 Mar 2002 12:19:47
Message: <ff949ucumci7n7q6e9sjip5j0jv7j0ls82@4ax.com>
On Fri, 15 Mar 2002 19:39:04 +0300, "Vadim Sytnikov" <syt### [at] rucom> wrote:
> You have to have well-defined scope rules to just cope with the complexity.
> To make your scenes editable by someone else -- that is, to share code
> (models etc.) Have you been using someone else's POV-Ray model recently?
> Were you able to edit it?

Well, You can look at povray.general, povray.text.scene-files and
povray.binaries.scene-files into splitted thread about IsoCSG include file. It
started yesterday and I have posted at least 4 extensions into that (including
whole rebuild with different parameters handling) and discuted it even more.
But IIRC there wasn't such splitted syntax. But I always look into sigs of
POV-ers. They _always_ use confusable (is there such word?) syntax. Usually it
takes me some short time to understand - but those sigs were written to
confuse so nothing strange. Anyway if there (in sigs) is something to improve
in confusing or length I usually send it. It's known fact, you can dig on
news.

> > Did you use php ? You can open HTML tag inside php
> > condition statement and close it outside.
>
> Have you been editing someone else's php code recently? Were that easy?

I haven't used php recently so I can't answer. I'm also not even half
experienced in php as in pov (supposing I have some experience in POV) so I'm
probably not a good target for this question. But I use other server-side
language (WebSpeed platform) and work in team with success. We builded and
maintain broker service with it. It use html splitting as in posted example.

> I'm not talking about what is possible (has precedents etc.) and what isn't.
> I'm talking about what's better (== easier, more reliable).

Allocating memory for additional objects, floats, strings, transformations
isn't better in this case imo.

ABX


Post a reply to this message

From: Vadim Sytnikov
Subject: Re: language design (was Re: hash marks)
Date: 15 Mar 2002 17:21:41
Message: <3c9273f5@news.povray.org>
> They _always_ use confusable (is there such word?) syntax.

Obfuscated is the right word. There is/was even such thing as IOCCC (stands
for the International Obfuscated C Code Contest); IMHO quite amusing...


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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