[erlang-questions] Strange problems with modifying records with matched maps on 17.4

Max Lapshin <>
Tue Mar 24 12:21:39 CET 2015


https://gist.github.com/maxlapshin/a95d8a27ce93221d883a

when I match map in record:

modify(#r1{map_data = #{count := Cnt} = M}=R1) ->

I get badarg when modify record in the end of function.

I've attached two files looking similar in the gist.




When I launch first, I get badarg with the line of function header:

erl -s map_test1 main

Erlang/OTP 17 [erts-6.3] [source] [64-bit] [smp:4:4] [ds:4:4:10]
[async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Created: {r1,#{count => 1},0}

{"init terminating in
do_boot",{badarg,[{map_test1,modify,1,[{file,"map_test1.erl"},{line,11}]},{map_test1,main,0,[{file,"map_test1.erl"},{line,8}]},{init,start_it,1,[]},{init,start_em,1,[]}]}}


when I launch second, it works (but makes useless work).


Is it a known bug? Or maybe it is not a bug, but just my misunderstanding?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150324/16130d05/attachment.html>


More information about the erlang-questions mailing list