[erlang-questions] comma-less lists and tuples

Vlad Dumitrescu vladdu55@REDACTED
Fri Sep 22 09:11:38 CEST 2006


On 9/22/06, Ulf Wiger <ulf@REDACTED> wrote:
> Den 2006-09-22 02:36:57 skrev Richard A. O'Keefe <ok@REDACTED>:
> > The approach I suggested, of having a declaration to associate
> > an "embedded syntax" keyword with a new parser module, is, really,
> > BOTH:
> >     - the Erlang compiler only knows about Erlang
> >     - but it can be extended with anything that can turn a
> >       token list into Erlang abstract syntax trees
> >
> > It's a parse transform at a somewhat lower level.
>
> Yes, and I started writing a reply to your post
> telling how much I liked your idea. I think it
> should be quite easy to implement, too.

It is easy. :-) The big problem is to decide on the syntax and then to
convince the OTP team that it's a good idea to get it into the
mainstream.

With a little cooperation from the respective parser, it is also
possible to use such expressions as patterns in a match. With
provisional syntax
   <sql| select @Fields from users |> = <sql| select name, id from users |>,
   Fields == [name, id]

I will publish[*] a document about my attempts at metaprogramming in
Erlang, where even more extensions are described. In the worst case,
it would be possible to have the extensions only present in
"metaerlang" files (suggested file extension: .mrl), so that we don't
pollute the regular erlang language.

[*] I will begin this weekend and have it on trapexit.

regards,
Vlad



More information about the erlang-questions mailing list