If anyone knows OCaml, could you tell me why field names alias those of other records? Is this just a product of the type inference or is there some deeper reason?
It seems unnecessarily limiting to me, but I'm not really deep enough into it to tell how much I'll be using records from the same namespace.
>>8
Eg.: # type one = { a: int; b: float; };;
type one = { a : int; b : float; }
# type two = { c: int; a: float; };;
type two = { c : int; a : float; }
# let x = { b = 3.; a = 4; };;
Error: The record field label a belongs to the type two
but is mixed here with labels of type one
The inferencer is very eager to come to a decision. If I specify 'a' first, the error just complains about int vs. float and leaves it at that.
Name:
Anonymous2010-12-07 8:45
Ah, indeed. It's a minor annoyance though: you don't need too much records in one module usually.