[erlang-questions] some language changes

Vlad Dumitrescu <>
Mon May 21 11:18:58 CEST 2007


On 5/21/07, Joe Armstrong <> wrote:
> Now the book is done I've been thinking about some language changes.

Very smart! You enjoyed writing the book, so now you have to prepare
for the second edition! ;-)

> 3. Extended string syntax: idea - put an atom *before the string quote
>     to say what the string means and to *change* the syntax rules that apply
>     to the string content.
>
>      X = C "......"
>           C = a control atom
>
>        X = regexp " ... "
>
>           = html " .... "
>
>          Then we could write regexps and LaTeX inside strings without
>          all the horrible additional quotes

In order to allow unquoted strings, a more general solution would be
something similar to HERE documents in the Unix shell. (in the above,
double quotes still have to be escaped)

Regarding the label prefix, I'm not sure how this could be implemented
without hardcoding a few control atoms... Once the can is open, many
will find uses beyond the original set.

When parsing functions are applied to a constant string, a parse
transform (or the compiler itself) could take care of regexps or
whatever at compile time. And we're closing in on the topic of
metaprogramming again :-)

> 4. Simple string substitutions
>      X = subst "aaa ${P} bbb ${Q} ccc"
>       *means*    X = [<"aaa">, P, <"bbb">, Q, ...]
>      This would be very useful.

Or maybe something like:
    X = io:format("aaa ~{P}p bbb ~{Q}w ccc")
which would be equivalent to
    X = io:format("aaa ~p bbb ~w ccc", [P, Q])

best regards,
Vlad



More information about the erlang-questions mailing list