[erlang-questions] Erlang and syntax.

Bengt Kleberg bengt.kleberg@REDACTED
Sun Feb 23 07:45:30 CET 2014


It would be a major drawback to add unhygenic macros to a programming language.


Sent from Moxier Mail

----- Ursprungligt meddelande -----
Från: Mikhail Gusarov <dottedmag@REDACTED>
Till: Maxim Velesyuk <loz.accs@REDACTED>
Kopia: "erlang-questions@REDACTED" <erlang-questions@REDACTED>
Skickat: 22-02-2014 10:35 em
Ämne: Re: [erlang-questions] Erlang and syntax.

> But when you see unknown function you still have no idea what it does and
> you have to figure it out. Any abstraction works in same way.

There is subtle difference: all functions conform to the function
abstraction: function does not alter/capture names from calling
namespace and function does not arbitrarily transfer control. Function
is a simple abstraction: it accepts arguments and returns result.

As a result, function abstraction allows one to selectively ignore
parts of the code while reading it (which was the driving force behind
structured programming). This luxury is not available to readers of
programs in languages with macros (unhygienic ones), especially if
those don't distinguish macros and functions syntactically.

So, macros are new GOTO statements: they are powerful tool, but power
results in harder-to-understand programs.

Best regards,
Mikhail Gusarov.
erlang-questions mailing list

More information about the erlang-questions mailing list