Ruby 是否有正式的规范(如 Java 语言规范 (JLS))?

发布于 2024-09-10 07:26:42 字数 172 浏览 7 评论 0原文

Ruby 是否有一个明确的规范,类似于 Java 的 Java 语言规范。谷歌搜索 ruby​​ 语言规范提供了 http://ruby-std.netlab.jp/ 结果,但是该网站已关闭,我不确定它是否是最新的

Is there a definitive specification for Ruby, akin to the Java Language Specification for Java. Googling ruby language specification provides http://ruby-std.netlab.jp/ as a result, but the site is down and i am not sure whether it is current

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

假装爱人 2024-09-17 07:26:42

草案用于Ruby 的正式规范。它由开放标准推广中心开发http://WWW.IPA.Go.Jp/index-e.html" rel="nofollow noreferrer">信息技术振兴机构(日本政府机构)提交给 日本工业标准委员会,然后进一步访问 国际标准化组织

然而,没有人真正使用这个规范。 实际使用的规范是直接可执行的 RubySpec,所有主要 Ruby 实现者都使用它,例如 Rubinius、< a href="http://IronRuby.Net/" rel="nofollow noreferrer">IronRuby, JRuby, MacRuby, 磁悬浮等等。

ISO 草案规范和 RubySpec 之间的三个主要区别是:

  1. RubySpec 是完整的:它涵盖了整个 Ruby 语言以及整个核心库,从版本 1.8.7 到 1.9.2 和 1.9.3 。 ISO 规范草案仅涵盖 1.8 和 1.9 交集的一小部分。
  2. RubySpec 是用 Ruby 编写的(这是一种每个 Ruby 专家都可以阅读的语言),ISO 草案规范是用英语编写的,或者更确切地说是用 ISO Standardese(这是一种只有少数人使用的语言)编写的。这个星球可以完全理解)。
  3. RubySpec 是可执行:您可以针对您的 Ruby 实现运行它,看看您还缺少什么。

有关 Ruby 行为的另一个重要来源(双关语)是 源代码Rubinius内核,它实现了Ruby语言和Ruby核心库的语义。 (注意:很多人更喜欢 源代码 YARV,但我不这样做,原因有两个:首先,YARV 是 C 语言,并不是每个 Ruby 专家都知道这种语言,而 Rubinius 是(希望)每个 Rubiyst 都知道 Ruby,其次,Rubinius 代码库的结构更好,设计良好,组织良好,测试良好,文档齐全。)

There is a draft for a formal specification of Ruby. It is being developed by the Open Standards Promotion Center of the Information-Technology Promotion Agency (a Japanese government agency) for submission to the Japanese Industrial Standards Committee and then further on to the International Organization for Standardization.

However, nobody actually uses this specification. The specification that is actually being used is the directly executable RubySpec, which is used by all the major Ruby implementors like Rubinius, IronRuby, JRuby, MacRuby, MagLev and so on.

The three main differences between the ISO Draft Specification and RubySpec are:

  1. RubySpec is complete: it covers the entire Ruby language, and the entire core library, from version 1.8.7 to 1.9.2 and 1.9.3. The ISO Draft Specification only covers a very small subset of the intersection of 1.8 and 1.9.
  2. RubySpec is written in Ruby (which is a language that every Rubyist can read), the ISO Draft Specification is written in English, or rather in ISO Standardese (which is a language that only a handful of people on the planet can fully understand).
  3. RubySpec is executable: you can just run it against your Ruby implementation to see what you are still missing.

Another great source (pun intended) of information about the behavior of Ruby is the source code of the Rubinius kernel, which implements the semantics of the Ruby language and the Ruby core library. (Note: a lot of people prefer the source code of YARV, but I don't, for two reasons: firstly, YARV is in C, which is a language that not every Rubyist knows, whereas Rubinius is in Ruby, which (hopefully) every Rubiyst knows, and secondly, the Rubinius codebase is much better structured, well-designed, well-organized, well-tested, well-documented.)

腹黑女流氓 2024-09-17 07:26:42

Ruby 1.8 已成为多个行业标准的主题。 Ruby 的语言规范由信息技术促进机构的开放标准促进中心(日本政府 机构)提交给日本工业标准委员会 (JISC),然后提交给国际标准化组织 (ISO)。它于 2011 年被接受为日本工业标准 (JIS X 3017)[24] 和国际标准 (ISO/IEC 30170),2012 年。[25]

参考文献

另请参阅

Ruby 1.8 has been the subject of several industry standards. The language specifications for Ruby were developed by the Open Standards Promotion Center of the Information-Technology Promotion Agency (a Japanese government agency) for submission to the Japanese Industrial Standards Committee (JISC) and then to the International Organization for Standardization (ISO). It was accepted as a Japanese Industrial Standard (JIS X 3017) in 2011[24] and an international standard (ISO/IEC 30170) in 2012.[25]

References

See also

小伙你站住 2024-09-17 07:26:42

如果您转到

https://docs.ruby-lang.org/ en/2.6.0/syntax_rdoc.html

https://www.ruby -lang.org/en/documentation/

“官方 Ruby API 文档”

https:// /docs.ruby-lang.org/en/

https:// docs.ruby-lang.org/en/2.6.0/

然后在“页面”下选择“语法”

然后您将看到此页面,其中包含指向其他相关页面的链接

https://docs.ruby-lang.org/en/2.6.0/syntax_rdoc.html

Ruby 语法很大,分为以下几个部分:

文字
数字、字符串、数组、哈希等

赋值
赋值和变量

控制表达式
if、unless、while、until、for、break、next、redo

方法
方法和方法参数语法

调用方法
如何调用方法(或向方法发送消息)

模块和类
创建模块和类,包括继承

异常
异常处理语法

优先级
ruby 运算符的优先级

改进
实验性改进功能的使用和行为

其他
别名、undef、开始、结束

If you go to

https://docs.ruby-lang.org/en/2.6.0/syntax_rdoc.html

or

https://www.ruby-lang.org/en/documentation/

"The official Ruby API documentation"

https://docs.ruby-lang.org/en/

https://docs.ruby-lang.org/en/2.6.0/

then under 'pages' choose 'syntax'

Then you get this page, with its links to other relevant pages

https://docs.ruby-lang.org/en/2.6.0/syntax_rdoc.html

The Ruby syntax is large and is split up into the following sections:

Literals
Numbers, Strings, Arrays, Hashes, etc.

Assignment
Assignment and variables

Control Expressions
if, unless, while, until, for, break, next, redo

Methods
Method and method argument syntax

Calling Methods
How to call a method (or send a message to a method)

Modules and Classes
Creating modules and classes including inheritance

Exceptions
Exception handling syntax

Precedence
Precedence of ruby operators

Refinements
Use and behavior of the experimental refinements feature

Miscellaneous
alias, undef, BEGIN, END

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