Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006457OCamlstandard librarypublic2014-06-16 18:142015-12-11 19:28
Assigned Tofrisch 
PrioritynormalSeverityminorReproducibilityhave not tried
PlatformOSOS Version
Product Version 
Target VersionFixed in Version4.02.0+dev 
Summary0006457: Distinguish data and literals in CamlinternalFormat.make_printf
DescriptionThis function is useful to create custom formatting libraries (e.g. replacement for Format, with a different layout model and syntax for formatting instructions). One problem with it is that the callback cannot distinguish between string literals in the format strings and strings obtained from printed arguments. It seems very simple to split the Acc_string into two constructors (Acc_data_string/Acc_string_literal), and same for Acc_char. They will always be treated in the same way by the current code (for Printf and Format), but a custom formatting library would typically only recognize formatting markers in Acc_string_literal not Acc_data_string.
TagsNo tags attached.
Attached Filesdiff file icon add-acc-literal.diff [^] (14,867 bytes) 2014-06-17 01:50 [Show Content]

- Relationships

-  Notes
gasche (developer)
2014-06-16 19:35

(We discussed this with Alain and BenoƮt and I agree this is a good idea.)
bvaugon (developer)
2014-06-17 01:51

I attach a patch that implement it
frisch (developer)
2014-06-17 09:30
edited on: 2014-06-17 09:30

Applying the patch on 4.02 leads to:

boot/ocamlrun boot/ocamlc -nostdlib -I boot -strict-sequence -w +33..39+48 -warn-error A -bin-annot -safe-string 
-I utils -I parsing -I typing -I bytecomp -I asmcomp -I driver -I toplevel -c utils/
File "utils/", line 110, characters 33-54:
Error: The constructor CamlinternalFormatBasics.Open_box
       belongs to the variant type CamlinternalFormatBasics.formatting_gen
       but a constructor was expected belonging to the variant type

Probably some bootstrapping issue. What's the bootstrap procedure when something changes in CamlinternalFormatBasics?

bvaugon (developer)
2014-06-17 11:01

Since this patch do not modify CamlinternalFormatBasics, it should work directly without special bootstrap procedure. This patch (add-acc-literal.diff) seems to work on a proper checkout of the trunk.

Your compilation problems about Open_box probably comes from the 0006418 patches. The bootstrap procedure for the 0006418 patches is in fact a bit complicated since it modifies the format6 & co. type declarations. It is described in its own attached file howto-apply-fix-open-tag-patches.txt.
frisch (developer)
2014-06-17 12:04

Ah yes, sorry. I've committed your patch to 4.02 (rev 14988). Thanks for the quick reaction!

- Issue History
Date Modified Username Field Change
2014-06-16 18:14 frisch New Issue
2014-06-16 19:35 gasche Note Added: 0011749
2014-06-16 19:35 gasche Status new => acknowledged
2014-06-17 01:50 bvaugon File Added: add-acc-literal.diff
2014-06-17 01:51 bvaugon Note Added: 0011750
2014-06-17 09:30 frisch Note Added: 0011752
2014-06-17 09:30 frisch Note Edited: 0011752 View Revisions
2014-06-17 11:01 bvaugon Note Added: 0011753
2014-06-17 12:04 frisch Note Added: 0011756
2014-06-17 15:35 frisch Assigned To => frisch
2014-06-17 15:35 frisch Status acknowledged => resolved
2014-06-17 15:35 frisch Fixed in Version => 4.02.0+dev
2015-12-11 19:28 xleroy Status resolved => closed
2017-02-23 16:43 doligez Category OCaml standard library => standard library

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker