[erlang-questions] literal character syntax

Richard Carlsson carlsson.richard@REDACTED
Thu May 15 15:06:25 CEST 2014

On 2014-05-15 14:38 , Kostis Sagonas wrote:
> [Aside: Just for my information, is there some escape-like way of
> writing the single quote character?]

The backslash works on any character. If there's no special meaning, as 
for \n, \t, etc., it just uses the character verbatim (including
the backslash itself). Hence, $\' == $', '\'' is the atom containing one 
single-quote, and "\\" is the string containing a single backslash. This 
could be used to get around problems in some editors (though it seems to 
me that Emacs does the right thing anyway with $' these days).

Btw., the \s for space was my contribution, way back when Barklund was 
working on the Standard Erlang draft. I always thought that it was a bad 
idea to use invisible characters for potentially important details. 
E.g., in C, a space literal is ' ' (unless you want to write it in octal 
as '\040').


More information about the erlang-questions mailing list