Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006367OCamlOCaml typingpublic2014-04-12 08:392015-03-27 15:05
Reportergasche 
Assigned Togarrigue 
PrioritynormalSeveritytweakReproducibilityN/A
StatusassignedResolutionfixed 
PlatformOSOS Version
Product Version4.02.0+dev 
Target Version4.03.0+devFixed in Version4.03.0+dev 
Summary0006367: [github patch] introduce Asttypes.arrow_flag to encode labelled arguments (instead of using string manipulations)
Descriptionhttps://github.com/ocaml/ocaml/pull/25 [^]

This commit introduce the type arrow_flag in place of string to represent labelled arguments.

Previously, labelled arguments where encoded as a string tagging the left hand-side of an arrow type:
"" is the absence of label, "?ident" for optional arguments, "ident" for labelled arguments.

The arrow_flag variant now brings more structure to function arguments.
The purpose is two fold: offers a proper encoding of labels rather than relying on string processing, and ease further extensions of arrow lhs.
Tagsgithub, patch
Attached Files

- Relationships
related to 0006611resolvedgarrigue Do something with *predef*.option 

-  Notes
(0012815)
gasche (developer)
2014-12-14 23:07

Some people wondered about the status of this PR:
in https://github.com/ocaml/ocaml/pull/25, [^] Jacques suggested that he was willing to integrate the change, but probably with a re-implementation rather than a direct merge.

I think this is an important change as it makes further experiments (eg. modular-implicits and https://github.com/ocaml/ocaml/pull/126 [^] ) easier.
(0012930)
garrigue (manager)
2014-12-22 09:47

Committed in trunk at revision 15737.

type arg_label =
    Nolabel
  | Labelled of string (* label:T -> ... *)
  | Optional of string (* ?label:T -> ... *)
(0012931)
garrigue (manager)
2014-12-22 09:47

Note that camlp4 needs to be modified too...
(0012985)
def (reporter)
2014-12-24 17:50

Minor thing: it seems to me that Typedtree.optional type is made redundant by the stronger typing of labels.

In particular:
- in Translcore, tests on optional can be replaced by matching on the arg_label.
- Typecore can be simplified by removing tracking of Optional/Required label
(0013578)
frisch (developer)
2015-03-27 15:05

Shouldn't we take this opportunity to clean up Pexp_fun, which seems a little bit weird, with an "expression option" argument that can be non-None only when the arg_label is Optional. We could introduce another type:

 type fun_label =
    | Nolabel
    | Labelled of string
    | Optional of string * expression option
 
and replace the two first arguments of Pexp_fun/Pcl_fun with one of this type.
(0013579)
frisch (developer)
2015-03-27 15:05

I re-open in order not to forget the previous notes.

- Issue History
Date Modified Username Field Change
2014-04-12 08:39 gasche New Issue
2014-04-12 08:40 gasche Tag Attached: github
2014-04-12 08:40 gasche Tag Attached: patch
2014-04-12 08:42 gasche Severity minor => tweak
2014-07-16 16:03 doligez Status new => confirmed
2014-07-16 16:03 doligez Target Version => 4.02.0+dev
2014-08-18 20:49 doligez Target Version 4.02.0+dev => 4.02.1+dev
2014-09-04 00:25 doligez Target Version 4.02.1+dev => undecided
2014-09-15 09:50 doligez Target Version undecided => 4.03.0+dev
2014-12-14 23:07 gasche Note Added: 0012815
2014-12-14 23:07 gasche Assigned To => garrigue
2014-12-14 23:07 gasche Status confirmed => assigned
2014-12-22 09:47 garrigue Note Added: 0012930
2014-12-22 09:47 garrigue Status assigned => resolved
2014-12-22 09:47 garrigue Fixed in Version => 4.03.0+dev
2014-12-22 09:47 garrigue Resolution open => fixed
2014-12-22 09:47 garrigue Note Added: 0012931
2014-12-22 10:07 garrigue Relationship added related to 0006611
2014-12-24 17:50 def Note Added: 0012985
2015-03-27 15:05 frisch Note Added: 0013578
2015-03-27 15:05 frisch Note Added: 0013579
2015-03-27 15:05 frisch Status resolved => assigned


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker