[augeas-devel] Reformat function

David Lutterkort dlutter at redhat.com
Wed Jul 23 17:54:01 UTC 2008


On Wed, 2008-07-23 at 13:00 -0400, Nate Foster wrote:
> I should add two things:
> 
> 1. I may have misunderstood what you were proposing for "reformat". A
> simple form of reformatting while ignoring the original string should
> already available by the "create" function. Like "put", it converts a
> tree into a string, but it ignores the original string. I'm not sure
> if David has exposed "create" in the API / in unit tests (the web
> pages don't mention it, but maybe they're incomplete), but it is
> definitely in src/put.c. In particular, you need it to implement the
> "put" function for Kleene-star.

"create" is there, though it's not exposed, and I usually don't talk
much about it, mostly to keep explanations of what happens behind the
scenes simple.

> The idea behind quotient lenses, described in the paper I linked to,
> is a bit more general. Quotient lenses have "put" functions that
> ignore some of the information in the string (so, e.g., you can have a
> lens that *always* formats certain information like whitespace to
> canonical values but correctly discards/restores other information).
> This behavior is pretty simple to code up. What's tricky is showing
> that it is still correct... the bulk of the paper is spent developing
> a framework in which you can prove this.

Yes, as I understand what Raphael was asking for, quotient
lenses/canonizers would be the right answer. The goal would be, e.g. to
make sure that the white space between the IP address and the canonical
hosts name in /etc/hosts is always a single space (or a tab or ...)

A similar request which I think is a little harder to accomplish is to
make sure the entries in /etc/fstab line up, i.e. have the second column
in /etc/fstab start in column 24 on all lines. For that, I am not even
sure how you would achieve that since you'd need to know where on the
line you are.

> 2. Since my previous message was my first post to the list, I should
> introduce myself: I'm a student at Penn and have been working on
> lenses for a few years now. With my adviser, Benjamin Pierce, and a
> few others, I've worked on the lens languages Boomerang (for strings)
> and Focal (for trees). We have been trying for many years to get these
> ideas out into the world, so we're thrilled to see so many interesting
> lenses being built.

And just to be clear: without the work on Boomerang and Focal, Augeas
wouldn't exist, or, at the very least, would be a very hackish beast - I
know because I tried before I looked at the Boomerang/Focal work, and
what I came up with wasn't pretty, looked more like one of those
human/animal hybrids we'e all been warned about.

> Also, we are planning a v0.1 release of Boomerang very soon (I'll post
> the announcement here). If any of you are brave and interested in
> playing with string-to-string lenses, we'd love to have users :-)

Excellent ! Once you have the release together, you should add it as a
package to Fedora (and Debian, Ubuntu, ...) At least for Fedora, there's
solid packaging guidelines for OCaml now[1], and a good number of OCaml
packages.

David

[1] http://fedoraproject.org/wiki/Packaging/OCaml





More information about the augeas-devel mailing list