On Monday, July 22, 2013 12:06:24 PM Cedric Blancher wrote:
> What about _._ to access the parent in both types and compound variable 
> trees?

_._ already has a meaning because you can have a variable named _ as a member 
of both types and compounds. `compound x=(nameref y=_._)' is just making y 
point to x._ (which is a regular variable).  

> For example:
> 
> compound c1=( compound c2=( integer i=5 ) )
> nameref n1=c1.c2.i
> nameref nc2=i._ # accesses c2 though i
> nameref nc1=i._._ # accesses c1 through i

Access to the parent isn't quite what you want. If you have `Type_T obj', 
there should always implicitly be something pointing directly at obj visible 
to everything within obj. You're not going to want to have to crawl up through 
levels of indirection especially if a function doesn't know how deep it is.

The entire purpose of defining "getters" in a type is to hook accesses to the 
data fields of the type. Just about every normal language that isn't C has 
something like that, usually a special variable/keyword called "this" or 
"self". _ apparently doesn't emulate that well.

-- 
Dan Douglas
_______________________________________________
ast-users mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-users

Reply via email to