POV-Ray : Newsgroups : povray.general : POV-Ray Includes - Standards : Re: POV-Ray Includes - Standards Server Time
1 Aug 2024 00:19:37 EDT (-0400)
  Re: POV-Ray Includes - Standards  
From: Charles C
Date: 5 Dec 2006 13:40:00
Message: <web.4575bca847def5cab160ffde0@news.povray.org>
"nemesis" <nam### [at] gmailcom> wrote:
> "Randall Sawyer" <sra### [at] yahoocom> wrote:
> > But, I've just been getting
> > them out there so that we can all find the one made of tungsten.
>
> That's the whole point of this thread.  And indeed perhaps none of them is
> actually made of tungsten, but if we mix them in an alchemists way, we may
> eventually get gold. :)
>
> > some of those includes might call still more - "third
> > level" - and so on.  That's where you might run into a naming issue.  Who
> > wants to have to read all those other files?
>
> No one wants naming conflicts:  they are bad, very bad.  That's why i
> proposed having included items being local to the file including them.  And
> it really doesn't seem much difficult to make the parser handle it that way
> and aliases.
>
> > I realize that the #ifndef() at the front of each include may interfere with
> > this strategy.  (User includes "A.inc" and "B.inc" and "A.inc" includes
> > "B.inc".
>
> I believe such metaprogramming #ifdefs and whatnot should be in charge of
> the parser, not the user.  If includes are local, there should be no need
> for them.

If you want the #declare of a sub-include to have local-status of a
current-level include, then that seems like it'd work just as long as the
#declare was meant to be used at a one-up level (one-up from the
sub-include).  I've got a lot of stuff which I think this system would
break.  It's seems hard to come up with a system that won't break
something.

How about different namespaces plain & simple, but with two additions:  The
ability to define a global namespace, and the ability to combine
namespaces. If multiple namespaces are activated at once via a command
#namespace(Jake,Sam) the parser should automatically give an error if there
are conflicts.  New #declares that are created when multiple non-global
namespaces are active will remain accessible to the individual namespaces.

#namespace (global) //brings scope up to global namespace only (default)
#include "colors.inc"

#namespace (Jake) //namespace Jake is defined and activated.
//global namespace is still accessible and therefore had better not conflict
with Jake.
#include "jakes_objects.inc"

#namespace (global) //brings scope up to global namespace only

#ifdef(jakes_doorknob)
    #debug "huh? jakes_doorknob shouldn't be accessible now."
#end

#namespace (Jake) //switch back to jake's namespace as remembered by parser

#object{ jakes_doorknob pigment{White}  }


Post a reply to this message

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