Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

formats: enable the legacy mode by default

Given that there still remains a small incompatibility (typing of
%(..%)), I decided to keep the legacy mode enabled for now. This means
that any failure related to format can be traced to this
incompatiblity (or unknown regressions), which will simplify the
monitoring and handling of changes considerably. As soon as the %(..%)
typing is generalized, we can turn the legacy mode off (or maybe
simply add warnings for ignored formats).

git-svn-id: f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information...
commit eccf1e2975c7664540ce2090500d4261c5d8b283 1 parent f0e39fe
@gasche gasche authored
Showing with 13 additions and 2 deletions.
  1. +13 −2 stdlib/
15 stdlib/
@@ -1,7 +1,18 @@
open CamlinternalFormatBasics
-let legacy_behavior =
- try Sys.getenv "OCAML_LEGACY_FORMAT" <> "" with _ -> false
+let legacy_behavior = true
+(** When this flag is enabled, the format parser tries to behave as
+ the <4.02 implementations, in particular it ignores most benine
+ nonsensical format. When the flag is disabled, it will reject any
+ format that is not accepted by the specification.
+ A typical example would be "%+ d": specifying both '+' (if the
+ number is positive, pad with a '+' to get the same width as
+ negative numbres) and ' ' (if the number is positive, pad with
+ a space) does not make sense, but the legacy (< 4.02)
+ implementation was happy to just ignore the space.
(* Tools to manipulate scanning set of chars (see %[...]) *)

0 comments on commit eccf1e2

Please sign in to comment.
Something went wrong with that request. Please try again.