[erlang-questions] some language changes

Kostis Sagonas kostis@REDACTED
Mon Jun 4 23:31:03 CEST 2007


Corrado Santoro wrote:
> 
>> The only clean way to do that would be to introduce proper variable 
>> scoping, but that is a big change, both syntax and semantics.
> ...uhmmmm.... but how can you do "A = A + 1" using variable scoping?? 

I think you've misunderstood what Robert was referring to.  I think he 
is thinking of something similar to ML's let which provides proper scope 
for variables.

> Maybe introducing a syntax which is more and more hard than "A1 = A + 1"?

Of course we are approaching issues of taste here, but something like

   foo(A) ->
      let B =
         let
	   A = A + 1
         in
	   bar(A)
         end,
      in
         baz(A, B)
      end.

is obviously considerably more verbose, but not necessarily harder (to 
write or understand) than:

   foo(A) ->
      A1 = A + 1,
      B = bar(A1),
      baz(A1, B).

Kostis



More information about the erlang-questions mailing list