Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005854OCamlOCaml generalpublic2012-12-14 14:102012-12-14 14:34
Reporterppedrot 
Assigned To 
PrioritynormalSeverityfeatureReproducibilityhave not tried
StatusnewResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0005854: Add a deprecated warning
DescriptionIt would be nice to be able to flag functions as deprecated directly in the source code, so that ocamlc/opt would spit out a warning when using such a function.

This would ease code maintenance a lot.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0008610)
gasche (developer)
2012-12-14 14:34
edited on: 2012-12-14 14:36

I guess it is currently possible to do that by inspection of the .cmt file spit out by the -bin-annot files: traverse AST in the .cmt and check for uses of deprecated functions; to be integrated in your compilation&test toolchain. To declare a function deprecated you could either just give the traverser-tool a list of deprecated functions, or use a hack to embed the annotation as valid OCaml source code (not what I would choose):


deprecate.mli
  type 'a t = 'a

in your code:
  let f = ... in
  ignore (f : _ Deprecate.t);


I'm not sure we want to integrate this ad-hoc feature directly in the language itself -- I'd rather wait until someone comes with a decent pragmas/annotations proposal. In the meantime I think a bin-annot-based tool could suit your needs.


- Issue History
Date Modified Username Field Change
2012-12-14 14:10 ppedrot New Issue
2012-12-14 14:34 gasche Note Added: 0008610
2012-12-14 14:36 gasche Note Edited: 0008610 View Revisions


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker