[asterisk-dev] Reverse Inheritance

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Tue Nov 11 11:00:00 CST 2008


On Monday 10 November 2008 23:07:19 Trevor Peirce wrote:
> John Todd wrote:
> > These symbols seem fine, but in the long view it is perhaps the case
> > that the "_" character was incorrect as the leading indicator for
> > forward inheritance.  It seems, logically, that "+" and "++" should
> > represent forward and infinite forward inheritance, and "-" and "--"
> > should indicate reverse and infinite reverse inheritance.   We may be
> > too far out of the gate for this type of serious change (or shift) to
> > be practical, and there may be other syntactical/parsing reasons why
> > what I think is reasonable is not a practical nomenclature.
>
> I would strongly advise against this as it starts to resemble math too
> much and could misleading. As an alternative I suggest appending _ to
> the variable name in contrast to prepending.
>
> Forward inheritance: _variable or __variable
> Reverse inheritance: variable_ or variable__
>
> A memory technique that can be associated with this is if the variable
> name is after the _ mark, it will go to channels created after. If the
> variable name is before the _ mark, it will go to the channels created
> before.

I see two potential problems with this notation.  First, the idea was to
select a delimiter that was probably not in common usage in variable
names.  One possible use of variables is to set a variable whose name
is the product of another variable, such as Set(STATUS_${app}=...).  In
the case where app is blank, you have ${STATUS_} as the name of the
variable, which would get inherited, which was not the intention.

Also, it would mean that when determining the name of a variable, one
would have to first span the length of each variable and possibly chop off
1 or 2 characters from the end, which may require a temporary buffer.  This
is suboptimal.  When you use a prefix, you can return a substring of the
original, without modifying the original string.

If the plus sign sounds too much like math, which is an objection I can
understand, how about using the caret sign ('^'), which is another character
that Jared Smith suggested in our discussion.

-- 
Tilghman



More information about the asterisk-dev mailing list