On Sun, 2010-10-24 at 18:58 -0400, Francis Giraldeau wrote:
> Hi, 
> 
> I adjusted the typecheck to allow multiple keys and labels inside a
> subtree. We have to check that concat keys doesn't overlap, and that
> union is disjoint. Hence: 
> 
> let lns = key /[a]*/ . key /[a]*/ => concat.get ambiguity
> let lns = key "a" | label "a"     => union.put ambiguity
> 
> It's not that bad in term of typechecking performance impact, it's
> basically the same (accounting for variability, I did tests only once
> for both): 
> 
> baseline               : 2m42.575s
> with subtree typecheck : 2m42.004s
> 
> This is the first step to get the multipart key working. Next is to
> match a node label with the ktype and split parts to sublenses. 

Is it really necessary to introduce the atype_complete flag ? Doesn't
the fact whether the atype is NULL tell us that ?

The abstract type of a lens is really a tree language; but since dealing
with those is a little involved, we used as the atype the regular
language describing possible key/value pairs of the children of a node,
i.e. we disregarded the key and value of the node. Let's continue
calling that the atype, as it is in the code. One effect of this
simplification is that the typechecker would trip over false positives.

With the changes you are making, the typechecker gets closer to the
'true' types of the trees, since we now take keys into account, too. We
are effectively checking a cartesian product now, ktype x atype.

For union, we now need to have (ktype1 x atype1) and (ktype2 x atype2)
disjoint, i.e. that T = (ktype1 \cap ktype2) x (atype1 \cap atype2) is
empty. Since dealing with cartesian products of regular languages isn't
all that pleasant, we don't want to compute that full type. Instead, we
can rely on the fact that T has to be empty if ktype1 and ktype2 are
disjoint; only if they are not, do we need to check atype1 \cap atype2.
And if they are not disjoint either, we'll raise an error, even though T
still might be empty.

A similar argument should hold for the unambiguous concatenation check
for concat and star.

David


_______________________________________________
augeas-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/augeas-devel

Reply via email to