Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006457OCamlOCaml standard librarypublic2014-06-16 18:142014-06-17 15:35
Reporterfrisch 
Assigned Tofrisch 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusresolvedResolutionopen 
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
(0011749)
gasche (developer)
2014-06-16 19:35

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

I attach a patch that implement it
(0011752)
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/tbl.ml
File "utils/tbl.ml", 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
         CamlinternalFormatBasics.formatting_lit


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

(0011753)
bvaugon (reporter)
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.
(0011756)
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


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker