On 12/10/2010 3:23 AM, Thomas Heller wrote:
> I think there is a misunderstanding in how "sub-domain"ing works.
> The solution you propose is that a sub domain extends its super domain in
> the way that the expressions in the sub domain also become valid in the
> super domain. I guess this is the way it should work.
> However, the solution I am looking for is different.
> The sub-domain i tried to define should also extend its super domain, BUT
> expressions valid in this sub-domain should not be valid in the super
> domain, only in the sub-domain itself.
Because you don't want phoenix::_a to be a valid Phoenix expression
outside of a phoenix::let, right?
> I think proto should support both forms of operation. The first one can be
> easily (more or less) achieved by simply changing proto::matches in the way
> you demonstrated earlier, I think. I am not sure, how to do the other stuff
> properly though.
OK, let's back up. Let's assume for the moment that I don't have time to
do intensive surgery on Proto sub-domains for Phoenix (true). How can we
get you what you need?
My understanding of your needs: you want a way to define the Phoenix
grammar such that (a) it's extensible, and (b) it guarantees that local
variables are properly scoped. You have been using proto::switch_ for
(a) and sub-domains for (b), but sub-domains don't get you all the way
there. Have I summarized correctly?
My recommendation at this point is to give up on (b). Don't enforce
scoping in the grammar at this point. You can do the scope checking
later, in the evaluator of local variables. If a local is not in scope
by then, you'll get a horrific error. You can improve the error later
once we decide what the proper solution looks like.
If I have mischaracterized what you are trying to do, please clarify.
proto mailing list