POV-Ray : Newsgroups : povray.general : Who Not Make Naming Conflicts Disappear? : Who Not Make Naming Conflicts Disappear? Server Time
31 Jul 2024 16:22:46 EDT (-0400)
  Who Not Make Naming Conflicts Disappear?  
From: Randall Sawyer
Date: 6 Dec 2006 15:30:00
Message: <web.4577238990cd3dbce81faf070@news.povray.org>
This is another off-shoot from a previous thread.

Currently, authors of POV-Ray files manage naming collisions themselves.
They know the identifiers declared in their include files as well as the
ones they write themselves.  Let's not try to fix what isn't broken.

What if an author wants to include a file which also includes still more
files?  In that case - as POV-Ray exists now - unforseen naming conflicts
may occur.  To address this issue, I propose the following concept:

Modify the parser in such a way that it assembles each include file as it
goes.  Then, whatever identifiers were used to create the include file in
the first place are available for reuse in any file which '#include's that
include:

    /-----------  B1 Names   /-----------
    |  B1.inc  | ==========> |          |
    -----------/             |          |  A1 Names   /---------------
                             |  A1.inc  | ==========> | My_File.pov  |
    /-----------  B2 Names   |          |             |  (or .inc)   |
    |  B2.inc  | ==========> |          |             |{I cannot use |
    -----------/             -----------/             |names used in |
                                                      |B1.inc or used|
                             /-----------  A2 Names   |in B2.inc.}   |
                             |  A2.inc  | ==========> |              |
                             -----------/             ---------------/
    is transformed into:

    /-----------  A1 Names   /---------------
    |  A1.inc  | ==========> | My_File.pov  |
    -----------/             |  (or .inc)   |
                             |{Now I can use|
    /-----------  A2 Names   |names used in |
    |  A2.inc  | ==========> |B1.inc or used|
    -----------/             |in B2.inc.}   |
                             ---------------/

I am uncertain as to the best means for implementing this idea.  I have
already suggested one possibility though:

One way is to retroactively rename all of the identifier declarations in
B1.inc and B2.inc and all of their corresponding implementations in A1.inc
uniformly.  Renamimg the identifiers would be done by the parser once the
files are loaded into the buffer.  The parser would append each identifier
string using character values that no user could with a keyboard (ascii
128-255).

I would appreciate some feedback.

-Randall


Post a reply to this message

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