Browse thread
Question about type unification
[
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: | Robert Fischer <robert@f...> |
| Subject: | Re: [Caml-list] Question about type unification |
Ahh. Yeah, I see it now -- the output wasn't a string, but a float. It just has the word "string" in the type name to confuse me. ~~ Robert. DooMeeR wrote: > Robert Fischer a écrit : >> How is the compiler magically getting from the float to a string >> value? Can someone break down >> what's actually happening here for me? > > It's not "getting to" a "string" value but to a "string t" value, which > is an abbreviation for "float". The value has type "float", but the user > requires type "string t", so the compiler unifies "float" and "string t" > which is actually "float" so it's ok, and then the compiler gives the > type requested by the user to the value, i.e., "string t". > > Well, at least, this is how I understand this :) >