module container中的sharing type的问题

fishmacs's picture

SML中的module container可以用sharing type来限定内部各模块间的sharing constraints:

signature RelaxPSig = sig
    structure Graph : EdgeGraphSig
    structure WMap : ReadablePropertyMapSig
    structure DMap : ReadWritePropertyMapSig
    structure PMap : ReadWritePropertyMapSig

    sharing type DMap.key_t =
                 PMap.key_t =
                 PMap.value_t =
                 Graph.vertex_t
end

ocaml没有提供sharing type, 只能用with来做sharing constraints. 但是在moudle container中如何使用with呢?
下面的代码会造成Syntax error:
 

...... full content is only available to community members.

code17's picture

类似

...... full content is only available to community members.

fishmacs's picture

又犯错误了

...... full content is only available to community members.

fishmacs's picture

对了,还有个问题

...... full content is only available to community members.

code17's picture

指的是 SML'97 修订的这个语义?

...... full content is only available to community members.

fishmacs's picture

这样写不行的

...... full content is only available to community members.

code17's picture

Unbound 是因为顺序问题

...... full content is only available to community members.

fishmacs's picture

顺序应该没有问题的

...... full content is only available to community members.

code17's picture

或者说缺一个 module 的 "self"

...... full content is only available to community members.

fishmacs's picture

实际上我觉得with module不光涵盖了types, 还包括values

...... full content is only available to community members.

code17's picture

Given X:A, Y:B with module Y = X

...... full content is only available to community members.

fishmacs's picture

按照我看到的说法,sharing只是在不同signatures的同名types之间产生约束

...... full content is only available to community members.

code17's picture

上面说的正是 OCaml

...... full content is only available to community members.