[erlang-questions] LFE syntax, was Leex - a lexical anaylzer generator, released
Robert Virding
rvirding@REDACTED
Wed May 28 01:14:06 CEST 2008
2008/5/27 zambal <zambal@REDACTED>:
> On May 26, 5:10 pm, "Robert Virding" <rvird...@REDACTED> wrote:
> > These are taken from Scheme R6RS and will most likely go as LFE has no
> use
> > for them.
> >
> > #' #` #, #,@ are for use in syntax-case macros and mean:
> >
> > #' - (syntax ...)
> > #` - (quasisyntax ...)
> > #, - (unsyntax ...)
> > #,@ - (unsyntax-splicing ...)
> >
> > #; - comment out next sepxr which could actually be useful
>
> Thanks for clearing that up. If I understand you correctly these
> things provide nothing that you can't do with LFE's macro form, right?
Well, at the moment they don't provide anything. The code to handle doesn't
exist. :-) And it probably never will, at least not in LFE. They are part of
the syntax-case macro handling in Scheme and provide something like normal
lisp backquote but wrapped in Schemes hygienic macro handling.
You can almost everything using LFE macros but without a gensym it is no
really safe. It looks like I will have to add it.
> Also I missed #| ... |# for block comments. Might also be useful. Question
> > is if block comments are token or character based?
>
> Actually, I haven't missed them at all. The only use case for me is
> when pasting some text from an external source in my code, which
> doesn't happen a lot.
I don't miss them either but some people like them. And if you have them you
can have long arguments on whether they should be token or character based,
and whether they should nest or not. -) I think the erlang-questions can do
without it.
> Glad you enjoy LFE.
>
> Yeah, I have lot's of fun with it, especially it's macro
> functionality. Speaking of which, as far as I know it's currently not
> possible to export a macro in a module, so that it's usable in other
> modules. Is such functionality planned for a future release of LFE, if
> possible at all (or desirable, I haven't thought a lot about the
> consequences)?
At present macros are not exported, the only solution today is to put them
in a separate file and include them with (include-file ...). You can also
slurp them into the shell. This is pretty much like you do in Erlang today.
It wouldn't be too difficult to define a way to export them and have the
macro expander check for their existence at macro expand time. It is a
possible new feature for the next release. You would have to be a bit sneaky
as their is no real support for macros in Erlang, it would be difficult to
integrate them as seamlessly as in Lisp.
Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080528/1214ac8b/attachment.htm>
More information about the erlang-questions
mailing list