Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005561OCamlOCaml typingpublic2012-03-27 15:012013-12-05 15:39
Reporterfrisch 
Assigned To 
PrioritylowSeverityfeatureReproducibilityhave not tried
StatusconfirmedResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0005561: Option to disable -principal mode
DescriptionIt would be convenient to add a -noprincipal flag to the compiler. With OMake for instance, it would make it easy to add -principal to OCAMLFLAGS globally for the project, and then append -noprincipal to OCAMLFLAGS for some directories.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0007197)
gasche (developer)
2012-03-27 16:53

So you would call `ocamlc -principal -noprincipal` or `ocamlc -noprincipal -principal`, and expect it to disable principality checks? That looks a little weird to me (I like to think that command-line arguments are declarative rather than imperative).
(0007198)
frisch (developer)
2012-03-27 17:05

The last option would take precedence, as for warnings. I find it quite convenient to be able to define a "OCAMLFLAGS" globally, and adapt it locally for specific files or directories, by appending some extra options.
(0007228)
protz (manager)
2012-03-29 10:53

What about an optional parameter after -principal?
* -principal ? current behavior
* -principal yes ? current behavior
* -principal no ? overrides any previous values for the argument.

That sounds like a valid use-case for a big codebase.
(0007229)
gasche (developer)
2012-03-29 11:10

Regarding the interface, I rather prefer Alain's proposal.

The change would however raise the question of doing this for other options: -norectypes, -nostrict-sequence, -stdlib, -assert, -nounsafe... (But we already have -nolabels and -labels that (if I understand correctly) do are not inverse one of another.)

I'm not sure the case for warning makes for a good precedent (no pun intended), but if it's decided to add -noprincipal I really don't see why we shouldn't have -norectypes as well.
(0007231)
frisch (developer)
2012-03-29 11:18

-rectypes is quite viral: if you compile a module with it, you need to compile all other modules that depend on it with -rectypes as well. So it's rather unlikely that -rectypes would be the default for a big project, with some "-norectypes" exceptions.

I also don't expect -unsafe to be the default for a big code base. It could be turned on for performance-critical and carefully verified code (but in my experience, it has a rather low impact, so I'm not even sure it is used at all).

A -nostrict-sequence would probably make sense.

- Issue History
Date Modified Username Field Change
2012-03-27 15:01 frisch New Issue
2012-03-27 16:53 gasche Note Added: 0007197
2012-03-27 17:05 frisch Note Added: 0007198
2012-03-29 10:53 protz Note Added: 0007228
2012-03-29 10:53 protz Status new => acknowledged
2012-03-29 11:10 gasche Note Added: 0007229
2012-03-29 11:18 frisch Note Added: 0007231
2012-06-20 11:19 frisch Category OCaml general => OCaml typing
2013-12-05 15:39 doligez Status acknowledged => confirmed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker