Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003688OCamlCamlp4public2005-06-17 00:382014-05-25 20:20
Reporteradministrator 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusacknowledgedResolutionopen 
PlatformOSOS Version
Product Version 
Target Version4.02.0+devFixed in Version 
Summary0003688: 3 documentation suggestions and 5 camlp4 problems
DescriptionHi,

during my work on the quotations in original syntax I noticed
several small problems in the documentation and in Camlp4. I
thought I just report all of them for the record.

Ocaml documentation:

1. The bigarray syntactic sugar is only mentioned in the
   bigarray modules. IMHO it deserves at least a place in the
   Chapter on language extensions.

2. In 6.11 there is a production

     definition ::= expr

   missing.

3. the empty array is missing in the productions in 6.6 and 6.7


Revised syntax pa_r:

4. In the revised syntax one can define

     type a = ! 'a . list 'a

   is this really an admissable type? Anyway, pr_o prints it as

     type a = 'a . 'a list

   which is illegal.

5. val is not handled consistenly:

    type x = {val : int; kk : int};
    value f a = { (a) with val = 4};

   works fine with pa_r but becomes illegal when printed with
   pr_o.

6. let a = - -5,6 is leagal with ocaml but rejected from pa_o

Original syntax pa_o:

7. I believe there are severe problems in guessing the
   constructor arity. For instance

    type 'a t = A of 'a
    let f = function A(a,b) -> A(b,a)

   compiles fine with pa_o but becomes illegal when printed with
   pr_r.


Quotations q_MLast:

8. mkumin should match on the other integer types as well.
   Currently <:expr< -5l >>, <:expr< -5L >> and <:expr< -5n >>
   work not as expected in a patterns (they match (~) 5 instead
   of -5).


Bye,

Hendrik

TagsNo tags attached.
Attached Files

- Relationships
has duplicate 0005035resolved expr.{expr} form not documented 

-  Notes
(0003025)
administrator (administrator)
2005-06-17 14:08

Hi,

About the Camlp4 problems:

> Revised syntax pa_r:
>
> 4. In the revised syntax one can define "type a = ! 'a . list 'a"
> is this really an admissable type?

OCaml forbids such type schemes ($\forall$ ...) at toplevel in its
concrete syntax spec, but allows them as ASTs. The AST produced by
"type a = ! 'a . list 'a" is therefore legal, but should be essentially
unusable.

If it happens to be buggy to allow such top level polymorphic types,
I'll forbid that, then. (Wouldn't be really complex, but wouldn't be
really elegant either.)

> Anyway, pr_o prints it as "type a = 'a . 'a list" which is illegal.

Fixed.

> 5. val is not handled consistenly:
>
> type x = {val : int; kk : int};
> value f a = { (a) with val = 4};
>
> works fine with pa_r but becomes illegal when printed with
> pr_o.

Fixed: val -> contents, and contents -> contents__.
Still buggy if original code already uses "contents__" but well...


> 7. I believe there are severe problems in guessing the
> constructor arity. For instance
>
> type 'a t = A of 'a
> let f = function A(a,b) -> A(b,a)
>
> compiles fine with pa_o but becomes illegal when printed with
> pr_r.

There is no way at parse time of guessing the arity of A: needs type
checking for that.

I've added a -no_curried_constructors option to pr_r: all non constant data
constructors will have arity 1. At least, it should be correct.

> 8. mkumin should match on the other integer types as well.
> Currently <:expr< -5l >>, <:expr< -5L >> and <:expr< -5n >>
> work not as expected in a patterns (they match (~) 5 instead
> of -5).

Fixed.

Sincerely,

-- Michel

(0003026)
administrator (administrator)
2005-10-21 11:34

Fixed the Camlp4 part in June 2005 [MM]
(0007714)
doligez (administrator)
2012-07-11 17:15

About documentation:
 2: it's in module-expr rather than definition.
 3: added it to the "constant" nonterminal

STILL TO FIX: point 1
(0008195)
Kakadu (reporter)
2012-10-03 10:19

Also in OCaml interface file we write

val f : x:int -> y:int -> int

but in revised we should write with ~:

value f : ~x:int -> ~y:int -> int

It seems that Chapter 6 `Revised syntax` doesn't say anything about labeled arguments.
(0008867)
doligez (administrator)
2013-02-19 11:42

Point 1: fixed (commit 13301)
All the orignal points are fixed, we are left with the problem raised by Kakadu, so I'm switching this PR to the camlp4 category.
(0008872)
hongboz (developer)
2013-02-19 15:52

It's true that in revised syntax "~" is required for label types, but I did not find a place to add the documentation

- Issue History
Date Modified Username Field Change
2005-11-18 10:14 administrator New Issue
2012-07-11 17:15 doligez Note Added: 0007714
2012-07-11 17:15 doligez Category OCaml general => OCaml documentation
2012-07-11 17:15 doligez Target Version => 4.01.0+dev
2012-07-11 17:15 doligez Description Updated View Revisions
2012-07-31 13:37 doligez Target Version 4.01.0+dev => 4.00.1+dev
2012-09-11 09:53 doligez Target Version 4.00.1+dev => 4.00.2+dev
2012-09-17 17:57 doligez Relationship added has duplicate 0005035
2012-10-03 10:19 Kakadu Note Added: 0008195
2013-02-19 11:42 doligez Note Added: 0008867
2013-02-19 11:42 doligez Category OCaml documentation => Camlp4
2013-02-19 11:42 doligez Target Version 4.00.2+dev =>
2013-02-19 15:52 hongboz Note Added: 0008872
2013-07-02 16:04 doligez Target Version => 4.01.0+dev
2013-07-24 11:40 doligez Target Version 4.01.0+dev => 4.01.1+dev
2014-05-25 20:20 doligez Target Version 4.01.1+dev => 4.02.0+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker