标准 ML 中的行注释
我正在使用 SML/NJ 方言学习 ML。我想弄清楚的是是否有行注释运算符。我找到了块注释运算符 (* ... *),但我真的很怀念行注释。
建议?或者我只是被块评论困住了?
I'm learning ML, with the SML/NJ dialect. What I'm trying to figure out is if there is a line comment operator. I found the block comment operator, (* ... *), but I really miss line comments.
Suggestions? Or am I just stuck with block comments?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你被块评论困住了。
另一方面,块注释可以嵌套:
(* (* *) still comment here *)
You're stuck with block comments.
On the other hand, block comments can be nested:
(* (* *) still comment here *)
有一个用于行注释的 RFC, 它提出了一个井号标记,后跟一个空白。
There is a RFC for line comments, which proposes a hashmark followed by a whitespace.
现在,只要您启用 sML(“后继 ML”)扩展(对于 SML/NJ,
sml -Cparser.succ-ml=true
),MLton 和 SML/NJ 中都会提供单行注释。这是一个具体的例子。在下面的定义中,值
1
被忽略,而a
的定义取自下一行 (2
)。 (下面的=
表示续行,请忽略损坏的语法突出显示。)请参阅 https://github.com/SMLFamily/Successor-ML/wiki/Summary-of-propose-changes 了解有关 sML 的更多信息。
Single-line comments now ship in both MLton and SML/NJ, as long as you enable sML ("Successor ML") extensions (
sml -Cparser.succ-ml=true
for SML/NJ).Here's a concrete example. In the definition below, the value
1
is ignored, and the definition ofa
is taken from the next line (2
) instead. (Below=
denotes a continuation line, and please ignore the broken syntax highlighting.)See https://github.com/SMLFamily/Successor-ML/wiki/Summary-of-proposed-changes for more about sML.