caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: [Caml-list] ocaml 3.07 and optional arguments
@ 2003-09-30 19:18 Arturo Borquez
  2003-10-01  0:04 ` Jacques Garrigue
  0 siblings, 1 reply; 11+ messages in thread
From: Arturo Borquez @ 2003-09-30 19:18 UTC (permalink / raw)
  To: Jacques Garrigue; +Cc: caml-list

Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp> wrote:

>> From: "Vincent Barichard" <Vincent.Barichard@info.univ-angers.fr>
>> 
>> > I've just downloaded ocaml 3.07 and compil it. But when I try to compil old
>> > programs, I encounter some problems with optional arguments in methods.
>> [...]
>> > Is there any changes with the use of optional arguments for methods ?
>> 
>> I don't remember introducing any change at that level.
>
>After another bug report, it seems that a parsing bug went into camlp4
>just before the release :-(
>
>        Camlp4 Parsing version 3.07
>
># fun (f : ?x:int -> bool -> float) -> f true;;
>This expression has type bool but is here used with type ?x:int -> bool
># fun (f : ?x:int -> bool -> float) -> f;;
>- : ((?x:int -> bool) -> float) -> (?x:int -> bool) -> float = <fun>
>
>This is apparently a priority problem.
>A workaround is to explicitly add parentheses.
>
># fun (f : ?x:int -> (bool -> float)) -> f true;;
>- : (?x:int -> bool -> float) -> float = <fun>
>
>There is no fix for camlp4 itself yet.
>
>      Jacques Garrigue
>

Hi,

Is there a patch planned soon to solve this issue?

Best regards

-- 
Arturo Borquez


__________________________________________________________________
McAfee VirusScan Online from the Netscape Network.
Comprehensive protection for your entire computer. Get your free trial today!
http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397

Get AOL Instant Messenger 5.1 free of charge.  Download Now!
http://aim.aol.com/aimnew/Aim/register.adp?promo=380455

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] ocaml 3.07 and optional arguments
  2003-09-30 19:18 [Caml-list] ocaml 3.07 and optional arguments Arturo Borquez
@ 2003-10-01  0:04 ` Jacques Garrigue
  2003-10-01  8:43   ` Christophe Raffalli
  0 siblings, 1 reply; 11+ messages in thread
From: Jacques Garrigue @ 2003-10-01  0:04 UTC (permalink / raw)
  To: artboreb; +Cc: caml-list

This was fixed in CVS by Michel Mauny.
I join the patch relative to 3.07, since many people seem to be
concerned.

Jacques Garrigue

From: artboreb@netscape.net (Arturo Borquez)
> Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp> wrote:
>
> >After another bug report, it seems that a parsing bug went into camlp4
> >just before the release :-(
> >
> >        Camlp4 Parsing version 3.07
> >
> ># fun (f : ?x:int -> bool -> float) -> f true;;
> >This expression has type bool but is here used with type ?x:int -> bool
> ># fun (f : ?x:int -> bool -> float) -> f;;
> >- : ((?x:int -> bool) -> float) -> (?x:int -> bool) -> float = <fun>
> 
> Is there a patch planned soon to solve this issue?

Index: camlp4/camlp4/ast2pt.ml
===================================================================
RCS file: /net/pauillac/caml/repository/csl/camlp4/camlp4/ast2pt.ml,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- ast2pt.ml	2003/07/16 18:59:12	1.25
+++ ast2pt.ml	2003/09/30 14:39:26	1.26
@@ -10,7 +10,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: ast2pt.ml,v 1.25 2003/07/16 18:59:12 mauny Exp $ *)
+(* $Id: ast2pt.ml,v 1.26 2003/09/30 14:39:26 mauny Exp $ *)
 
 open Stdpp;
 open MLast;
@@ -177,10 +177,10 @@
   | TyObj loc fl v -> mktyp loc (Ptyp_object (meth_list loc fl v))
   | TyCls loc id ->
       mktyp loc (Ptyp_class (long_id_of_string_list loc id) [] [])
-  | TyLab loc _ _ -> error loc "labeled type not allowed here"
+  | TyLab loc _ _ -> error loc "labelled type not allowed here"
   | TyLid loc s -> mktyp loc (Ptyp_constr (lident s) [])
-  | TyMan loc _ _ -> error loc "type manifest not allowed here"
-  | TyOlb loc lab _ -> error loc "labeled type not allowed here"
+  | TyMan loc _ _ -> error loc "manifest type not allowed here"
+  | TyOlb loc lab _ -> error loc "labelled type not allowed here"
   | TyPol loc pl t -> mktyp loc (Ptyp_poly pl (ctyp t))
   | TyQuo loc s -> mktyp loc (Ptyp_var s)
   | TyRec loc _ _ -> error loc "record type not allowed here"
Index: camlp4/etc/pa_o.ml
===================================================================
RCS file: /net/pauillac/caml/repository/csl/camlp4/etc/pa_o.ml,v
retrieving revision 1.52
retrieving revision 1.54
diff -u -r1.52 -r1.54
--- pa_o.ml	2003/09/25 12:05:05	1.52
+++ pa_o.ml	2003/09/30 14:39:38	1.54
@@ -10,7 +10,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: pa_o.ml,v 1.52 2003/09/25 12:05:05 mauny Exp $ *)
+(* $Id: pa_o.ml,v 1.54 2003/09/30 14:39:38 mauny Exp $ *)
 
 open Stdpp;
 open Pcaml;
@@ -1148,16 +1148,16 @@
       | i = LIDENT -> [i] ] ]
   ;
   (* Labels *)
-  ctyp: AFTER "arrow"
-    [ NONA
+  ctyp: LEVEL "arrow"
+    [ RIGHTA
       [ i = lident_colon; t1 = ctyp LEVEL "star"; "->"; t2 = SELF ->
-          <:ctyp< ~ $i$ : $t1$ -> $t2$ >>
+          <:ctyp< ( ~ $i$ : $t1$ ) -> $t2$ >>
       | i = OPTLABEL; t1 = ctyp LEVEL "star"; "->"; t2 = SELF ->
-          <:ctyp< ? $i$ : $t1$ -> $t2$ >>
+          <:ctyp< ( ? $i$ : $t1$ ) -> $t2$ >>
       | i = QUESTIONIDENT; ":"; t1 = ctyp LEVEL "star"; "->"; t2 = SELF ->
-          <:ctyp< ? $i$ : $t1$ -> $t2$ >>
+          <:ctyp< ( ? $i$ : $t1$ ) -> $t2$ >>
       | "?"; i=lident_colon;t1 = ctyp LEVEL "star"; "->"; t2 = SELF ->
-          <:ctyp< ? $i$ : $t1$ -> $t2$ >> ] ]
+          <:ctyp< ( ? $i$ : $t1$ ) -> $t2$ >> ] ]
   ;
   ctyp: LEVEL "simple"
     [ [ "["; OPT "|"; rfl = LIST1 row_field SEP "|"; "]" ->
Index: camlp4/meta/pa_r.ml
===================================================================
RCS file: /net/pauillac/caml/repository/csl/camlp4/meta/pa_r.ml,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- pa_r.ml	2003/09/25 12:05:06	1.53
+++ pa_r.ml	2003/09/30 10:20:06	1.54
@@ -10,7 +10,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: pa_r.ml,v 1.53 2003/09/25 12:05:06 mauny Exp $ *)
+(* $Id: pa_r.ml,v 1.54 2003/09/30 10:20:06 mauny Exp $ *)
 
 open Stdpp;
 open Pcaml;
@@ -748,8 +748,8 @@
       | i = LIDENT -> [i] ] ]
   ;
   (* Labels *)
-  ctyp: AFTER "arrow"
-    [ NONA
+  ctyp: LEVEL "arrow"
+    [ RIGHTA
       [ i = TILDEIDENT; ":"; t = SELF -> <:ctyp< ~ $i$ : $t$ >>
       | i = LABEL; t = SELF -> <:ctyp< ~ $i$ : $t$ >>
       | i = QUESTIONIDENT; ":"; t = SELF -> <:ctyp< ? $i$ : $t$ >> 
Index: camlp4/meta/q_MLast.ml
===================================================================
RCS file: /net/pauillac/caml/repository/csl/camlp4/meta/q_MLast.ml,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- q_MLast.ml	2003/07/16 12:50:08	1.51
+++ q_MLast.ml	2003/09/30 11:38:04	1.52
@@ -10,7 +10,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: q_MLast.ml,v 1.51 2003/07/16 12:50:08 mauny Exp $ *)
+(* $Id: q_MLast.ml,v 1.52 2003/09/30 11:38:04 mauny Exp $ *)
 
 value gram = Grammar.gcreate (Plexer.gmake ());
 
@@ -127,7 +127,9 @@
 value a_STRING = Grammar.Entry.create gram "a_STRING";
 value a_CHAR = Grammar.Entry.create gram "a_CHAR";
 value a_TILDEIDENT = Grammar.Entry.create gram "a_TILDEIDENT";
+value a_LABEL = Grammar.Entry.create gram "a_LABEL";
 value a_QUESTIONIDENT = Grammar.Entry.create gram "a_QUESTIONIDENT";
+value a_OPTLABEL = Grammar.Entry.create gram "a_OPTLABEL";
 
 value o2b =
   fun
@@ -1007,10 +1009,13 @@
       | i = a_LIDENT -> Qast.List [i] ] ]
   ;
   (* Labels *)
-  ctyp: AFTER "arrow"
-    [ NONA
+  ctyp: LEVEL "arrow"
+    [ RIGHTA
       [ i = a_TILDEIDENT; ":"; t = SELF -> Qast.Node "TyLab" [Qast.Loc; i; t]
+      | i = a_LABEL; t = SELF -> Qast.Node "TyLab" [Qast.Loc; i; t]
       | i = a_QUESTIONIDENT; ":"; t = SELF ->
+          Qast.Node "TyOlb" [Qast.Loc; i; t]
+      | i = a_OPTLABEL; t = SELF ->
           Qast.Node "TyOlb" [Qast.Loc; i; t] ] ]
   ;
   ctyp: LEVEL "simple"
@@ -1044,11 +1049,16 @@
       | "#"; sl = mod_ident -> Qast.Node "PaTyp" [Qast.Loc; sl]
       | i = a_TILDEIDENT; ":"; p = SELF ->
           Qast.Node "PaLab" [Qast.Loc; i; Qast.Option (Some p)]
+      | i = a_LABEL; p = SELF ->
+          Qast.Node "PaLab" [Qast.Loc; i; Qast.Option (Some p)]
       | i = a_TILDEIDENT -> Qast.Node "PaLab" [Qast.Loc; i; Qast.Option None]
       | i = a_QUESTIONIDENT; ":"; "("; p = patt_tcon; eo = SOPT eq_expr;
         ")" ->
           Qast.Node "PaOlb"
             [Qast.Loc; i; Qast.Option (Some (Qast.Tuple [p; eo]))]
+      | i = a_OPTLABEL; "("; p = patt_tcon; eo = SOPT eq_expr; ")" ->
+          Qast.Node "PaOlb"
+            [Qast.Loc; i; Qast.Option (Some (Qast.Tuple [p; eo]))]
       | i = a_QUESTIONIDENT ->
           Qast.Node "PaOlb" [Qast.Loc; i; Qast.Option None]
       | "?"; "("; p = patt_tcon; eo = SOPT eq_expr; ")" ->
@@ -1063,11 +1073,16 @@
   ipatt:
     [ [ i = a_TILDEIDENT; ":"; p = SELF ->
           Qast.Node "PaLab" [Qast.Loc; i; Qast.Option (Some p)]
+      | i = a_LABEL; p = SELF ->
+          Qast.Node "PaLab" [Qast.Loc; i; Qast.Option (Some p)]
       | i = a_TILDEIDENT -> Qast.Node "PaLab" [Qast.Loc; i; Qast.Option None]
       | i = a_QUESTIONIDENT; ":"; "("; p = ipatt_tcon; eo = SOPT eq_expr;
         ")" ->
           Qast.Node "PaOlb"
             [Qast.Loc; i; Qast.Option (Some (Qast.Tuple [p; eo]))]
+      | i = a_OPTLABEL; "("; p = ipatt_tcon; eo = SOPT eq_expr; ")" ->
+          Qast.Node "PaOlb"
+            [Qast.Loc; i; Qast.Option (Some (Qast.Tuple [p; eo]))]
       | i = a_QUESTIONIDENT ->
           Qast.Node "PaOlb" [Qast.Loc; i; Qast.Option None]
       | "?"; "("; p = ipatt_tcon; eo = SOPT eq_expr; ")" ->
@@ -1086,9 +1101,13 @@
     [ "label" NONA
       [ i = a_TILDEIDENT; ":"; e = SELF ->
           Qast.Node "ExLab" [Qast.Loc; i; Qast.Option (Some e)]
+      | i = a_LABEL; e = SELF ->
+          Qast.Node "ExLab" [Qast.Loc; i; Qast.Option (Some e)]
       | i = a_TILDEIDENT -> Qast.Node "ExLab" [Qast.Loc; i; Qast.Option None]
       | i = a_QUESTIONIDENT; ":"; e = SELF ->
           Qast.Node "ExOlb" [Qast.Loc; i; Qast.Option (Some e)]
+      | i = a_OPTLABEL; e = SELF ->
+          Qast.Node "ExOlb" [Qast.Loc; i; Qast.Option (Some e)]
       | i = a_QUESTIONIDENT ->
           Qast.Node "ExOlb" [Qast.Loc; i; Qast.Option None] ] ]
   ;
@@ -1335,9 +1354,15 @@
     [ [ "~"; a = ANTIQUOT -> antiquot "" loc a
       | s = TILDEIDENT -> Qast.Str s ] ]
   ;
+  a_LABEL:
+    [ [ s = LABEL -> Qast.Str s ] ]
+  ;
   a_QUESTIONIDENT:
     [ [ "?"; a = ANTIQUOT -> antiquot "" loc a
       | s = QUESTIONIDENT -> Qast.Str s ] ]
+  ;
+  a_OPTLABEL:
+    [ [ s = OPTLABEL -> Qast.Str s ] ]
   ;
 END;
 
Index: camlp4/ocaml_src/camlp4/ast2pt.ml
===================================================================
RCS file: /net/pauillac/caml/repository/csl/camlp4/ocaml_src/camlp4/ast2pt.ml,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- ast2pt.ml	2003/07/23 22:26:18	1.24
+++ ast2pt.ml	2003/09/30 14:39:38	1.25
@@ -169,10 +169,10 @@
   | TyObj (loc, fl, v) -> mktyp loc (Ptyp_object (meth_list loc fl v))
   | TyCls (loc, id) ->
       mktyp loc (Ptyp_class (long_id_of_string_list loc id, [], []))
-  | TyLab (loc, _, _) -> error loc "labeled type not allowed here"
+  | TyLab (loc, _, _) -> error loc "labelled type not allowed here"
   | TyLid (loc, s) -> mktyp loc (Ptyp_constr (lident s, []))
-  | TyMan (loc, _, _) -> error loc "type manifest not allowed here"
-  | TyOlb (loc, lab, _) -> error loc "labeled type not allowed here"
+  | TyMan (loc, _, _) -> error loc "manifest type not allowed here"
+  | TyOlb (loc, lab, _) -> error loc "labelled type not allowed here"
   | TyPol (loc, pl, t) -> mktyp loc (Ptyp_poly (pl, ctyp t))
   | TyQuo (loc, s) -> mktyp loc (Ptyp_var s)
   | TyRec (loc, _, _) -> error loc "record type not allowed here"
Index: camlp4/ocaml_src/meta/pa_r.ml
===================================================================
RCS file: /net/pauillac/caml/repository/csl/camlp4/ocaml_src/meta/pa_r.ml,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- pa_r.ml	2003/09/25 12:05:07	1.48
+++ pa_r.ml	2003/09/30 10:20:06	1.49
@@ -2241,8 +2241,8 @@
         (fun (l : 'class_longident) _ (m : string) (loc : int * int) ->
            (m :: l : 'class_longident))]];
     Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e),
-    Some (Gramext.After "arrow"),
-    [None, Some Gramext.NonA,
+    Some (Gramext.Level "arrow"),
+    [None, Some Gramext.RightA,
      [[Gramext.Stoken ("OPTLABEL", ""); Gramext.Sself],
       Gramext.action
         (fun (t : 'ctyp) (i : string) (loc : int * int) ->
Index: camlp4/ocaml_src/meta/q_MLast.ml
===================================================================
RCS file: /net/pauillac/caml/repository/csl/camlp4/ocaml_src/meta/q_MLast.ml,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- q_MLast.ml	2003/07/23 22:26:19	1.56
+++ q_MLast.ml	2003/09/30 11:38:04	1.57
@@ -153,7 +153,9 @@
 let a_STRING = Grammar.Entry.create gram "a_STRING";;
 let a_CHAR = Grammar.Entry.create gram "a_CHAR";;
 let a_TILDEIDENT = Grammar.Entry.create gram "a_TILDEIDENT";;
+let a_LABEL = Grammar.Entry.create gram "a_LABEL";;
 let a_QUESTIONIDENT = Grammar.Entry.create gram "a_QUESTIONIDENT";;
+let a_OPTLABEL = Grammar.Entry.create gram "a_OPTLABEL";;
 
 let o2b =
   function
@@ -626,7 +628,7 @@
                 Qast.Tuple [xx1; xx2; xx3] -> xx1, xx2, xx3
               | _ ->
                   match () with
-                  _ -> raise (Match_failure ("q_MLast.ml", 300, 19))
+                  _ -> raise (Match_failure ("q_MLast.ml", 302, 19))
             in
             Qast.Node ("StExc", [Qast.Loc; c; tl; b]) :
             'str_item));
@@ -896,7 +898,7 @@
                 Qast.Tuple [xx1; xx2; xx3] -> xx1, xx2, xx3
               | _ ->
                   match () with
-                  _ -> raise (Match_failure ("q_MLast.ml", 358, 19))
+                  _ -> raise (Match_failure ("q_MLast.ml", 360, 19))
             in
             Qast.Node ("SgExc", [Qast.Loc; c; tl]) :
             'sig_item));
@@ -3345,9 +3347,15 @@
         (fun (l : 'class_longident) _ (m : 'a_UIDENT) (loc : int * int) ->
            (Qast.Cons (m, l) : 'class_longident))]];
     Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e),
-    Some (Gramext.After "arrow"),
-    [None, Some Gramext.NonA,
+    Some (Gramext.Level "arrow"),
+    [None, Some Gramext.RightA,
      [[Gramext.Snterm
+         (Grammar.Entry.obj (a_OPTLABEL : 'a_OPTLABEL Grammar.Entry.e));
+       Gramext.Sself],
+      Gramext.action
+        (fun (t : 'ctyp) (i : 'a_OPTLABEL) (loc : int * int) ->
+           (Qast.Node ("TyOlb", [Qast.Loc; i; t]) : 'ctyp));
+      [Gramext.Snterm
          (Grammar.Entry.obj
             (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e));
        Gramext.Stoken ("", ":"); Gramext.Sself],
@@ -3355,6 +3363,12 @@
         (fun (t : 'ctyp) _ (i : 'a_QUESTIONIDENT) (loc : int * int) ->
            (Qast.Node ("TyOlb", [Qast.Loc; i; t]) : 'ctyp));
       [Gramext.Snterm
+         (Grammar.Entry.obj (a_LABEL : 'a_LABEL Grammar.Entry.e));
+       Gramext.Sself],
+      Gramext.action
+        (fun (t : 'ctyp) (i : 'a_LABEL) (loc : int * int) ->
+           (Qast.Node ("TyLab", [Qast.Loc; i; t]) : 'ctyp));
+      [Gramext.Snterm
          (Grammar.Entry.obj (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e));
        Gramext.Stoken ("", ":"); Gramext.Sself],
       Gramext.action
@@ -3518,6 +3532,30 @@
         (fun (i : 'a_QUESTIONIDENT) (loc : int * int) ->
            (Qast.Node ("PaOlb", [Qast.Loc; i; Qast.Option None]) : 'patt));
       [Gramext.Snterm
+         (Grammar.Entry.obj (a_OPTLABEL : 'a_OPTLABEL Grammar.Entry.e));
+       Gramext.Stoken ("", "(");
+       Gramext.Snterm
+         (Grammar.Entry.obj (patt_tcon : 'patt_tcon Grammar.Entry.e));
+       Gramext.srules
+         [[Gramext.Sopt
+             (Gramext.Snterm
+                (Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e)))],
+          Gramext.action
+            (fun (a : 'eq_expr option) (loc : int * int) ->
+               (Qast.Option a : 'a_opt));
+          [Gramext.Snterm
+             (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))],
+          Gramext.action
+            (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))];
+       Gramext.Stoken ("", ")")],
+      Gramext.action
+        (fun _ (eo : 'a_opt) (p : 'patt_tcon) _ (i : 'a_OPTLABEL)
+           (loc : int * int) ->
+           (Qast.Node
+              ("PaOlb",
+               [Qast.Loc; i; Qast.Option (Some (Qast.Tuple [p; eo]))]) :
+            'patt));
+      [Gramext.Snterm
          (Grammar.Entry.obj
             (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e));
        Gramext.Stoken ("", ":"); Gramext.Stoken ("", "(");
@@ -3548,6 +3586,13 @@
         (fun (i : 'a_TILDEIDENT) (loc : int * int) ->
            (Qast.Node ("PaLab", [Qast.Loc; i; Qast.Option None]) : 'patt));
       [Gramext.Snterm
+         (Grammar.Entry.obj (a_LABEL : 'a_LABEL Grammar.Entry.e));
+       Gramext.Sself],
+      Gramext.action
+        (fun (p : 'patt) (i : 'a_LABEL) (loc : int * int) ->
+           (Qast.Node ("PaLab", [Qast.Loc; i; Qast.Option (Some p)]) :
+            'patt));
+      [Gramext.Snterm
          (Grammar.Entry.obj (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e));
        Gramext.Stoken ("", ":"); Gramext.Sself],
       Gramext.action
@@ -3606,6 +3651,30 @@
         (fun (i : 'a_QUESTIONIDENT) (loc : int * int) ->
            (Qast.Node ("PaOlb", [Qast.Loc; i; Qast.Option None]) : 'ipatt));
       [Gramext.Snterm
+         (Grammar.Entry.obj (a_OPTLABEL : 'a_OPTLABEL Grammar.Entry.e));
+       Gramext.Stoken ("", "(");
+       Gramext.Snterm
+         (Grammar.Entry.obj (ipatt_tcon : 'ipatt_tcon Grammar.Entry.e));
+       Gramext.srules
+         [[Gramext.Sopt
+             (Gramext.Snterm
+                (Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e)))],
+          Gramext.action
+            (fun (a : 'eq_expr option) (loc : int * int) ->
+               (Qast.Option a : 'a_opt));
+          [Gramext.Snterm
+             (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))],
+          Gramext.action
+            (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))];
+       Gramext.Stoken ("", ")")],
+      Gramext.action
+        (fun _ (eo : 'a_opt) (p : 'ipatt_tcon) _ (i : 'a_OPTLABEL)
+           (loc : int * int) ->
+           (Qast.Node
+              ("PaOlb",
+               [Qast.Loc; i; Qast.Option (Some (Qast.Tuple [p; eo]))]) :
+            'ipatt));
+      [Gramext.Snterm
          (Grammar.Entry.obj
             (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e));
        Gramext.Stoken ("", ":"); Gramext.Stoken ("", "(");
@@ -3636,6 +3705,13 @@
         (fun (i : 'a_TILDEIDENT) (loc : int * int) ->
            (Qast.Node ("PaLab", [Qast.Loc; i; Qast.Option None]) : 'ipatt));
       [Gramext.Snterm
+         (Grammar.Entry.obj (a_LABEL : 'a_LABEL Grammar.Entry.e));
+       Gramext.Sself],
+      Gramext.action
+        (fun (p : 'ipatt) (i : 'a_LABEL) (loc : int * int) ->
+           (Qast.Node ("PaLab", [Qast.Loc; i; Qast.Option (Some p)]) :
+            'ipatt));
+      [Gramext.Snterm
          (Grammar.Entry.obj (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e));
        Gramext.Stoken ("", ":"); Gramext.Sself],
       Gramext.action
@@ -3669,6 +3745,13 @@
         (fun (i : 'a_QUESTIONIDENT) (loc : int * int) ->
            (Qast.Node ("ExOlb", [Qast.Loc; i; Qast.Option None]) : 'expr));
       [Gramext.Snterm
+         (Grammar.Entry.obj (a_OPTLABEL : 'a_OPTLABEL Grammar.Entry.e));
+       Gramext.Sself],
+      Gramext.action
+        (fun (e : 'expr) (i : 'a_OPTLABEL) (loc : int * int) ->
+           (Qast.Node ("ExOlb", [Qast.Loc; i; Qast.Option (Some e)]) :
+            'expr));
+      [Gramext.Snterm
          (Grammar.Entry.obj
             (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e));
        Gramext.Stoken ("", ":"); Gramext.Sself],
@@ -3682,6 +3765,13 @@
         (fun (i : 'a_TILDEIDENT) (loc : int * int) ->
            (Qast.Node ("ExLab", [Qast.Loc; i; Qast.Option None]) : 'expr));
       [Gramext.Snterm
+         (Grammar.Entry.obj (a_LABEL : 'a_LABEL Grammar.Entry.e));
+       Gramext.Sself],
+      Gramext.action
+        (fun (e : 'expr) (i : 'a_LABEL) (loc : int * int) ->
+           (Qast.Node ("ExLab", [Qast.Loc; i; Qast.Option (Some e)]) :
+            'expr));
+      [Gramext.Snterm
          (Grammar.Entry.obj (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e));
        Gramext.Stoken ("", ":"); Gramext.Sself],
       Gramext.action
@@ -4427,6 +4517,11 @@
      Gramext.action
        (fun (a : string) _ (loc : int * int) ->
           (antiquot "" loc a : 'a_TILDEIDENT))]];
+   Grammar.Entry.obj (a_LABEL : 'a_LABEL Grammar.Entry.e), None,
+   [None, None,
+    [[Gramext.Stoken ("LABEL", "")],
+     Gramext.action
+       (fun (s : string) (loc : int * int) -> (Qast.Str s : 'a_LABEL))]];
    Grammar.Entry.obj (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e),
    None,
    [None, None,
@@ -4437,7 +4532,12 @@
      [Gramext.Stoken ("", "?"); Gramext.Stoken ("ANTIQUOT", "")],
      Gramext.action
        (fun (a : string) _ (loc : int * int) ->
-          (antiquot "" loc a : 'a_QUESTIONIDENT))]]];;
+          (antiquot "" loc a : 'a_QUESTIONIDENT))]];
+   Grammar.Entry.obj (a_OPTLABEL : 'a_OPTLABEL Grammar.Entry.e), None,
+   [None, None,
+    [[Gramext.Stoken ("OPTLABEL", "")],
+     Gramext.action
+       (fun (s : string) (loc : int * int) -> (Qast.Str s : 'a_OPTLABEL))]]];;
 
 let apply_entry e =
   let f s = Grammar.Entry.parse e (Stream.of_string s) in

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] ocaml 3.07 and optional arguments
  2003-10-01  0:04 ` Jacques Garrigue
@ 2003-10-01  8:43   ` Christophe Raffalli
  2003-10-01 15:45     ` Yaron Minsky
  0 siblings, 1 reply; 11+ messages in thread
From: Christophe Raffalli @ 2003-10-01  8:43 UTC (permalink / raw)
  To: Jacques Garrigue; +Cc: artboreb, caml-list

Jacques Garrigue wrote:
> This was fixed in CVS by Michel Mauny.
> I join the patch relative to 3.07, since many people seem to be
> concerned.
> 

Maybe there could be another 3.07 version release with or without 
changing the version number and before to much experimental features 
went into CVS ?

-- 
Christophe Raffalli
Université de Savoie
Batiment Le Chablais, bureau 21
73376 Le Bourget-du-Lac Cedex

tél: (33) 4 79 75 81 03
fax: (33) 4 79 75 87 42
mail: Christophe.Raffalli@univ-savoie.fr
www: http://www.lama.univ-savoie.fr/~RAFFALLI
---------------------------------------------
IMPORTANT: this mail is signed using PGP/MIME
At least Enigmail/Mozilla, mutt or evolution
can check this signature
---------------------------------------------

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] ocaml 3.07 and optional arguments
  2003-10-01  8:43   ` Christophe Raffalli
@ 2003-10-01 15:45     ` Yaron Minsky
  2003-10-01 15:54       ` Alain.Frisch
  0 siblings, 1 reply; 11+ messages in thread
From: Yaron Minsky @ 2003-10-01 15:45 UTC (permalink / raw)
  To: caml-list

Having been bitten by this bug myself (which appears to hit labeled
arguments in general, not just optional arguments), I'd be quite eager for
a rerelease of 3.07 (3.07.1?) that fixes this problem.  It's a pretty
serious bug, especially if camlp4 is to be thought of as a real part of
the core system.

Yaron

> Jacques Garrigue wrote:
>> This was fixed in CVS by Michel Mauny.
>> I join the patch relative to 3.07, since many people seem to be
>> concerned.
>>
>
> Maybe there could be another 3.07 version release with or without
> changing the version number and before to much experimental features
> went into CVS ?
>
> --
> Christophe Raffalli
> Université de Savoie
> Batiment Le Chablais, bureau 21
> 73376 Le Bourget-du-Lac Cedex
>
> tél: (33) 4 79 75 81 03
> fax: (33) 4 79 75 87 42
> mail: Christophe.Raffalli@univ-savoie.fr
> www: http://www.lama.univ-savoie.fr/~RAFFALLI
> ---------------------------------------------
> IMPORTANT: this mail is signed using PGP/MIME
> At least Enigmail/Mozilla, mutt or evolution
> can check this signature
> ---------------------------------------------
>
> -------------------
> To unsubscribe, mail caml-list-request@inria.fr Archives:
> http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs
> FAQ: http://caml.inria.fr/FAQ/ Beginner's list:
> http://groups.yahoo.com/group/ocaml_beginners


|--------/            Yaron M. Minsky              \--------|
|--------\ http://www.cs.cornell.edu/home/yminsky/ /--------|

Open PGP --- KeyID B1FFD916 (new key as of Dec 4th)
Fingerprint: 5BF6 83E1 0CE3 1043 95D8 F8D5 9F12 B3A9 B1FF D916



-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] ocaml 3.07 and optional arguments
  2003-10-01 15:45     ` Yaron Minsky
@ 2003-10-01 15:54       ` Alain.Frisch
  0 siblings, 0 replies; 11+ messages in thread
From: Alain.Frisch @ 2003-10-01 15:54 UTC (permalink / raw)
  To: Yaron Minsky; +Cc: Caml list

On Wed, 1 Oct 2003, Yaron Minsky wrote:

> Having been bitten by this bug myself (which appears to hit labeled
> arguments in general, not just optional arguments), I'd be quite eager for
> a rerelease of 3.07 (3.07.1?) that fixes this problem.  It's a pretty
> serious bug, especially if camlp4 is to be thought of as a real part of
> the core system.

I second that. Hopefully, OCaml 3.07+beta2 is still available, because it
is the only version that can compile the CVS branch of CDuce... Please
don't remove it!

-- Alain

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] ocaml 3.07 and optional arguments
  2003-10-01 20:28 Arturo Borquez
@ 2003-10-01 23:51 ` Jacques Garrigue
  0 siblings, 0 replies; 11+ messages in thread
From: Jacques Garrigue @ 2003-10-01 23:51 UTC (permalink / raw)
  To: artboreb; +Cc: caml-list

From: artboreb@netscape.net (Arturo Borquez)

> I have applied de patch and the problem persists, rebuilding
> 3.07 with the last hours CVS sources yields same results, so I've
> reinstalled 3.07+beta2.

Then you should imperatively submit a bug report reproducing the
problem. The CVS version is supposed to be fixed for all camlp4 bugs
that have been reported up to now.

Jacques Garrigue

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] ocaml 3.07 and optional arguments
@ 2003-10-01 20:28 Arturo Borquez
  2003-10-01 23:51 ` Jacques Garrigue
  0 siblings, 1 reply; 11+ messages in thread
From: Arturo Borquez @ 2003-10-01 20:28 UTC (permalink / raw)
  To: Alain.Frisch; +Cc: caml-list

Alain.Frisch@ens.fr wrote:

>On Wed, 1 Oct 2003, Yaron Minsky wrote:
>
>> Having been bitten by this bug myself (which appears to hit labeled
>> arguments in general, not just optional arguments), I'd be quite eager for
>> a rerelease of 3.07 (3.07.1?) that fixes this problem.  It's a pretty
>> serious bug, especially if camlp4 is to be thought of as a real part of
>> the core system.
>
>I second that. Hopefully, OCaml 3.07+beta2 is still available, because it
>is the only version that can compile the CVS branch of CDuce... Please
>don't remove it!
>
>-- Alain
>

I have applied de patch and the problem persists, rebuilding
3.07 with the last hours CVS sources yields same results, so I've
reinstalled 3.07+beta2.

Best regards

-- 
Arturo Borquez


__________________________________________________________________
McAfee VirusScan Online from the Netscape Network.
Comprehensive protection for your entire computer. Get your free trial today!
http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397

Get AOL Instant Messenger 5.1 free of charge.  Download Now!
http://aim.aol.com/aimnew/Aim/register.adp?promo=380455

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] ocaml 3.07 and optional arguments
  2003-09-30  3:07   ` Jacques Garrigue
@ 2003-09-30  5:29     ` Vincent Barichard
  0 siblings, 0 replies; 11+ messages in thread
From: Vincent Barichard @ 2003-09-30  5:29 UTC (permalink / raw)
  To: garrigue; +Cc: CAML LIST

 Thanks for your answer, the add of explicite parenthesis allows the
compilation to work fine. It's a bit long to add parenthesis in all the
sources, but I hope the next release will fix this bug.

Vincent
 
-------Original Message-------
 
From: Jacques Garrigue
Date: mardi 30 septembre 2003 05:07:27
To: Vincent.Barichard@info.univ-angers.fr
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] ocaml 3.07 and optional arguments
 
> From: "Vincent Barichard" <Vincent.Barichard@info.univ-angers.fr>
>
> > I've just downloaded ocaml 3.07 and compil it. But when I try to compil
old
> > programs, I encounter some problems with optional arguments in methods.
> [...]
> > Is there any changes with the use of optional arguments for methods ?
>
> I don't remember introducing any change at that level.
 
After another bug report, it seems that a parsing bug went into camlp4
just before the release :-(
 
Camlp4 Parsing version 3.07
 
# fun (f : ?x:int -> bool -> float) -> f true;;
This expression has type bool but is here used with type ?x:int -> bool
# fun (f : ?x:int -> bool -> float) -> f;;
- : ((?x:int -> bool) -> float) -> (?x:int -> bool) -> float = <fun>
 
This is apparently a priority problem.
A workaround is to explicitly add parentheses.
 
# fun (f : ?x:int -> (bool -> float)) -> f true;;
- : (?x:int -> bool -> float) -> float = <fun>
 
There is no fix for camlp4 itself yet.
 
Jacques Garrigue
 
.

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] ocaml 3.07 and optional arguments
  2003-09-30  1:24 ` Jacques Garrigue
@ 2003-09-30  3:07   ` Jacques Garrigue
  2003-09-30  5:29     ` Vincent Barichard
  0 siblings, 1 reply; 11+ messages in thread
From: Jacques Garrigue @ 2003-09-30  3:07 UTC (permalink / raw)
  To: Vincent.Barichard; +Cc: caml-list

> From: "Vincent Barichard" <Vincent.Barichard@info.univ-angers.fr>
> 
> > I've just downloaded ocaml 3.07 and compil it. But when I try to compil old
> > programs, I encounter some problems with optional arguments in methods.
> [...]
> > Is there any changes with the use of optional arguments for methods ?
> 
> I don't remember introducing any change at that level.

After another bug report, it seems that a parsing bug went into camlp4
just before the release :-(

        Camlp4 Parsing version 3.07

# fun (f : ?x:int -> bool -> float) -> f true;;
This expression has type bool but is here used with type ?x:int -> bool
# fun (f : ?x:int -> bool -> float) -> f;;
- : ((?x:int -> bool) -> float) -> (?x:int -> bool) -> float = <fun>

This is apparently a priority problem.
A workaround is to explicitly add parentheses.

# fun (f : ?x:int -> (bool -> float)) -> f true;;
- : (?x:int -> bool -> float) -> float = <fun>

There is no fix for camlp4 itself yet.

      Jacques Garrigue

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] ocaml 3.07 and optional arguments
  2003-09-29 18:13 Vincent Barichard
@ 2003-09-30  1:24 ` Jacques Garrigue
  2003-09-30  3:07   ` Jacques Garrigue
  0 siblings, 1 reply; 11+ messages in thread
From: Jacques Garrigue @ 2003-09-30  1:24 UTC (permalink / raw)
  To: Vincent.Barichard; +Cc: caml-list

From: "Vincent Barichard" <Vincent.Barichard@info.univ-angers.fr>

> I've just downloaded ocaml 3.07 and compil it. But when I try to compil old
> programs, I encounter some problems with optional arguments in methods.
[...]
> Is there any changes with the use of optional arguments for methods ?

I don't remember introducing any change at that level.

Your exemple is not detailed enough that I can infer the real cause.
You should submit a bug report including a minimal set of sources
producing the error.

A reasonable hypothesis is that you have fallen into the
non-principality of optional arguments (which is explained in the
manual). Try compiling your sources with ocaml 3.06, adding the option
ocamlc -principal.

If it tells you that some use is not principal, then the cause is the
increased polymorphism in 3.07: some type sharing appearing in 3.06
does not appear in 3.07. In general more polymorphism is a good thing,
but with non-principal features it may introduce incompatibilities.
Here, this would mean that you need another type annotation elsewhere.

Byt the way, why do you write
(sol#scalarizingFunction : ?weightVector':Solution.cWeightVector -> Solution
cPoint -> float)
rather than  "(sol : #Solution.solution)#scalarizingFunction"  ?

Jacques Garrigue

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Caml-list] ocaml 3.07 and optional arguments
@ 2003-09-29 18:13 Vincent Barichard
  2003-09-30  1:24 ` Jacques Garrigue
  0 siblings, 1 reply; 11+ messages in thread
From: Vincent Barichard @ 2003-09-29 18:13 UTC (permalink / raw)
  To: CAML LIST

Hi all,

I've just downloaded ocaml 3.07 and compil it. But when I try to compil old
programs, I encounter some problems with optional arguments in methods.
In fact I have the following method in a class called Solution:

 method scalarizingFunction ?weightVector' referenceSolution =
    match weightVector' with
     None -> self#doScalarizingFunction referenceSolution
    | Some y -> self#doScalarizingFunction' y referenceSolution

where referencePoint is a Solution.cPoint type object, and weighVector' a
Solution.weightVector type object.
and in another source file, I have the call:

  let newScalarizingFunctionValue = 
(sol#scalarizingFunction : ?weightVector':Solution.cWeightVector -> Solution
cPoint -> float) referencePoint in .....

With ocaml 3.06, It compiles fine, but with ocaml 3.07 I'va got the
following error:

ocamlc -I ../Common -I ../Exact -I ../TS -I ../SA -I ../EA -I ../HGA -g -pp
camlp4o unix.cma -c ../SA/mOSA.ml
File "../SA/mOSA.ml", line 64, characters 135-149:
This expression has type
  Solution.cPoint =
    < augment : Solution.cPoint -> Solution.cPoint -> unit;
      compare : Solution.cPoint -> Global.comparison; copy : Solution.cPoint

      distance : Solution.cPoint ->
                 Solution.cPoint -> Solution.cPoint -> float;
      get_OV : int -> float; get_OV_size : int;
      linearScalarizingFunction : Solution.cWeightVector ->
                                  Solution.cPoint -> float;
      load : char Stream.t -> unit;
      minmaxScalarizingFunction : Solution.cWeightVector ->
                                  Solution.cPoint -> float;
      save : out_channel -> unit; set_OV : int -> float -> unit >
but is here used with type
  ?weightVector':Solution.cWeightVector -> Solution.cPoint
make: *** [../SA/mOSA.cmo] Error 2

Is there any changes with the use of optional arguments for methods ?
I didn't find any clue in the ocaml 3.07 documentation.

Thanks you for your help.

Vincent

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2003-10-01 23:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-30 19:18 [Caml-list] ocaml 3.07 and optional arguments Arturo Borquez
2003-10-01  0:04 ` Jacques Garrigue
2003-10-01  8:43   ` Christophe Raffalli
2003-10-01 15:45     ` Yaron Minsky
2003-10-01 15:54       ` Alain.Frisch
  -- strict thread matches above, loose matches on Subject: below --
2003-10-01 20:28 Arturo Borquez
2003-10-01 23:51 ` Jacques Garrigue
2003-09-29 18:13 Vincent Barichard
2003-09-30  1:24 ` Jacques Garrigue
2003-09-30  3:07   ` Jacques Garrigue
2003-09-30  5:29     ` Vincent Barichard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).