【问题标题】:Sml how to use "nested" structuresSml 如何使用“嵌套”结构
【发布时间】:2014-02-22 14:22:03
【问题描述】:

如何在 SML 中定义“嵌套结构”,以便我可以做类似的事情:

structure Why_Does =
  struct
     val seriously = "..."

     Structure This_Not_Work =
       struct
          val hmm = "this confuses me"
       end
  end

然后使用Why_Does.This_Not_Work.hmm ?

我得到一个Error: unbound structure: This_Not_Work in path Why_Does.This_Not_Work.hmm 异常

【问题讨论】:

    标签: sml smlnj


    【解决方案1】:

    在您的代码中,您输入了带有大写 S 的“Structure”,这是错误的 - 也许这就是问题所在?如果我解决了这个问题,你的代码在 mosml 中对我来说就很好了。

    【讨论】:

    • structure 的拼写错误不是问题。我正在运行 SM/NJ,所以他们处理模块的方式可能会有所不同。
    • @HenrikSommerland,它在 SML/NJ 也能正常工作。您确定您没有输入错误或输入错误的内容吗?
    猜你喜欢
    • 2021-05-26
    • 2020-09-28
    • 2021-09-05
    • 1970-01-01
    • 1970-01-01
    • 2020-03-14
    • 1970-01-01
    • 2022-01-08
    • 1970-01-01
    相关资源
    最近更新 更多