Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3 documentation suggestions and 5 camlp4 problems #3688

Closed
vicuna opened this issue Jun 16, 2005 · 7 comments
Closed

3 documentation suggestions and 5 camlp4 problems #3688

vicuna opened this issue Jun 16, 2005 · 7 comments

Comments

@vicuna
Copy link

vicuna commented Jun 16, 2005

Original bug ID: 3688
Reporter: administrator
Status: closed (set by @damiendoligez on 2015-01-09T17:44:32Z)
Resolution: suspended
Priority: normal
Severity: minor
Target version: undecided
Category: -for Camlp4 use https://github.com/ocaml/camlp4/issues
Has duplicate: #5035
Monitored by: @bobzhang "Hendrik Tews"

Bug description

Hi,

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:

  1. 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.

  2. 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.

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

Original syntax pa_o:

  1. 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:

  1. 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

@vicuna
Copy link
Author

vicuna commented Jun 17, 2005

Comment author: administrator

Hi,

About the Camlp4 problems:

Revised syntax pa_r:

  1. 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.

  1. 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...

  1. 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.

  1. 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

@vicuna
Copy link
Author

vicuna commented Oct 21, 2005

Comment author: administrator

Fixed the Camlp4 part in June 2005 [MM]

@vicuna
Copy link
Author

vicuna commented Jul 11, 2012

Comment author: @damiendoligez

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

STILL TO FIX: point 1

@vicuna
Copy link
Author

vicuna commented Oct 3, 2012

Comment author: Kakadu

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.

@vicuna
Copy link
Author

vicuna commented Feb 19, 2013

Comment author: @damiendoligez

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.

@vicuna
Copy link
Author

vicuna commented Feb 19, 2013

Comment author: @bobzhang

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

@vicuna
Copy link
Author

vicuna commented Jan 9, 2015

Comment author: @damiendoligez

Camlp4 now has its own bug-tracker, so I reported the problem there:
camlp4/camlp4#61

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant