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

type expression for polymorphic variant with open matching #8414

Closed
vicuna opened this issue Dec 16, 2003 · 3 comments
Closed

type expression for polymorphic variant with open matching #8414

vicuna opened this issue Dec 16, 2003 · 3 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Dec 16, 2003

Original bug ID: 1978
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Peter Hercek
Version: 3.07+2
OS: Linux
Submission from: ethernet-012-packplace.citizens.swva.net.66.37.66.in-addr.arpa (66.37.66.12)

Hi,

I checked it on Linux, but the behavior is the same on Windows with version
3.07.
This may be a documentation error and not an OCaml parser/lexer error. My report
is based on the pdf documentation for OCaml 3.07 (September 29, 2003).

Here is my test with OCaml console:
Objective Caml version 3.07+2

let f x:[<|A|B] = x;;

val f : ([< A | B ] as 'a) -> 'a =

let f x:[>|A|B] = x;;

Syntax error

let f x:[> |A|B] = x;;

#quit;;

It looks like the reason is that ">|" is a lexical symbol and "[>" is not a
lexical symbol.
Well, "[>" should not be lexical symbol based on the BNF grammar for
"variant-type" nonterminal. Uff, this reasoning is valid for "[<" too and "[<"
is a keyword (ie a lexical symbol). On the other side ">|" should not be a
lexical symbol, because there is no mention about in in the whole OCaml 3.07
manual.

Regards,
Peter.

@vicuna
Copy link
Author

vicuna commented Dec 18, 2003

Comment author: administrator

Objective Caml version 3.07+2

let f x:[<|A|B] = x;;

val f : ([< A | B ] as 'a) -> 'a =

let f x:[>|A|B] = x;;

Syntax error

let f x:[> |A|B] = x;;

[...]

It looks like the reason is that ">|" is a lexical symbol and "[>" is not a
lexical symbol.

That's how it is in the implementation now. I regard this as a design bug.
There is no reason for "[>" not to be a symbol while "[<" is a symbol.

Well, "[>" should not be lexical symbol based on the BNF grammar for
"variant-type" nonterminal.

The BNF grammar needs to be fixed.

On the other side ">|" should not be a
lexical symbol, because there is no mention about in in the whole OCaml 3.07
manual.

Your reasoning is incorrect. ">|" is an identifier, and we obvioulsy cannot
list
all valid identifiers in the manual...

I have fixed the problem in the CVS tree by giving "[>" the same status as
"[<".
We still have to fix the BNF grammar.

Thanks for your bug report,

-- Damien

@vicuna
Copy link
Author

vicuna commented Dec 18, 2003

Comment author: administrator

----- The following addresses had permanent fatal errors -----
peter@syncad.dot.com
(reason: 550 Host unknown)

----- Transcript of session follows -----
550 5.1.2 peter@syncad.dot.com... Host unknown (Name server: syncad.dot.com.: host not found)


Reporting-MTA: dns; concorde.inria.fr
Received-From-MTA: DNS; pauillac.inria.fr
Arrival-Date: Thu, 18 Dec 2003 17:28:59 +0100 (MET)

Final-Recipient: RFC822; peter@syncad.dot.com
Action: failed
Status: 5.1.2
Remote-MTA: DNS; syncad.dot.com
Diagnostic-Code: SMTP; 550 Host unknown
Last-Attempt-Date: Thu, 18 Dec 2003 17:28:59 +0100 (MET)


Return-Path: caml-bugs@pauillac.inria.fr
Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35])
by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id hBIGSxH11421
for peter@syncad.dot.com; Thu, 18 Dec 2003 17:28:59 +0100 (MET)
Received: from localhost (localhost.inria.fr [127.0.0.1]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA16833 for peter@syncad.dot.com; Thu, 18 Dec 2003 17:28:57 +0100 (MET)
Date: Thu, 18 Dec 2003 17:28:57 +0100 (MET)
Message-Id: 200312181628.RAA16833@pauillac.inria.fr
From: Damien Doligez caml-bugs@pauillac.inria.fr
To: peter@syncad.dot.com
Subject: Re: type expression for polymorphic variant with open matching (#8414)
X-Loop: caml-bugs@pauillac.inria.fr
MIME-Version: 1.0

Objective Caml version 3.07+2

let f x:[<|A|B] = x;;

val f : ([< A | B ] as 'a) -> 'a =

let f x:[>|A|B] = x;;

Syntax error

let f x:[> |A|B] = x;;

[...]

It looks like the reason is that ">|" is a lexical symbol and "[>" is not a
lexical symbol.

That's how it is in the implementation now. I regard this as a design bug.
There is no reason for "[>" not to be a symbol while "[<" is a symbol.

Well, "[>" should not be lexical symbol based on the BNF grammar for
"variant-type" nonterminal.

The BNF grammar needs to be fixed.

On the other side ">|" should not be a
lexical symbol, because there is no mention about in in the whole OCaml 3.07
manual.

Your reasoning is incorrect. ">|" is an identifier, and we obvioulsy cannot
list
all valid identifiers in the manual...

I have fixed the problem in the CVS tree by giving "[>" the same status as
"[<".
We still have to fix the BNF grammar.

Thanks for your bug report,

-- Damien



@vicuna
Copy link
Author

vicuna commented Jun 18, 2004

Comment author: administrator

implementation fixed --DD 2003-12-18
doc fixed --DD 2004-06-18

@vicuna vicuna closed this as completed Jun 18, 2004
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant