<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 2, 2015 at 8:04 AM, Björn Gustavsson <span dir="ltr"><<a href="mailto:bjorn@erlang.org" target="_blank">bjorn@erlang.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Sun, Feb 1, 2015 at 9:47 AM, Sergej Jurecko <<a href="mailto:sergej.jurecko@gmail.com">sergej.jurecko@gmail.com</a>> wrote:<br>
> Tested in 17.3 and 17.4<br>
><br>
> Incorrect behavior 1:<br>
><br>
> -record(ev,{info}).<br>
> test() -><br>
> test(#ev{info = #{type => dir, name => "My folder"}}).<br>
> test(#ev{info = #{type := dir} = I} = E) -><br>
> io:format("E = ~p~n",[E]),<br>
> io:format("E#<a href="http://event.info" target="_blank">event.info</a> = ~p~n",[E#<a href="http://ev.info" target="_blank">ev.info</a>]),<br>
> io:format("I = ~p~n",[I]).<br>
><br>
> Calling test/0 will print:<br>
> E = {ev,#{name => "My folder",type => dir}}<br>
> E#<a href="http://event.info" target="_blank">event.info</a> = #{type => dir}<br>
> I = #{name => "My folder",type => dir}<br>
><br>
> Why is E#<a href="http://event.info" target="_blank">event.info</a> without name field?<br>
><br>
<br>
</span>The behaviour is the expected.<br>
<br>
Records are compile-time construct that are translated<br>
to tuples. So at run-time the record is a tuple and<br>
will be printed as a tuple.<br>
<span class=""></span></blockquote><div><br><br></div><div>Yes but E#<a href="http://event.info">event.info</a> value is not a record. It is a map which should contain #{type => dir, name => "My folder"}, yet when trying to extract that record we only get #{type => dir}. <br><br></div><div>E#<a href="http://event.info">event.info</a> should be the same as I, yet it is not.<br><br><br>Sergej<br></div></div></div></div>