[erlang-bugs] Negative integer literals as map keys

Björn-Egil Dahlberg wallentin.dahlberg@REDACTED
Sun May 4 16:47:08 CEST 2014


I would like to clarify.

Using non-values as keys in Maps will not work, it is a known current
limitation.

A negative integer is not a value from the compilers perspective, it is a
unary *expression*. The same goes for using a plus sign in front of
integers.

This will be fixed when expressions are allowed.


2014-04-30 16:09 GMT+02:00 Björn-Egil Dahlberg <egil@REDACTED>:

>  Yep, the linter is a bit harsh here. It's suppose to deny all non-value
> keys, which technically is what it does here .. but it is a bit harsh.
>
> I'll look at it.
>
> // Björn-Egil
>
>
> On 2014-04-30 15:32, Alexey Lebedeff wrote:
>
>  Hi,
>
>  As soon as I add unary minus anywhere in a map key, it breaks with
> "illegal map key" message:
>
>  Erlang/OTP 17 [erts-6.0] [source-07b8f44] [64-bit] [smp:8:8]
> [async-threads:10] [hipe] [kernel-poll:false]
>  Eshell V6.0  (abort with ^G)
>  3> #{ -1 => 1}.
>  * 1: illegal map key
> 4> #{ {a, -1} => 1 }.
> * 1: illegal map key
>
>
>
> _______________________________________________
> erlang-bugs mailing listerlang-bugs@REDACTED://erlang.org/mailman/listinfo/erlang-bugs
>
>
>
> _______________________________________________
> erlang-bugs mailing list
> erlang-bugs@REDACTED
> http://erlang.org/mailman/listinfo/erlang-bugs
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20140504/5f4ec51c/attachment.htm>


More information about the erlang-bugs mailing list