This is a design decision taken by OCaml, F# and several other type-inferred languages to ensure successful type inference with good error messages. The idea is that you pay a small tax when writing numeric literals (you have to distinguish the type of the literal), but other code is given a good inferred type automatically. Technically speaking it basically means that the constraints propagated through the inference process don't require backtracking to solve. This in turn means there is a canonical representation of type information and helps us give good error messages.

For example if we have "let g x y = (f x, f y)" and "f" has type "double -> double" then in F# we know for sure that "x" and "y" are also of type "double". This lets us infer the type for "g". If we had implicit conversions on function calls then we wouldn't know what type to give "g" - it could be "int * int -> double * double", "double * int -> double * double" etc. etc.

F# does support a couple of minor type-directed implicit conversions when applying OO members: e.g. lambda functions can be automatically converted to delegates, and reference cells to byrefs.

Kind regards

don

By on 7/24/2007 5:18 PM ()

And the fact that designing a language requires the ability to think that far ahead is why I'm a normal developer and not an architect, sports fans.

DC

By on 7/24/2007 7:26 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper