[erlang-patches] Enhancement of erl_prettypr

Serge Aleynikov serge@REDACTED
Tue Dec 4 17:16:23 CET 2012


Could you elaborate a little on why what the patch does it wrong?  I.e.
why representing binaries in a human-readable form is wrong?

On 12/4/2012 5:58 AM, Henrik Nord wrote:
> Hi
> 
> We have decided to drop this patch.
> 
> we will also remove similar behaviour from erl_pp (which is the OTP
> equivalent to erl_prettypr), It does the wrong thing, and it does it in
> the wrong way at this moment.
> 
> 
> 
> Thank you for your contribution!
> 
> 
> 
> On 10/16/2012 06:23 PM, Serge Aleynikov wrote:
>> Enhancement of erl_prettypr to print binaries in human-readable form.
>>
>>     git fetch git@REDACTED:saleyn/otp.git erl_prettypr
>>
>>     https://github.com/saleyn/otp/compare/erl_prettypr
>>     https://github.com/saleyn/otp/compare/erl_prettypr.patch
>>
>> Given an abstract syntax form of a binary, such as:
>>
>> 1> Form = erl_syntax:form_list(element(2, erl_parse:parse_exprs(
>>     element(2, erl_scan:string(
>>
>> "<<84,104,105,115,32,105,115,32,97,32,98,105,110,97,114,121,10>>."))))).
>>
>> Before applying the patch the output of erl_prettypr:format/1 looks like
>> this:
>>
>> 2> erl_prettypr:format(Form).
>> "<<84, 104, 105, 115, 32, 105, 115, 32, 97, 32, 98, 105,\n  110, 97,
>> 114, 121, 10>>"
>>
>> After applying the patch the output looks like this:
>>
>> 3> erl_prettypr:format(Form).
>> "<<\"This is a binary\\n\">>"
>>
>> The human-readable printing occurs only if erl_prettypr finds out that
>> the binary represents a printable list.
>>
>> Regards,
>>
>> Serge
>> _______________________________________________
>> erlang-patches mailing list
>> erlang-patches@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-patches
> 



More information about the erlang-patches mailing list