[erlang-questions] printed maps look confusing

Björn-Egil Dahlberg egil@REDACTED
Mon Feb 3 15:06:19 CET 2014


On 2014-02-03 14:58, Loïc Hoguin wrote:
> Removing the spaces doesn't work at all. Example:
>
> #{<<"hello">>=><<"bye">>}
>
> Adding a space after the comma is OK but when pretty printing over 
> lines of 80 characters it's going to make things a lot worse.
>
> The current solution sounds best to me. Just gotta get used to it.

The current behaviour mimics records pretty-printing:

Eshell V6.0  (abort with ^G)
1> rr(file).
[file_descriptor,file_info]
2> file:read_file_info("README.md").
{ok,#file_info{size = 3026,type = regular,
                access = read_write,
                atime = {{2014,1,28},{15,17,52}},
                mtime = {{2013,12,17},{16,23,55}},
                ctime = {{2013,12,17},{16,23,55}},
                mode = 33204,links = 1,major_device = 64515,
                minor_device = 0,inode = 927942,uid = 573,gid = 10}}


// Björn-Egil

>
> On 02/03/2014 02:44 PM, Vlad Dumitrescu wrote:
>> Hi!
>>
>> The default format for printing maps puts no space after the comma, but
>> only around the =>. The result looks confusing to me.
>>
>> #{2 => 3,4 => 5}
>>
>> 3 and 4 look more related than 2 and 3 or 4 and 5.
>>
>> Fixing this is a bit more job than adding a space, unless one wants to
>> add them to lists and tuples too. Removing the spaces around the arrow
>> doesn't look too nice either.
>>
>> I can write a patch, but what is the best solution?
>>
>> regards,
>> Vlad
>>
>>
>>
>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>




More information about the erlang-questions mailing list