POV-Ray : Newsgroups : povray.beta-test : beta 32 - buglist : Re: beta 32 - buglist Server Time
5 Oct 2024 18:27:54 EDT (-0400)
  Re: beta 32 - buglist  
From: clipka
Date: 8 Apr 2009 23:05:00
Message: <web.49dd65971eef0732a08de100@news.povray.org>
"Tim Attwood" <tim### [at] anti-spamcomcastnet> wrote:
> I just think that a declare should look for closures of control structures
> after
> finding an identifier. I don't think you should just queue a pointer to the
> next
> identifier. It works, but it's hardly what most people expect.

That's just because they're not very used to this type of parsers anymore.

Why should a #declare look for closures of control structures? After all, it's
just a dumb #declare.

That's just the basic idea behind POV's current SDL:

You have a very straightforward SDL, with (comparatively) clear structure that
can easily be checked.

On top of that sits some preprocessor, which just freely scrambles the input
file to build new statements, according to statements embedded in the input
file. Which gives it the potential to make it an ugly mess.


This two-tier approach is quite outdated of course, but that's just how things
were when POV's SDL was conjured up. Or, probably more likely (don't know the
history), when it was decided to add programming capabilities to the SDL.

Time for a new SDL to be designed, which hopefully will abandon the preprocessor
concept, and instead seamlessly integrate control flow into the scene
description, enforcing stricter (and therefore easier to check) rules for the
nesting of stuff.


> In
> particular,
> in a large file it can be very hard to find a typo (user error) related to
> this
> behavior since it raises no parsing errors. It would be reasonable to add
> warnings on use of declares containing control structures, even if it's
> decided
> not to change the behavior.

Why that? What's wrong with

#local MyBlob = {
  #local i = 0;
  #while (i < 10)
    sphere { VRand(Rnd)*10, rand(Rnd) ... }
    #local i = i + 1;
  #end
}

Impossible without nesting of #local statements.

Yes, this example nests nicely. But checking for the nesting isn't so easy,
given the current SDL parser structure.

And there may be examples where nesting isn't desired. Which is bad programming
style if I'm asked, but it seems like people do it occasionally.


Post a reply to this message

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