
Ruby specifications have been updated to version
2.1.0 . The new version of the programming language made several evolutionary changes. In
informal benchmarks on Rails, version 2.1 shows a result about 20% higher than 2.0, which, in turn, is 60-70% faster than 1.9.3.
In short, the most important ones are:
- VM (method caching)
- The new RGenGC garbage collector (see the ko1 presentation on RubyKaigi and on RubyConf 2013 )
- syntax changes
- new entry of fractions using two slashes ("//") between the numerator and the denominator, see # 8430
- 1 // 2 == Rational (1, 2)
- 1 // 1 == Rational (1, 1)
- 0 // 1 == Rational (0, 1)
- new suffixes i, r and ri to write complex and rational numbers
- "42r" and "3.14r" are regarded as the rational number of Rational (42, 1) and 3.14.rationalize, respectively. But an exponential form with the 'r' suffix, such as "6.022e + 23r", is not accepted.
- "42i" and "3.14i" are regarded as Complex (0, 42) and Complex (0, 3.14), respectively.
- "42ri" and "3.14ri" are regarded as Complex (0, 42r) and Complex (0, 3.14r), respectively.
- The definition of the function def now returns the symbol of its name instead of nil, see # 3753
- clarification # 8481 # 8571
- Bignum
- uses the GMP (GNU Multiple Precision Arithmetic Library) to speed up operations on large numbers, see # 8796
- Added method Array # to_h - creating a hash from an array
- String # scrub # 8414
- Socket.getifaddrs # 8368
- RDoc 4.1.0 and RubyGems 2.2.0
- “Literal” .freeze is now optimized # 9042
- Added Exception # cause # 8257
- updated JSON, NKF, rake, RubyGems, and RDoc libraries.
- removed curses library. # 8584
Ruby is a high-level language for quick and easy object-oriented programming. Its creator, Yukihiro Matsumoto, tried to combine the best features of their favorite languages ​​Perl, Python, Smalltalk, Eiffel, Ada and Lisp in search of a proper balance between functional and imperative programming. The goal was to create a language more powerful than Perl, and more object-oriented than Python, Wikipedia
writes . The main purpose of Ruby is to create simple and at the same time understandable programs, where it is not the speed of the program that is important, but short development time, understandable and simple syntax.
')
Matsumoto is still developing Ruby, and version 2.1.0 is his Christmas present to all programmers.
For a more detailed list of changes in 2.1.0, see
here , as well as in the presentation
“All about Ruby 2.1” .