|Anonymous | Login | Signup for a new account||2014-08-01 05:48 CEST|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000151||OCaml||OCaml general||public||2000-06-30 01:11||2000-06-30 03:29|
|Target Version||Fixed in Version|
|Summary||0000151: Optional class arguments|
|Description||Full_Name: Gerd Stolpmann|
Submission from: p3e9c36a8.dip0.t-ipconnect.de (126.96.36.199)
this does not work (classical mode):
class x ?(p = 1) () =
val v = p
method m =
new x ~p:2 ()
Error: "The expression "new x" has type ?p:int -> unit -> x but is used with
int -> unit -> 'a"
new x ~p:2 () from outside the class works (if I comment m out).
If I change the method m to:
method m = new x ?p:(Some 2) ()
it works again, too.
This looks very strange, and I think it is a bug.
|Tags||No tags attached.|
> Full_Name: Gerd Stolpmann
> this does not work (classical mode):
> class x ?(p = 1) () =
> object method m = new x ~p:2 () end
> Error: "The expression "new x" has type ?p:int -> unit -> x but is used with
> int -> unit -> 'a"
> This looks very strange, and I think it is a bug.
This is again due to the the non-principality of the typing of optionals.
That is, in 3.00 the type information for the constructor is not available
the class, only after it has been defined.
I admit this can be disturbing, since for "let rec" definitions special
is done in order to provide such type information.
I added such preprocessing for classes too, and your example now compiles
Fixed by Jacques on 2000-06-30.
(Added an approximation of the class constructor)
|2005-11-18 10:13||administrator||New Issue|
|Copyright © 2000 - 2011 MantisBT Group|