[erlang-questions] Erlang newbie questions

Tim Watson watson.timothy@REDACTED
Tue Oct 18 12:47:48 CEST 2011


On 18 October 2011 11:07, Håkan Huss <huss01@REDACTED> wrote:

> 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.
>
>
I totally agree, it is not simple in C but as you say, very familiar. I
wasn't trying to say that Erlang syntax is hard, just unfamiliar but once I
learned it I actually now find it totally intuitive.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111018/883fd7c1/attachment.htm>


More information about the erlang-questions mailing list