Browse thread
Why + vs +. but "fake" parametric polymorphism for <
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Gerd Stolpmann <info@g...> |
| Subject: | Re: [Caml-list] Why + vs +. but "fake" parametric polymorphism for < |
Am Freitag, den 13.10.2006, 13:56 +0200 schrieb Diego Olivier FERNANDEZ PONS: > Bonjour, > > Quoting Jonathan Roewen <jonathan.roewen@gmail.com>: > > That's correct. As showed, specifying types somewhere (as I did with > > the return type, and someone else did for a given parameter), type > > inference deduces the types of the parameters and return values, > > allowing it optimise. > > As far as I remember it doesn't work when you specify the type in the > .mli file. And I never understood really why. Well, this is quite easy. The .mli file does not influence code generation. Code is generated when the .ml file is compiled, and it is only _checked_ afterwards if the types match the .mli file. This is simply the logic of the .mli. That an inlined function cannot be specialized afterwards has a similar reason, because the part of code generation is already over that decides whether the mono or polymorphic version is generated. This could be probably be changed (but I don't know the details, so maybe this would break something else). Gerd -- ------------------------------------------------------------ Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany gerd@gerd-stolpmann.de http://www.gerd-stolpmann.de Phone: +49-6151-153855 Fax: +49-6151-997714 ------------------------------------------------------------