Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006688OCaml~DO NOT USE (was: OCaml general)public2014-12-03 10:502016-12-07 11:37
Assigned Tofrisch 
PrioritynormalSeverityminorReproducibilityhave not tried
PlatformOSOS Version
Product Version 
Target VersionFixed in Version4.03.0+dev / +beta1 
Summary0006688: Accept value declarations as structure items
DescriptionI propose to let the parser accept value declarations (val x : ...) as valid syntactic structure items. They can already be encoded in the Parsetree (as Pstr_primitive, which takes a value_description argument), so the impact on the code (Ast_helper, Ast_mapper, print_ast, etc) is minimal.

Such declarations would be rejected by the type-checker, but later, one could give interesting meaning to them (e.g. to specify locally the expected type scheme for a value definition; or even support local forward declarations). The reason to add them now is to give more freedom to what can go into an extension/attribute payload, cf 0006681.

(It would also make sense to rename Pstr_primitive to Pstr_value, but then this impacts more existing code.)

A patch is attached. In addition to it, one should get rid of the following comment in parsetree.mli:

  "Note: when used under Pstr_primitive, prim cannot be empty"
TagsNo tags attached.
Attached Filesdiff file icon str_val.diff [^] (3,586 bytes) 2014-12-03 10:51 [Show Content]

- Relationships
related to 0006681closedfrisch Signatures as ppx payload 
related to 0006698resolvedfrisch allow @@ocaml.deprecated on structure items? 
related to 0006703acknowledged Allow to specify the type of defined values with "val" declarations 

-  Notes
frisch (developer)
2014-12-10 14:38

A similar patch has been pushed to trunk (it relies on a "in_signature" flag stored in typing environments).

- Issue History
Date Modified Username Field Change
2014-12-03 10:50 frisch New Issue
2014-12-03 10:51 frisch Description Updated View Revisions
2014-12-03 10:51 frisch Relationship added related to 0006681
2014-12-03 10:51 frisch File Added: str_val.diff
2014-12-03 10:52 frisch Description Updated View Revisions
2014-12-03 11:01 frisch Description Updated View Revisions
2014-12-10 14:26 frisch Relationship added related to 0006698
2014-12-10 14:38 frisch Note Added: 0012759
2014-12-10 16:13 frisch Relationship added related to 0006703
2014-12-10 16:13 frisch Status new => resolved
2014-12-10 16:13 frisch Fixed in Version => 4.03.0+dev / +beta1
2014-12-10 16:13 frisch Resolution open => fixed
2014-12-10 16:13 frisch Assigned To => frisch
2016-12-07 11:37 xleroy Status resolved => closed
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-03-03 17:55 doligez Category -OCaml general => -(deprecated) general
2017-03-03 18:01 doligez Category -(deprecated) general => ~deprecated (was: OCaml general)
2017-03-06 17:04 doligez Category ~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general)

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker