我定義了兩個記錄類型:兩個領域有相同的標籤OCaml中
type name =
{ r0: int; r1: int; c0: int; c1: int;
typ: dtype;
uid: uid (* key *) }
and func =
{ name: string;
typ: dtype;
params: var list;
body: block }
而且我得到了一個錯誤之後的一行代碼:Error: The record field label typ belongs to the type Syntax.func but is mixed here with labels of type Syntax.name
誰能告訴我,如果我們不應該有兩個記錄中的兩個字段具有相同的標籤,如typ
,這會使編譯器感到困惑。
更新:自OCaml版本4.01.0以來,刪除了對唯一記錄字段標籤的要求。 –
@Str。我認爲只有名稱有不同的類型纔是真實的,這在這裏不適用。 – johnbakers