[augeas-devel] [PATCH] add match construct to lens language
David Lutterkort
lutter at redhat.com
Sat Feb 21 21:56:29 UTC 2009
On Sat, 2009-02-21 at 10:47 +0100, Dominique Dumont wrote:
> David Lutterkort <lutter at redhat.com> writes:
>
> > The default branch '| _ -> ...' is mandatory and must be the last
> > one in the match statement (I don't want to deal with none of the
> > branches matching at runtime)
>
> Any reason why the default branch is associated with '_' ?
It's just following ML syntax very closely.
> IMHO, the switch-case statement would be more easy to grasp without
> reading the whole lens doc...
I don't understand what you mean by that.
> Eh, this looks like the warping mechanism [1] provided in
> Config::Model :-)
Heh .. nice name; there's a few differences: the patterns in the match
must be constants, whereas warpers match on arbitrary conditions. Also,
match isn't tied to a specific use of the expressions on each branch -
they are just arbitrary expressions.
The warping is an interesting idea, since it lets you postprocess the
tree - do you allow modifications of the warped objects ? And if so, how
do you turn that into changes in the original tree ? I would really like
to add a way to write tree -> tree lenses for Augeas to enable that kind
of postprocessing.
David
More information about the augeas-devel
mailing list