[erlang-questions] bug: Can't have variables in keys?

Ahmad Baitalmal <>
Sun Apr 27 19:28:04 CEST 2014


On 02/22/2014 10:02 PM, Charles Irvine wrote:
> I suppose that this is a known bug…..
> 
> 9> X = x.
> x
> 10> #{X => y}.
> # 1: illegal use of variable ‘X’ in map


I got around this by using maps:from_list

1> A = "Variable".
"Variable"
2> MyMap = maps:from_list([{A,"Value"}]).
#{"Variable" => "Value"}

I'm hoping this gets fixed soon. We use it for JSON<->Maps a lot.
_____
Ahmad
BitBuilder.com



More information about the erlang-questions mailing list