[e-lang] StaticScope's hasMetaStateExpr definition

Mark S. Miller markm at cs.jhu.edu
Mon Feb 27 14:15:43 EST 2006

Kevin Reid wrote:
> It would be useful to be able to express "does this ENode contain a  
> reference to some noun or a MetaStateExpr that is not inside an  
> intervening ObjectExpr".

Yes, I agree that would be useful.

> 1. Is hasMetaStateExpr used in ways which would be incompatible with  
> redefining it as that? If not, should we introduce a separate flag  for it?

I just looked. Currently, hasMetaStateExpr is essentially unused. If we did 
decide to change its meaning, it would be no trouble at all to fix all uses.

However, I think it's the wrong name for the operation you desire. For that 
operation, I like the name you use below: hasOuterMetaStateExpr.

> 2. What would you think of StaticScope having an operation like 'uses 
> (noun) :boolean' to clearly express the intent of the test I describe  
> above?
> (That is:
>   ejectorPatt =~ f :FinalPattern \
>     ? (ejectorPatt == f &&
>        f.getOptGuardExpr() == null &&
>        !(bodyScope.uses(ejectorPatt.getNoun().getName())))
> and
>   to uses(noun) :boolean {
>     return namesUsed.maps(noun) || hasOuterMetaStateExpr
>   }
> )

I think this operation would be a good idea.

There is currently a similar optimization in E-on-Java's 
BindFramesVisitor#visitEscapeExpr. But because it uses hasMetaStateExpr, it is 
too conservative in just the way you point out. It should be changed as you 

But I think the real answer is to get rid of meta.getState() from Kernel-E. 
Instead, in a scope containing x and y, the expansion from Expanded-E to 
Kernel-E should expand



     ["&x" => &x, "&y" => &y]

E-on-Java currently expands circular defines into non-circular defines during 
expansion from E to Expanded-E. We should move this expansion as well to the 
Expanded-E to Kernel-E expansion. Together, this would expand

     def x := meta.getState()


     def x := ["&x" => &x]

and then to expand correctly from there. Currently, a cycle containing a 
meta.getState() on the right is not handled correctly, and it is hard to see 
how it could be.

What does E-on-CL currently do on this case?

Text by me above is hereby placed in the public domain


More information about the e-lang mailing list