[erlang-questions] Erlang Syntax - again

Ladislav Lenart lenartlad@REDACTED
Tue Mar 11 10:02:02 CET 2008


Yariv Sadan wrote:
> Hi Robert,
> 
> I think the "issues" with Erlang's syntax are quite overblown. They
> took me about a day to master and I hardly notice any of them when I'm
> actually writing and editing code. I certainly don't want Erlang to
> look any more like Java/C than it does now. I'm pretty happy with the
> Erlang syntax (I also think that LFE provides a very interesting
> option for those who are curious about Lisp :) )
> 
> The main change I would like to see is to have the compiler
> automatically infer the types of record variables (when possible) to
> shorten the amount of code required for accessing their properties. I
> created an unfinished solution here:
> http://code.google.com/p/recless/. This page has a couple of examples
> for how it could be used.
> 
> I would also like to be able to overload macro names with different
> arities and to have some mechanism for introspecting the properties of
> records and accessing them dynamically at runtime.

This is almost what I was about to write (except that I don't have partial
solution to the problem :-)

For me, the syntax is still a bit too noisy. Whenever I write a module and
compile it I have two or three comile-error cycles on errors that wouldn't
be there if the syntax was a little bit different. But as many pointed out
this is not a big deal really.

But what I would like to have in Erlang is definitely better introspection /
reflection capabilities. I would like to have records as runtime structures,
so I could write:

   Var#{x = foo, y = bar}

where Var could be any record that has slots x and y (it might have others),
record_info would be a normal function that can operate on variables.

I would also very much like to be able to programmatically create/inspect/modify
receive (and other) clauses at runtime. But this is just wishful thinking I think.

Ladislav Lenart





More information about the erlang-questions mailing list