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

ocaml 3.07 and optional arguments in revised syntax #8309

Closed
vicuna opened this issue Oct 2, 2003 · 3 comments
Closed

ocaml 3.07 and optional arguments in revised syntax #8309

vicuna opened this issue Oct 2, 2003 · 3 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Oct 2, 2003

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

Bug description

From: artboreb@netscape.net (Arturo Borquez)

Hi,
this code fragment and the operations done gives me the
problem. Please try it, sorry but I haven't done more
tests about it, but it seems me related to other posts
earlier on this list. My opinion is that this transformations
should work as in 3.07+beta2

Please cut and paste the folowing:

(*

A round tour with camlp4 with

generate ocaml syntax mli file, convert it to revised syntax & compile
'a.ml (r_syntax -i option) -> 'ao.mli (o_syntax) -> 'a.mli (r_syntax) -> 'a.cmi

ocamlopt -pp camlp4r -i html.ml > htmlo.mli;
camlp4o pr_r.cmo -l 92 htmlo.mli > html.mli;
ocamlopt -pp camlp4r -c html.mli;
compiles ok in 3.07+beta2
feature or bug ???

BUT with 3.07 the same yields

[20:51:13 fethtml-1]: ocamlopt -pp camlp4r -i html.ml > htmlo.mli;
[20:51:16 fethtml-1]: camlp4o pr_r.cmo -l 92 htmlo.mli > html.mli;
[20:51:16 fethtml-1]: ocamlopt -pp camlp4r -c html.mli;
File "html.mli", line 8, characters 6-224:
Failure: labelled type not allowed here
Preprocessor error
[20:51:16 fethtml-1]:
*)

module Html = struct

type me = [ Get | Post ];

value page ?(h1=[]) ?(h2=[]) ?(h4=[]) ?(track="") ?(bgcolor="")
?(color="") ?(hr=(0, ""))
tit act met d =
let ph l su pr c =
if l <> [] then do {
let s = ref "" in
List.iter (fun (x, p) -> s.val :=
s.val ^ (if p then "

" else "") ^ su ^
pr ^ (if p then "

" else "")) l; s.val ^ "\n" }
else "" in
("\n" ^
"\n" ^
"<meta http-equiv="content-type" content="text/html; charset=UTF-8">\n" ^
"<TITLE>" ^ tit ^ "</TITLE>\n\n<BODY" ^
(if bgcolor <> "" then " BGCOLOR="" ^ bgcolor ^ """
else "") ^ ">\n" ^
(ph h1 "

" "

" color) ^
(ph h2 "

" "

" color) ^
(ph h4 "

" "

" color) ^
"<FORM action="" ^ act ^ "" method="" ^
(if met = Get then "GET" else "POST") ^ "">\n" ^
(if track <> "" then
"<input type="hidden" name="track" value="" ^ track ^ "">\n"
else "")) ^
d ^ "\n\n" ^
(if fst hr > 0 then
"<HR ALIGN="LEFT" WIDTH="" ^ (string_of_int (fst hr)) ^ "%">"
else "") ^
(if snd hr <> "" then snd hr else "") ^ "\n\n"
;

end;

Best regards

--
Arturo Borquez

@vicuna
Copy link
Author

vicuna commented Oct 2, 2003

Comment author: administrator

Just a small complement:
This behaviour is already exhibited by the following one-liner.

$ ocaml camlp4r.cma
Objective Caml version 3.07

    Camlp4 Parsing version 3.07

module type M = sig value v : ?x:int -> int; end;

Toplevel input:

module type M = sig value v : ?x:int -> int; end;

                            ^^^^^^^^^^^^^

Failure: labelled type not allowed here

module type M = sig value v : ~x:int -> int; end;

Toplevel input:

module type M = sig value v : ~x:int -> int; end;

                            ^^^^^^^^^^^^^

Failure: labelled type not allowed here

Jacques

@vicuna
Copy link
Author

vicuna commented Oct 2, 2003

Comment author: administrator

Fixed by MM, 2003/10/02

@vicuna vicuna closed this as completed Oct 2, 2003
@vicuna
Copy link
Author

vicuna commented Oct 2, 2003

Comment author: administrator

I've fixed this in the CVS (to be published tonight).

Thanks for the report,

-- Michel

garrigue@kurims.kyoto-u.ac.jp wrote/écrivait (Thu, Oct 02, 2003 at 03:51:47AM +0200):

Just a small complement:
This behaviour is already exhibited by the following one-liner.

$ ocaml camlp4r.cma
Objective Caml version 3.07

    Camlp4 Parsing version 3.07

module type M = sig value v : ?x:int -> int; end;

Toplevel input:

module type M = sig value v : ?x:int -> int; end;

                            ^^^^^^^^^^^^^

Failure: labelled type not allowed here

module type M = sig value v : ~x:int -> int; end;

Toplevel input:

module type M = sig value v : ~x:int -> int; end;

                            ^^^^^^^^^^^^^

Failure: labelled type not allowed here

Jacques

@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