POV-Ray : Newsgroups : povray.general : POV-Ray Includes - Standards : Re: POV-Ray Includes - Standards Server Time
1 Aug 2024 02:22:50 EDT (-0400)
  Re: POV-Ray Includes - Standards  
From: nemesis
Date: 4 Dec 2006 05:30:01
Message: <web.4573f71a47def5ca3976a8750@news.povray.org>
From: Sabrina Kilian
> If I understand correctly, the proposed #as would do what, add a prefix
> to everything that the include makes available to the outside?

Prefixing should be an easy option than to actually mess with povray's
parser to really cope with lexical scoping.

> #include "nem_bike.inc" #as nem // bike by nemesis
> Everything in just bike.inc is prefixed with nem. If bike.inc includes
> another file, are those prefixed or not?

If bike #includes a file and gives it an alias, that alias should actually
be of #local scope.  So, the #included items should only be visible inside
bike.inc.

Perhaps you're making confusion between #including bike's contents to your
file and the contents bike.inc #includes from other files?  The latter
should not be visible outside bike.inc.  I'm guessing povray's parser
could give a help by handling it transparently like:

/* bike.inc */

#include "nuts_and_bolts.inc" #as nuts

This would be handled by povray's parser as follow:  create in bike.inc
prefixed #locals for each #declared items in nuts_and_bolts.inc.  Will it
work?  I don't really know, but it's an idea.


From: Darren New
> FWIW, in my experience, by the time the conversation gets to this level,
> progress has stalled to the point where nothing will get done because
> it's never perfect enough to start.

Yes, i agree.  But give it some more time for more people to have some input
into this discussion.  Some planning can never hurt, only if remains just
planning...

> it's probably better to get started, rather than to wait for POV-Ray to be
> improved to the point where a giant repository could be compiled without assistance.

I'm also eager to get it going! :)


From: Ben Chambers
> Perhaps a better solution, to avoid both namespace collisions and
> automatic name mangling, would be to add a new object type, the
> 'container'.  It would work something like this:

#declare stuff = container;
#declare stuff.x = 5;
#declare stuff.loc = <3,4,6>;
#declare stuff.ball = sphere {0,1}

hmm, whatever happens if i #include a file that #declares a "stuff"? :)

> Basically, the container acts as a namespace on its own.  Each include
> file could use a container for its variables and declarations, except
> for those it needs exported globally.

Actually, your container looks remarkably similar to an "class instance"...
but, how is the container any different from a #macro?  They look the same,
except you have to prefix each variable with the "macro" name.


Post a reply to this message

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