Let me first describe the problem, and then suggest a solution.
I quote from Docs/README.xmlpanel.html :

> when an instrument is included by reference, its root is *not* the root of 
> the property tree,
> therefore aliases must be relative. The relative location of the alias' root 
> in the property
> hierarchy depends on whether the alias is used in a layer, a switch or an 
> action. In lieu of snappy
> mnemonic, please use the following table.
> when alias
> is used in     go up
> ---------      -----
> layer          5 ( ../../../../../params/foo )
> switch         3 ( ../../../params/foo )
> action         3 ( ../../../params/foo )

That reminds me of assembly-language programming on a machine
designed in the 1950s.  (In contrast, by the 1960s they had
invented base registers and double indexing.)

Do I really have to count, by hand, the depth of the xml
statements, in order to know how many ".." levels are needed?
I thought computers were supposed to be good at counting stuff.

Here's a modest proposal:

Define a notion of module.  In the simplest version a module is
a file, such as a *panel.xml file (although fancier notions of
"module" are certainly possible).

Then define a new entity called the base register or frame pointer.
It is denoted "..." and points into the property tree, somewhat the
way "." does, except that "..." is always automatically bound to
whatever "." was /at the very beginning of the module/.

Therefore in a typical *panel.xml file, it would be possible to
write simply ".../params/foo" and the programmer would not need
to do any counting.  This would make the code
  -- easier to write;
  -- easier to read;
  -- more portable and reusable;
  -- more maintainable; and
  -- more elegant.

There would no longer be any need for a "snappy mnemonic".

To say the same thing another way, counting up from the frame
pointer is nicer than counting down from the stack pointer.

This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
Flightgear-devel mailing list

Reply via email to