[erlang-questions] Erlang newbie questions

Håkan Huss huss01@REDACTED
Tue Oct 18 12:07:40 CEST 2011


On Tue, Oct 18, 2011 at 11:07, Tim Watson <watson.timothy@REDACTED> wrote:
>>
>> Is the Erlang language itself still evolving? The reason I ask is that the
>> fellow that did CouchDB posted a blog entry about the things he encountered
>> while developing CouchDB. What was interesting to me is how, even after a
>> short time with the language, many of the issues he mentioned immediately
>> rang true with me. For example, what is the benefit of the "; , ."
>> terminators as opposed to a single terminator approach?
>>
>
> Whilst the core syntax of the language is unlikely to change in the near
> future, many new language features are appearing all the time! The "; , ."
> thing got me for a little while, as coming from Python and OCaml I was used
> to indentation and block termination keywords (e.g., "end") and of course
> the C-like languages that use only ";" everywhere.

Well, saying that C-like languages use ";" everywhere is a slight
over-simplification. The C standard lists the following punctuators:

[ ]  ( )  { }  .  ->
++  --  &  *  +  -  ~  !
/  %  <<  >>  <  >  <=  >=  ==  !=  ^  |  &&  ||
?  :  ;  ...
=  *=  /=  %=  +=  -=  <<=  >>=  &=  ^=  |=
,  #  ##
<: :>  <% %>  %:  %:%:

Even if we only look at expression/statement separators, the list
would need to include ";" (which is a terminator in most cases, but a
separator in for loop heads), "," (which is used as a separator, but
can be used as a terminator in initializations of e.g., arrays), "?"
and ":" (which are used as separators in a very specific case), "\n"
(which is significant as a terminator in macro definitions) and of
course {} (which are used for grouping except when they are actually
mandated by syntax whether they group something or not, and which may
or may not negate the need for a terminating ";").

To say that C-like languages have simple punctuation is wrong.
(Believe me, I have taught C to students who have no experience with
C-like languages.) You may be used to that punctuation so it feels
natural to you, but simple it is not.

With regards to Erlang I have taught Erlang to beginners as well, so I
know that it is confusing in Erlang as well. But I do not feel it is
harder to learn in Erlang than in C-like languages.

Regards,
/Håkan



More information about the erlang-questions mailing list