Ruby (programming language): Difference between revisions

Content deleted Content added
Removed 6 redlinks via script.
 
(5 intermediate revisions by 5 users not shown)
Line 1:
{{Short description|General-purpose programming language}}
{{distinguish|Ruby on Rails}}
 
{{infobox programming language
| logo = Ruby logo.svg
Line 45 ⟶ 44:
After the release of Ruby 0.95 in 1995, several stable versions of Ruby were released in these years.<ref name="rubyconf-history-of-ruby"/>
 
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 106 ⟶ 105:
Ruby 3.1 was released on 25 December 2021.<ref name="Ruby 3.1.0 Released" /> It includes YJIT, a new, experimental, Just-In-Time Compiler developed by [[Shopify]], to enhance the performance of real world business applications. A new [[debugger]] is also included. There are some syntax enhancements and other improvements in this release. Network libraries for [[FTP]], [[SMTP]], [[IMAP]], and [[Post Office Protocol|POP]] are moved from default gems to bundled gems.<ref>{{cite web|url=https://www.ruby-lang.org/en/news/2021/12/25/ruby-3-1-0-released//|title=Ruby 3.1.0 Released|access-date=2021-12-26|archive-date=2021-12-26|archive-url=https://web.archive.org/web/20211226065055/https://www.ruby-lang.org/en/news/2021/12/25/ruby-3-1-0-released//|url-status=live}}</ref>
 
Ruby 3.2 was released on 25 December 2022.<ref name="Ruby 3.2.0 Released">{{Cite web|url=https://www.ruby-lang.org/en/news/2022/12/25/ruby-3-2-0-released/|title=Ruby 3.2.0 Released|access-date=2022-12-25|archive-date=2022-12-25|archive-url=https://web.archive.org/web/20221225084459/https://www.ruby-lang.org/en/news/2022/12/25/ruby-3-2-0-released/|url-status=live}}</ref> It brings support for being run inside of a [[WebAssembly]] environment via a WASI interface. [[Regular expression]]s also receives some improvements, including a faster, [[Memoizationmemoization|memoized]] matching algorithm to protect against certain [[ReDoS]] attacks, and configurable timeouts for regular expression matching. Additional debugging and syntax features are also included in this release, which include syntax suggestion, as well as error highlighting. The MJIT compiler has been re-implemented as a standard library module, while the YJIT, a [[Rust (programming language)|Rust]]-based [[Just-in-time compilation|JIT]] compiler now supports more architectures on Linux.
 
Ruby 3.3 was released on 25 December 2023.<ref name="Ruby 3.3.0 Released">{{Cite web|url=https://www.ruby-lang.org/en/news/2023/12/25/ruby-3-3-0-released/|title=Ruby 3.3.0 Released|access-date=2023-12-25|archive-date=2023-12-25|archive-url=https://web.archive.org/web/20231225071449/https://www.ruby-lang.org/en/news/2023/12/25/ruby-3-3-0-released/|url-status=live}}</ref> Ruby 3.3 introduces significant enhancements and performance improvements to the language. Key features include the introduction of the Prism parser for portable and maintainable parsing, the addition of the pure-Ruby JIT compiler RJIT, and major performance boosts in the YJIT compiler. Additionally, improvements in memory usage, the introduction of an M:N thread scheduler, and updates to the standard library contribute to a more efficient and developer-friendly Ruby ecosystem.
Line 137 ⟶ 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 184 ⟶ 183:
 
=== Alternative implementations ===
 
{{Cleanup red links|section|date=April 2025}}
 
{{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 191 ⟶ 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.
* [[TruffleRuby]], a Java implementation using the Truffle language implementation framework with [[GraalVM]]
* [[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.
 
Line 198 ⟶ 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 that is used by the [[RPG Maker]] series of [[role-playing game creation software]] for game design and modification of the RPG Maker [[game engine]]
* [[julializer]], a [[transpiler]] (partial) from Ruby to [[Julia (programming language)|Julia]]. It can be used for a large speedup over e.g. Ruby or JRuby implementations (may only be useful for numerical code).<ref name="virtual-module"/>
* [[Topaz (Ruby)|Topaz]], a Ruby implementation written in [[Python (programming language)|Python]]
* [[Opal (Ruby)|Opal]], a web-based interpreter that compiles Ruby to [[JavaScript]]
 
Other now defunct Ruby implementations were:
Line 208 ⟶ 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 [[Ruby programming language]]
 
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 216 ⟶ 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 [[RBEnv]], facilitate installation and partitioning of multiple ruby versions, and multiple 'gemsets' on one machine.
 
== Repositories and libraries ==
Line 240 ⟶ 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 = httphttps://ring-lang.sourceforge.net/doc1.6/introduction.html#ring-and-other-languages | title = Ring and other languages | author = Ring Team | date = 3 December 2017 | work = ring-lang.net | publisher = [[ring-lang]] | access-date = 3 December 2017 | archive-date = 25 December 2018 | archive-url = https://web.archive.org/web/20181225175312/http://ring-lang.sourceforge.net/doc1.6/introduction.html#ring-and-other-languages | url-status = live }}</ref>
<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>