Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] ocaml 3.07 and optional arguments
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@k...>
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