Metaprogramming

Thomas Lindgren thomasl_erlang@REDACTED
Fri Aug 25 12:56:27 CEST 2006



--- Vlad Dumitrescu <vladdu55@REDACTED> wrote:

> On 8/23/06, David Hopwood
> <david.nospam.hopwood@REDACTED> wrote:
> > Do you have any design notes or examples of what
> this might look like?
> 
> > Will it be possible to write a quasipattern
> anywhere that a pattern
> > can currently occur in Erlang?
> 
> Yes, I'd like it to be possible. My implementation
> is what Richard
> described above as Lisp's backquote - when the
> module is parsed, the
> new stuff is converted to Erlang terms and from then
> on it's just
> regular code.
> 
> Provisional syntax is:
>   <| ... |> encloses code and its value is simply
> the parse tree
>   @Var is a "unquote" application, replacing the
> variable value in the code
>   @@Var is a "splicing-unquote" application, where
> Var must be a list
> and its content is spliced in the containing list
> (possibly even
> tuple)
> 
>   <|name| ... |> will use module "name" to retrieve
> lexical scanner
> and parser, thus allowing even

Seems like a nice notation. I once experimented with
something similar for just Erlang, and ran up against
the problem that one often wants to work with
syntactic program fragments too. So, you will have to
invoke the erlang parser at various 'non-standard'
points ("parse a clause", etc).

(This indicates another advantage with Lisp, of course
:-)

Best,
Thomas


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the erlang-questions mailing list