|Anonymous | Login | Signup for a new account||2014-09-20 14:02 CEST|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0006429||OCaml||OCaml standard library||public||2014-05-17 07:47||2014-09-15 21:29|
|Priority||normal||Severity||minor||Reproducibility||have not tried|
|Target Version||after-4.02.1||Fixed in Version|
|Summary||0006429: A format specifier for bytes|
|Description||Without a %S-like format specifier for Bytes, debugging becomes extremely annoying--the code is littered with bogus conversions everywhere. Perhaps it's possible to provide one?|
It also makes sense to provide its non-escaped equivalent as well ("%s").
|Tags||No tags attached.|
|I have no idea of what a good syntax would be. My only idea would be to reuse "%#s" (currently considered as "%s", but planning-to-be-outlawed in 4.02 as it doesn't mean anything), and it's mediocre at best.|
|Well, you could disambiguate the conflict with %b/%B by using the second letter: %y/%Y, in the same way as e.g. options for Unix tools are disambiguated. This is what I would expect, at least.|
Note that in the meantime, we could make sure that
"%a" Bytes.print by
"%a" Bytes.to_string by
works (by adding the relevant functions if need be for some *printf function), which would already have reasonable readability.
While we decide which letter to use, you should use this for debugging without too much pain:
let (!!) = Bytes.unsafe_to_string;;
Printf.printf "hello %s\n" !!my_byte_sequence;;
For the letter, I think Y is a good candidate. My first idea was Z but we might want to use that for bignums at some point in the future.
As for %#s, that would make the type depend on the format's flags rather than the letter. A very bad idea.
|2014-05-17 07:47||whitequark||New Issue|
|2014-05-17 07:59||gasche||Note Added: 0011510|
|2014-05-17 08:03||whitequark||Note Added: 0011511|
|2014-05-17 08:32||gasche||Note Added: 0011512|
|2014-05-21 17:31||doligez||Note Added: 0011536|
|2014-05-21 17:32||doligez||Status||new => confirmed|
|2014-05-21 17:32||doligez||Target Version||=> 4.02.0+dev|
|2014-08-18 18:22||doligez||Target Version||4.02.0+dev => 4.02.1+dev|
|2014-09-04 00:25||doligez||Target Version||4.02.1+dev => undecided|
|2014-09-15 21:29||doligez||Target Version||undecided => after-4.02.1|
|Copyright © 2000 - 2011 MantisBT Group|