[erlang-questions] literal character syntax

Loïc Hoguin <>
Fri May 16 16:35:49 CEST 2014


On 05/14/2014 04:32 PM, Björn-Egil Dahlberg wrote:
> On 2014-05-14 16:15, Fred Hebert wrote:
>> I think the argument here is specifically about whitespace characters.
>>
>> For example, using:
>>
>> starts_with([$  | _]) -> space;
>> starts_with([$     | _]) -> tab;
>> starts_with([$
>>   |_]) -> newline.
>>
>> Is currently allowed, but it is arguably clearer to use:
>>
>> starts_with([$\s | _]) -> space;
>> starts_with([$\t | _]) -> tab.
>> starts_with([$\n | _]) -> newline.
>>
>> Vlad here recommends deprecating the former case, while recommending the
>> latter form.
>>
>> I would tend to agree for the sake of readability, but would like a
>> regular deprecation cycle with warnings explaining the recommended
>> changes ("The $<space> form is being deprecated, replace with $\s" or
>> something).
> I like this proposal.
>
> I don't know how fast we could remove $ , $    , etc (earliest 19?) but
> we could certainly emit irritating deprecation warnings that make people
> want to fix their code.

Considering the feedback so far and not everyone being happy about it, 
how about just leaving it in, but add a normal warning and enable it by 
default?

By the way, how does $ behave when used with a unicode character?

-- 
Loïc Hoguin
http://ninenines.eu



More information about the erlang-questions mailing list