相关疑难解决方法(0)

两个记录中的两个字段在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 }
Run Code Online (Sandbox Code Playgroud)

我稍后遇到一行代码错误: Error: The record field label typ belongs to the type Syntax.func but is mixed here with labels of type Syntax.name

任何人都可以告诉我,如果我们不应该有两个记录具有相同标签的两个字段,就像typ这里一样,这会使编译器混淆.

ocaml types record

9
推荐指数
2
解决办法
1872
查看次数

标签 统计

ocaml ×1

record ×1

types ×1