2
在我的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
现在,这并不正常工作;我得到语法错误。我的问题:
- 这是一个坏主意吗?如果是这样,为什么?
- 我该怎么做?如何将嵌套签名应用于嵌套结构?