Em Sáb, 2009-09-26 às 16:14 +1000, Timothy S. Nelson escreveu:
> I've been wondering about lenses recently. The page at
> http://www.seas.upenn.edu/~harmony/ seems to give an overview, and I know
> augeas also uses lenses.
> It seems to me that a grammar can be thought of as a one-way lens. I
> was wondering whether the bi-directional idea might be interesting in this
> context. It seems to me that, at the moment, when we want to do a format
> conversion, we:
> - Read the data in with a grammar
> - Output the data with something like Form.pm
> I'm wondering if there isn't some way that the whole thing can be
> turned into lenses.
> Anyway, I'm sort of half thinking out loud, and wondered if anyone had
> any relevant thoughts.
I think this is an interesting addition to the old "Tree Transforming
Language" debate that once a year we remember to discuss.
Basically, we could understand perl5+B::Deparse as composing a "lens",
but it's done pretty much in an ad-hoc way, which is fine for perl5,
since it's much more static (okay, that was before Devel::Declare)...
But in Perl 6, that is pretty much interesting, because we have
something pretty abstract, which is the STD parse tree, which needs to
be converted into some implementation's optree/bytecode/whatever.
but I'm sort of half thinking out loud as well ;)