Crystal: How to get normal/clean numerical output display?

Created on 28 Aug 2018  路  2Comments  路  Source: crystal-lang/crystal

I raised this issue when this "problem" occurred with release 0.24.1 but I really need to know how to get around/fix it.

This code:

x = "73376604975172941348239581622402173809".to_big_i
print "factors  of #{x} are: "; print " => ", tm { print '\n', x.factors }
puts

currently produces this output for versions > 0.23.1

factors of 73376604975172941348239581622402173809 are: 
[[3_big_i, 1], [127_big_i, 1], [2388286630369_big_i, 1], [80639196284734379234981_big_i, 1]] => 00:00:00.118

I don't want numerical type references in my output display. What do I have to do so the output displays normal/clean numerical values?

factors of 73376604975172941348239581622402173809 are: 
[[3, 1], [127, 1], [2388286630369, 1], [8063919628473437923498, 1]] => 00:00:00.118
bug stdlib

Most helpful comment

Proposal:

What about leaving type suffix in the PrettyPrint pp/pp! but removing them in the normal inspect.

When I have doubt and want to double check the type information with a print-debugging I use pp. And when I want a more human friendly output using p/puts/print should be enough.
This will leave puts array without suffix, but pp! array will have the type suffix.

I still found it a bit to noisy also the suffix and it does not gives information of the union that might hold that data. So I sometimes might use pp!({x, x.class, typeof(x)}) to get all the information I need.

All 2 comments

Proposal:

What about leaving type suffix in the PrettyPrint pp/pp! but removing them in the normal inspect.

When I have doubt and want to double check the type information with a print-debugging I use pp. And when I want a more human friendly output using p/puts/print should be enough.
This will leave puts array without suffix, but pp! array will have the type suffix.

I still found it a bit to noisy also the suffix and it does not gives information of the union that might hold that data. So I sometimes might use pp!({x, x.class, typeof(x)}) to get all the information I need.

Closed in #7525

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oprypin picture oprypin  路  3Comments

jhass picture jhass  路  3Comments

ArthurZ picture ArthurZ  路  3Comments

relonger picture relonger  路  3Comments

costajob picture costajob  路  3Comments