Content deleted Content added
→History: under construction -> in use |
Removed 6 redlinks via script. |
||
(33 intermediate revisions by 15 users not shown) | |||
Line 1:
{{Short description|General-purpose programming language}}
{{distinguish|Ruby on Rails}}
{{infobox programming language
| logo = Ruby logo.svg
Line 28 ⟶ 27:
== History ==
=== Early concept ===
{{Blockquote|I was talking with my colleague about the possibility of an object-oriented scripting language. I knew Perl (Perl4, not Perl5), but I didn't like it really, because it had the smell of a [[toy language]] (it still has). The object-oriented language seemed very promising. I knew [[Python (programming language)|Python]] then. But I didn't like it, because I didn't think it was a true object-oriented language{{snd}} OO features appeared to be add-on to the language. As a language maniac and OO fan for 15 years, I really wanted a genuine object-oriented, easy-to-use scripting language. I looked for but couldn't find one. So I decided to make it.}}
Matsumoto
The name "Ruby" originated during an online chat session between Matsumoto and Keiju Ishitsuka on 24 February
=== Early releases ===
The first public release of Ruby 0.95 was announced on Japanese domestic [[newsgroup]]s on
Already present at this stage of development were many of the features familiar in later releases of Ruby, including [[object-oriented programming|object-oriented]] design, [[class (computer science)|classes]] with inheritance, [[mixin]]s, [[iterator]]s, [[Closure (computer science)|closures]], [[exception handling]] and [[Garbage collection (computer science)|garbage collection]].<ref name="tutorial-features"/>
After the release of Ruby 0.95 in 1995, several stable versions of Ruby were released in these years
In 1997, the first article about Ruby was published on the Web. In the same year, Matsumoto was hired by [[Network Applied Communication Laboratory|netlab.jp]] to work on Ruby as a full-time developer.<ref name="rubyconf-history-of-ruby"/>
In 1998, the Ruby Application Archive was launched by Matsumoto, along with a simple English-language homepage for Ruby.<ref name="rubyconf-history-of-ruby"/>
Line 60 ⟶ 54:
=== Ruby 1.8 and 1.9 ===
Ruby 1.8 was initially released August 2003, was stable for a long time, and was retired June 2013.<ref name="1.8.7-retirement"/> Although deprecated, there is still code based on it. Ruby 1.8 is only partially compatible with Ruby 1.9.{{cn|date=April 2025}}
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 [[Government of Japan|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<ref name="JIS X 3017"/> and an international standard (ISO/IEC 30170) in 2012.<ref name="IPA"/><ref name="IEC 30170"/>
Line 66 ⟶ 60:
Around 2005, interest in the Ruby language surged in tandem with [[Ruby on Rails]], a [[web framework]] written in Ruby. Rails is frequently credited with increasing awareness of Ruby.<ref name="Devarticles"/>
Effective with Ruby 1.9.3, released 31 October
=== Ruby 2 ===
Ruby 2.0 was intended to be fully backward compatible with Ruby 1.9.3. As of the official 2.0.0 release on 24 February
Starting with 2.1.0, Ruby's versioning policy changed to be more similar to [[semantic versioning]], although it differs slightly in that minor version increments may be API incompatible.<ref name="semantic-versioning"/>
Ruby 2.2.0 includes speed-ups, bugfixes, and library updates and removes some deprecated APIs. Most notably, Ruby 2.2.0 introduces changes to memory handling{{snd}}an incremental garbage collector, support for garbage collection of symbols and the option to compile directly against jemalloc. It also contains experimental support for using [[vfork]](2) with system() and spawn(), and added support for the [[Unicode]] 7.0 specification. Since version 2.2.1,<ref name="2-2-1-release"/> [[Ruby (programming language)#Matz's Ruby interpreter|Ruby MRI]] performance on [[ppc64|PowerPC64]] was improved.<ref name="2-2-1-changelog"/><ref name="Pedrosa-1"/><ref name="Pedrosa-2"/> Features that were made obsolete or removed include callcc, the DL library, Digest::HMAC, lib/rational.rb, lib/complex.rb, GServer, Logger::Application as well as various C API functions.<ref name="obsolete-or-gone-in-2.2"/>
Line 114 ⟶ 95:
=== Ruby 3 ===
Ruby 3.0.0 was released on [[Christmas]] Day in 2020.<ref name="Ruby 3.0.0 Released"/> It is known as Ruby 3x3, which
Another goal of Ruby 3.0 is to improve [[Concurrency (computer science)|concurrency]] and two more utilities Fibre Scheduler, and experimental Ractor facilitate the goal.<ref name="Ruby 3.0.0 Released"/> Ractor is light-weight and thread-safe as it is achieved by exchanging messages rather than shared objects.
Line 122 ⟶ 103:
There are some syntax enhancements and library changes in Ruby 3.0 as well.<ref name="Ruby 3.0.0 Released"/>
Ruby 3.1 was released on
Ruby 3.2 was released on 25 December
Ruby 3.3 was released on 25 December
Ruby 3.4 was released on 25 December 2024.<ref name="Ruby 3.4.0 Released">{{cite web|url=https://www.ruby-lang.org/en/news/2024/12/25/ruby-3-4-0-released/ |title=Ruby 3.4.0 Released |date=2024-12-25 |access-date=2025-04-12}}</ref> Ruby 3.4 adds <code>it</code> block parameter reference, changes Prism as default parser, adds [[Happy Eyeballs]] Version 2 support to socket library, improves YJIT, adds modular Garbage Collector and so on.<ref>{{cite web |url=https://docs.ruby-lang.org/en/3.4/NEWS_md.html |title=NEWS - Documentation for Ruby 3.4 |access-date=2025-04-12}}</ref>
== Semantics and philosophy ==
Line 153 ⟶ 136:
== Features ==
* Thoroughly [[Object-oriented programming|object-oriented]] with [[Inheritance (object-oriented programming)|inheritance]], [[mixin]]s and [[metaclass]]es<ref name="stewart" />
* [[Dynamic typing]] and [[duck typing]]
* Everything is an [[Expression (programming)|expression]] (even [[Statement (programming)|statements]]) and everything is executed [[Imperative programming|imperatively]] (even [[Declaration (computer science)|declarations]])
Line 176 ⟶ 159:
* Centralized package management through [[RubyGems]]
* Implemented on all major platforms
* Large standard library, including modules for [[YAML]], [[JSON]], [[XML]], [[Common Gateway Interface|CGI]], [[OpenSSL]], [[HTTP]], [[FTP]], [[RSS]], [[curses (programming library)|curses]], [[zlib]] and [[Tk (software)|Tk]]<ref name="stdlib-
* [[Just-in-time compilation]]
Line 200 ⟶ 183:
=== Alternative implementations ===
{{As of|2018}}, there are a number of alternative implementations of Ruby, including [[JRuby]], [[Rubinius]], and [[mruby]]. Each takes a different approach, with JRuby and Rubinius providing [[just-in-time compilation]] and mruby also providing [[ahead-of-time compilation]].
Line 207 ⟶ 190:
* [[JRuby]], a mixed [[Java (programming language)|Java]] and Ruby implementation that runs on the [[Java virtual machine]]. JRuby currently targets Ruby 3.1.x.
*
* [[Rubinius]], a [[C++]] bytecode virtual machine that uses [[LLVM]] to compile to machine code at runtime. The bytecode compiler and most core classes are written in pure Ruby. Rubinius currently{{when|date=April 2025}} targets Ruby 2.3.1.
Other Ruby implementations include:
Line 214 ⟶ 197:
* [[MagLev (software)|MagLev]], a [[Smalltalk]] implementation that runs on [[GemTalk Systems]]' [[Gemstone (database)|GemStone/S]] VM
* [[mruby]], an implementation designed to be embedded into C code, in a similar vein to [[Lua (programming language)|Lua]]. It is currently being developed by [[Yukihiro Matsumoto]] and others
* [[RGSS]], or Ruby Game Scripting System, a [[Proprietary software|proprietary]] implementation
*
*
*
Other now defunct Ruby implementations were:
Line 224 ⟶ 207:
* Cardinal, an implementation for the [[Parrot virtual machine]]
* [[Ruby Enterprise Edition]], often shortened to ''ree'', an implementation optimized to handle large-scale [[Ruby on Rails]] projects
* [[HotRuby]], a [[JavaScript]] and [[ActionScript]] implementation of the
The maturity of Ruby implementations tends to be measured by their ability to run the [[Ruby on Rails]] (Rails) framework, because it is complex to implement and uses many Ruby-specific features. The point when a particular implementation achieves this goal is called "the Rails singularity". The reference implementation, JRuby, and Rubinius<ref name="Rubinius"/> are all able to run Rails unmodified in a production environment.
Line 232 ⟶ 215:
Matsumoto originally developed Ruby on the [[BSD|4.3BSD]]-based [[Sony NEWS|Sony NEWS-OS]] 3.x, but later migrated his work to [[SunOS]] 4.x, and finally to [[Linux]].<ref name="Stodte"/><ref name="initial-development"/> By 1999, Ruby was known to work across many different [[operating system]]s. Modern Ruby versions and implementations are available on all major desktop, mobile and server-based operating systems. Ruby is also supported across a number of cloud hosting platforms like [[Jelastic]], [[Heroku]], [[Google Cloud Platform]] and others.
Tools such as [[Ruby Version Manager|RVM]] and
== Repositories and libraries ==
Line 256 ⟶ 239:
<ref name="Julia">{{cite web | url = https://docs.julialang.org/en/stable/ | title = Julia 1.0 Documentation: Introduction | access-date = 6 October 2018 | archive-date = 16 August 2018 | archive-url = https://web.archive.org/web/20180816025550/https://docs.julialang.org/en/stable/ | url-status = dead }}</ref>
<ref name="Burks">{{cite web | url = http://programming.nu/about | title = About Nu™ | last = Burks | first = Tim | work = Programming Nu™ | publisher = Neon Design Technology, Inc. | access-date = 2011-07-21 | archive-date = 2018-12-25 | archive-url = https://web.archive.org/web/20181225131630/http://programming.nu/about%0A%20 | url-status = live }}</ref>
<ref name="Ring and other languages">{{cite web | url =
<ref name="rust">{{Cite web |url=https://doc.rust-lang.org/reference/influences.html |title=Influences - The Rust Reference |website=The Rust Reference |access-date=2023-04-18 |archive-date=2019-01-26 |archive-url=https://web.archive.org/web/20190126051127/https://doc.rust-lang.org/reference/influences.html |url-status=live }}</ref>
<ref name="lattner2014">{{cite web | url = http://nondot.org/sabre/ | title = Chris Lattner's Homepage | last = Lattner | first = Chris | date = 2014-06-03 | access-date = 2014-06-03 | publisher = Chris Lattner | quote = The Swift language is the product of tireless effort from a team of language experts, documentation gurus, compiler optimization ninjas, and an incredibly important internal dogfooding group who provided feedback to help refine and battle-test ideas. Of course, it also greatly benefited from the experiences hard-won by many other languages in the field, drawing ideas from Objective-C, Rust, Haskell, Ruby, Python, C#, CLU, and far too many others to list. | archive-date = 2018-12-25 | archive-url = https://web.archive.org/web/20181225175312/http://nondot.org/sabre/ | url-status = live }}</ref>
Line 263 ⟶ 246:
<ref name="bini">{{ cite book | last = Bini | first = Ola | title = Practical JRuby on Rails Web 2.0 Projects: Bringing Ruby on Rails to Java | year = 2007 | publisher = APress | ___location = Berkeley | isbn = 978-1-59059-881-8 | page = [https://archive.org/details/practicaljrubyon0000bini/page/3 3] | quote = It draws primarily on features from Perl, Smalltalk, Python, Lisp, Dylan, and CLU. | url = https://archive.org/details/practicaljrubyon0000bini/page/3}}</ref>
<ref name="about">{{cite web|url=https://www.ruby-lang.org/en/about/|title=About Ruby|access-date=15 February 2020|archive-date=9 October 2014|archive-url=https://web.archive.org/web/20141009090312/https://www.ruby-lang.org/en/about/|url-status=live}}</ref>
<!-- <ref name="FAQ">{{cite web|url=https://www.ruby-
<ref name="lisp-features">{{ cite web | url = http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/179642 | title = Re: Ruby's lisp features. | last = Matsumoto | first = Yukihiro | author-link = Yukihiro Matsumoto | date = 13 February 2006 | access-date = 15 February 2020 | url-status = dead | archive-url = https://web.archive.org/web/20181027195101/http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/179642 | archive-date = 2018-10-27}}</ref>
<ref name="rubyconf-history-of-ruby">{{cite web|url=http://blog.nicksieger.com/articles/2006/10/20/rubyconf-history-of-ruby|title=History of Ruby|access-date=2008-08-14|archive-date=2011-07-14|archive-url=https://web.archive.org/web/20110714181409/http://blog.nicksieger.com/articles/2006/10/20/rubyconf-history-of-ruby|url-status=live}}</ref>
<ref name="ruby-name">{{cite web|url=http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/88819|title=[FYI: historic] The decisive moment of the language name Ruby. (Re: [ANN] ruby 1.8.1)|type=E-mail from Hiroshi Sugihara to ruby-talk|access-date=2008-08-14|archive-date=2011-07-17|archive-url=https://web.archive.org/web/20110717205734/http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/88819|url-status=dead}}</ref>
<ref name="faq-name">{{cite web | url = https://www.ruby-
<ref name="ruby-talk-name">{{cite mailing list | url = http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/394 | title = Re: the name of Ruby? | mailing-list = Ruby-Talk | date = June 11, 1999 | author = [[Yukihiro Matsumoto]] | access-date = April 10, 2012 | archive-date = December 25, 2018 | archive-url = https://web.archive.org/web/20181225131629/http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/394%0A%20 | url-status = dead }}</ref>
<ref name="0.95">{{ cite web|url=http://eigenclass.org/hiki/ruby+0.95|title=More archeolinguistics: unearthing proto-Ruby|access-date=2 May 2015|url-status=dead|archive-url=https://web.archive.org/web/20151106023204/http://eigenclass.org/hiki/ruby+0.95|archive-date=6 November 2015}}</ref>
Line 281 ⟶ 264:
<ref name="Ruby 1.9.3">{{cite web | title = Ruby 1.9.3 p0 is released | url = https://www.ruby-lang.org/en/news/2011/10/31/ruby-1-9-3-p0-is-released/ | publisher = ruby-lang.org | date = October 31, 2011 | access-date = February 20, 2013 | archive-date = January 14, 2013 | archive-url = https://web.archive.org/web/20130114080108/http://www.ruby-lang.org/en/news/2011/10/31/ruby-1-9-3-p0-is-released/ | url-status = live }}</ref>
<ref name="license-change">{{cite web | title = v1_9_3_0/NEWS | url = https://svn.ruby-lang.org/repos/ruby/tags/v1_9_3_0/NEWS | work = Ruby [[Apache Subversion|Subversion]] source repository | publisher = ruby-lang.org | date = September 17, 2011 | access-date = February 20, 2013 | archive-date = November 6, 2015 | archive-url = https://web.archive.org/web/20151106023210/http://svn.ruby-lang.org/repos/ruby/tags/v1_9_3_0/NEWS | url-status = dead }}</ref>
<ref name="2-0-release-incompatibilities">Endoh, Yusuke. (2013-02-24) [http://www.ruby-lang.org/en/news/2013/02/24/ruby-2-0-0-p0-is-released/#label-8 Ruby 2.0.0-p0 is released] {{Webarchive|url=https://web.archive.org/web/20130227014031/http://www.ruby-lang.org/en/news/2013/02/24/ruby-2-0-0-p0-is-released/#label-8 |date=2013-02-27 }}. Ruby-lang.org. Retrieved on 2013-07-17.</ref>
<ref name="semantic-versioning">{{cite web|url=https://www.ruby-lang.org/en/news/2013/12/21/semantic-versioning-after-2-1-0/|title=Semantic Versioning starting with Ruby 2.1.0|date=December 21, 2013|access-date=December 27, 2013|archive-date=February 13, 2014|archive-url=https://web.archive.org/web/20140213000634/https://www.ruby-lang.org/en/news/2013/12/21/semantic-versioning-after-2-1-0/|url-status=dead}}</ref>
<ref name="obsolete-or-gone-in-2.2">{{cite web|url=https://github.com/ruby/ruby/blob/v2_2_0/NEWS|title=ruby/NEWS at v2_2_0 · ruby/ruby
<ref name="2-2-1-release">{{cite web|url=https://www.ruby-lang.org/en/news/2015/03/03/ruby-2-2-1-released|title=Ruby 2.2.1 Released|access-date=12 July 2016|author=Gustavo Frederico Temple Pedrosa, Vitor de Lima, Leonardo Bianconi|year=2015|archive-date=16 May 2016|archive-url=https://web.archive.org/web/20160516080955/https://www.ruby-lang.org/en/news/2015/03/03/ruby-2-2-1-released/|url-status=live}}</ref>
<ref name="2-2-1-changelog">{{cite web|url=https://svn.ruby-lang.org/repos/ruby/tags/v2_2_1/ChangeLog|title=v2.2.1 ChangeLog|access-date=12 July 2016|author=Gustavo Frederico Temple Pedrosa, Vitor de Lima, Leonardo Bianconi|year=2015|archive-date=26 February 2017|archive-url=https://web.archive.org/web/20170226231425/http://svn.ruby-lang.org/repos/ruby/tags/v2_2_1/ChangeLog|url-status=dead}}</ref>
Line 305 ⟶ 286:
<ref name="venners-closures">{{cite web|url=http://www.artima.com/intv/closures.html|title=Blocks and Closures in Ruby|author=Bill Venners|access-date=2 May 2015|archive-date=18 April 2015|archive-url=https://web.archive.org/web/20150418162505/http://www.artima.com/intv/closures.html|url-status=live}}</ref>
<ref name="Methods">{{cite web|title=Methods|url=https://www.ruby-lang.org/en/documentation/faq/7/|website=Official Ruby FAQ|access-date=2021-06-20|archive-date=2022-06-28|archive-url=https://web.archive.org/web/20220628194402/https://www.ruby-lang.org/en/documentation/faq/7/|url-status=live}}</ref>
<ref name="stdlib-
<ref name="faq-comparison">{{cite web|url=http://www.rootr.net/rubyfaq-2.html|title=The Ruby Language FAQ: How Does Ruby Stack Up Against...?|access-date=2 May 2015|archive-date=8 May 2015|archive-url=https://web.archive.org/web/20150508051623/http://www.rootr.net/rubyfaq-2.html|url-status=live}}</ref>
<ref name="while">{{cite web|title=[ruby-talk:01120] Re: The value of while...|quote=In Ruby's syntax, statement is just a special case of an expression that cannot appear as an argument (e.g. multiple assignment).|url=http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/1120|access-date=2008-12-06|archive-date=2011-07-17|archive-url=https://web.archive.org/web/20110717205553/http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/1120|url-status=dead}}</ref>
Line 329 ⟶ 310:
{{refbegin}}
* {{ citation | first1 = David | last1 = Black | first2 = Joseph | last2 = Leo | date =
* {{citation | first1 = Sandi | last1 = Metz | date =
* {{ citation | first1 = Peter | last1 = Cooper | date =
* {{citation | first1 = Lucas | last1 = Carlson | first2 = Leonard | last2 = Richardson | date =
* {{citation | first1 = Hal | last1 = Fulton | first2 = André | last2 = Arko | date =
* {{ citation | first1 = Dave | last1 = Thomas | first2 = Chad | last2 = Fowler | first3 = Andy | last3 = Hunt | date =
* {{ citation | first1 = Jeremy | last1 = McAnally | first2 = Assaf | last2 = Arkin | date =
* {{citation | first1 = David | last1 = Flanagan | first2 = Yukihiro | last2 = Matsumoto | date =
* {{citation | first1 = Kevin | last1 = Baird | date = June 8, 2007 | title = Ruby by Example: Concepts and Code | edition = First | publisher = [[No Starch Press]] | page = 326 | isbn = 978-1593271480 | url = https://nostarch.com/rubyex | access-date =
* {{citation | first1 = Michael | last1 = Fitzgerald | date =
{{refend}}
Line 347 ⟶ 328:
* {{official website|https://www.ruby-lang.org/en/}}
* [https://
{{Ruby programming language}}
|