在我的 ml 程序中,我使用嵌套结构来构建我的代码。我正在为这些结构定义签名 - 但我无法真正嵌套签名。
例子:
structure Example =
struct
structure Code =
struct
datatype mytype = Mycons of string
end
end
为此,我想做这样的事情:
signature EXAMPLE =
sig
signature CODE = (* or stucture Code - doesn't matter *)
sig
datatype mytype
end
end
现在这不起作用;我收到语法错误。我的问题:
- 这是一个坏主意吗?如果是这样,为什么?
- 我该怎么做?如何将嵌套签名应用于嵌套结构?