| Anonymous | Login | Signup for a new account | 2013-06-19 09:07 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | |||
| 0000151 | OCaml | OCaml general | public | 2000-06-30 01:11 | 2000-06-30 03:29 | |||
| Reporter | administrator | |||||||
| Assigned To | ||||||||
| Priority | normal | Severity | minor | Reproducibility | always | |||
| Status | closed | Resolution | fixed | |||||
| Platform | OS | OS Version | ||||||
| Product Version | ||||||||
| Target Version | Fixed in Version | |||||||
| Summary | 0000151: Optional class arguments | |||||||
| Description | Full_Name: Gerd Stolpmann Version: 3.00 OS: Linux Submission from: p3e9c36a8.dip0.t-ipconnect.de (62.156.54.168) Hi, this does not work (classical mode): class x ?(p = 1) () = object val v = p method m = new x ~p:2 () end Error: "The expression "new x" has type ?p:int -> unit -> x but is used with type 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. | |||||||
| Attached Files | ||||||||
Notes |
|
|
(0000410) administrator (administrator) 2000-06-30 03:28 |
> 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 > type > 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 inside the class, only after it has been defined. I admit this can be disturbing, since for "let rec" definitions special processing is done in order to provide such type information. I added such preprocessing for classes too, and your example now compiles correctly. Jacques |
|
(0000411) administrator (administrator) 2000-06-30 03:29 |
Fixed by Jacques on 2000-06-30. (Added an approximation of the class constructor) |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2005-11-18 10:13 | administrator | New Issue | |
| Copyright © 2000 - 2011 MantisBT Group |