cc:  [email protected]
Subject: Re: Re: [ast-developers] [RFE] var.__ to access the parent variable of 
a  type or compound variable
--------

> On Mon, Jul 22, 2013 at 1:28 PM, Cedric Blancher
> <[email protected]> wrote:
> > Forwarding the proposal. Wendy's idea to use varname.__ as name to
> > reference a compound/type variable's parent is IMO *great*.
> >
> > For example:
> >
> > compound c1=( compound c2=( integer i=5 ) )
> > nameref ni=c1.c2.i # reference i
> > nameref nc2=ni.__ # accesses c2 though i
> > nameref nc1=ni.__.__ # accesses c1 through i
> 
> Erm... I like the idea very very much because it solves a few things
> with big variable trees and (performance) scalabilty...
> 
> ... but the question is... can var.__ be implemented in a way which
> avoids going through any name lookup ? My worry is that it won't save
> much CPU time if it operates via name lookup (e.g. does the nval API
> have a way to do a |np_getparentnode()| ?).
> 
> ----
> 
> Bye,
> Roland
> 
> -- 


Currently  compound variable do not contain a pointer to the parent
so I see little advantable to adding var.__ since it would be slower
than creating a name reference to the parent via
        ref=${var%.*}

However, if I change this and store a pointer to the parent, then
using having a syntactical means of referencin it would be useful.
Using __ removes the ability to have __ as a subvariable.

Perhaps ${var..} could refer to the parent.

David Korn
[email protected]
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to