【发布时间】:2014-02-08 22:23:09
【问题描述】:
当我想检查有关函子声明的语法时,我提出了这个问题。我遇到了两个相互矛盾的语法定义,而 Standard ML '97 的语法,顾名思义,应该是标准的一部分,在“标准 ML 的定义——修订版”中定义。
从书中
“The definition of Standard ML — Revised”, by R. Milner, page 14, on Google Books 说:
fundec ::= functor funbinf
funbind ::= funid (strid : sigexp) = strexp <and funbind>
我把它读作“一个函子只得到一个参数,不能说匹配一个签名”。
来自其他可靠来源
“Standard ML syntax summary”, by L. Paulson, page 2, on PDF 说(使用与 SML '97 定义中相同的符号近似重新表达的模式):
FunctorDeclaration ::= functor FunctorBinding <and FunctorBinding>
FunctorBinding ::= Ident ( FunctorArguments ) : Signature = Structure
FunctorArguments ::= Ident : Signature | Specification
我把它读作“一个函子可能有多个参数,可以说是匹配一个签名”。
问题
这两个文件说的不同,所以我很困惑。 Standard ML '97 的真正定义是什么?还是我只是错过了阅读标准定义?
【问题讨论】: