标准 ML 中的行注释

发布于 2024-08-17 09:22:03 字数 102 浏览 9 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

无畏 2024-08-24 09:22:03

你被块评论困住了。

另一方面,块注释可以嵌套:(* (* *) still comment here *)

You're stuck with block comments.

On the other hand, block comments can be nested: (* (* *) still comment here *)

你是我的挚爱i 2024-08-24 09:22:03

有一个用于行注释的 RFC, 它提出了一个井号标记,后跟一个空白。

There is a RFC for line comments, which proposes a hashmark followed by a whitespace.

≈。彩虹 2024-08-24 09:22:03

现在,只要您启用 sML(“后继 ML”)扩展(对于 SML/NJ,sml -Cparser.succ-ml=true),MLton 和 SML/NJ 中都会提供单行注释。

这是一个具体的例子。在下面的定义中,值 1 被忽略,而 a 的定义取自下一行 (2)。 (下面的 = 表示续行,请忽略损坏的语法突出显示。)

$ sml -Cparser.succ-ml=true
- val a = (*) 1
=   2;;
val a = 2 : int

请参阅 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 of a is taken from the next line (2) instead. (Below = denotes a continuation line, and please ignore the broken syntax highlighting.)

$ sml -Cparser.succ-ml=true
- val a = (*) 1
=   2;;
val a = 2 : int

See https://github.com/SMLFamily/Successor-ML/wiki/Summary-of-proposed-changes for more about sML.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文