[erlang-questions] literal character syntax
Wed May 14 16:32:08 CEST 2014
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;
> |_]) -> 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
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.
> On 05/14, Sean Cribbs wrote:
>> They are incredibly useful in pattern-matching simple string arguments. e.g.
>> case erlang:system_info(version) of
>> [$5, $., $1, $0 | _ ] -> ok;
>> _ -> fail
>> On Wed, May 14, 2014 at 4:28 AM, Vlad Dumitrescu <vladdu55@REDACTED> wrote:
>>> I would like to make a suggestion regarding the accepted literal
>>> characters syntax. At the moment, any character following a $ is accepted
>>> as itself. I find it very confusing when these characters are whitespace or
>>> control chars and my suggestion is to refuse these literals. Most of them
>>> have escaped representations and the others should be written as integers
>>> What do you think? Is anyone using these in a meaningful way?
>>> best regards,
>>> erlang-questions mailing list
>> Sean Cribbs <sean@REDACTED>
>> Software Engineer
>> Basho Technologies, Inc.
>> erlang-questions mailing list
> erlang-questions mailing list
More information about the erlang-questions