Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006429OCamlOCaml standard librarypublic2014-05-17 07:472014-08-18 18:22
Reporterwhitequark 
Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusconfirmedResolutionopen 
PlatformOSOS Version
Product Version 
Target Version4.02.1+devFixed in Version 
Summary0006429: A format specifier for bytes
DescriptionWithout 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").
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0011510)
gasche (developer)
2014-05-17 07:59

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.
(0011511)
whitequark (reporter)
2014-05-17 08:03

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.
(0011512)
gasche (developer)
2014-05-17 08:32

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.
(0011536)
doligez (administrator)
2014-05-21 17:31

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.

- Issue History
Date Modified Username Field Change
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


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker