[erlang-questions] Lisp syntax for Erlang

denis dloutrein.lists@REDACTED
Tue Dec 4 01:17:33 CET 2007


>  - How do I write the equivalent of Mod:fun( ... )? I can't use (Mod:fun ... ) see below.

you can't use (Mod:fun ...) but you can use (remote-call...) for
instance, or (apply ...) or whatever name for this case. I find the
name remote-call disturbing because I immediatly think of a remote
call on another node. Maybe (module-call...) would be less confusing ?

>  - How do I parse mod:fun? This is a fundamental question as the relationship between code and data in lisp is 1-to-1. Parsed code *is* just its sexpr, there is no difference. This is one reason why it is so easy to manipulate code, for example by macros. Erlang code is has no such direct coupling to data. This fine if you going to compile the code, but it makes it more difficult to manipulate it. The problem is what do I parse mod:fun to?

What I would do is keep it as a symbol, I mean 'mod:fun'. This is just
a symbol like another, and when the evaluator (or the compiler) found
it in the first parameter of the form (so it's should be a function
call), it detect the ':' and knows that it have to do a remote call.
Ok, it sounds a little bit crap :-)
Another possibity is to let the reader expand (mod:fun...) into
(remote-call mod fun) or (: mod fun) or manage it with a reader macro.
But we loose the possibility of having an internal representation in
the form (mod:fun..). At least to my understanding of the lisp reader.

On another side, do you have an idea of how you'll represent a tuple,
and do pattern matching for functions ?

I'm interested by you project, please keep-up informed  ;-)
I had started something similar, but my background in the subject is
quite light :-)
Thanks

Denis



More information about the erlang-questions mailing list