Ruby 2.6, the newest model of the venerable dynamic language, is now out there as a manufacturing launch.
What’s new in Ruby 2.6
Ruby 2.6 provides an preliminary implementation of a JIT (just-in-time compiler) to enhance efficiency of program execution. Ruby’s JIT compiler writes C code to disk and produces a C compiler course of to generate native code. The JIT compiler is supported when Ruby is constructed by the GCC compiler, Clang, or Microsoft Visible C++, which have to be out there at runtime.
Different new options in Ruby 2.6 embrace:
- In a change to the language,
$SAFEis a course of international state and zero could be set once more.
- Improved efficiency of
blockis handed in as a
Proc#namehas been sped up.
- The experimental
RubyVM::ASTmodule, which has a parse methodology that parses a code of string and returns AST nodes. Additionally, the
parse_ filemethodology parses a code file and return AST nodes.
- The experimental
RubyVM::AST::Nodeclass surfaces location info and kids nodes from
- Fixed names might begin with a non-ASCII capital letter.
- Infinite ranges, which work as in the event that they haven’t any finish, are launched.
- Transient Heap (
theap) is launched, with
theapserving as a managed heap for short-lived reminiscence objects which are referenced by particular courses.
- Unicode help is now at model 11.
- Bundler, for managing gem dependencies, is now a default gem.
The place to obtain Ruby 2.6
You may obtain Ruby 2.6 from the Ruby venture web site.
Earlier model: Ruby 2.5
Arriving on Christmas Day 2017, Ruby 2.5.zero is the primary secure launch within the 2.5 sequence.
It boosts efficiency by 5 to 10 % by eradicating hint directions from bytecode that has been discovered to be overhead. A dynamic instrumentation method is used as an alternative. Additionally, block passing by a block parameter has been made thrice sooner than it was in Ruby 2.four, by means of use of the Lazy Proc allocation method.
Different options that enhance efficiency embrace:
- Doc technology has been boosted by switching from the legacy lexical analyzer from IRB to Ripper.
Mutexclass has been rewritten to make it smaller and sooner.
Mutexcan be utilized to handle entry to shared information from concurrent threads.
- ERB generates code from a template at twice the velocity as model 2.four.
- Efficiency has been improved in built-in strategies together with
Different enhancements in Ruby 2.5 embrace:
Struct/newcan create courses that settle for key phrase arguments.
Do/finishblocks will now work immediately with
- The pp.rb library hundreds routinely.
- An possibility has been added to print backtrace in reverse order. The intent is to get the primary error message with no need to scroll.
- To enhance testing, help is obtainable for department and methodology protection measurement. Department protection reveals which branches are executed, whereas methodology protection signifies which strategies are invoked.
Ruby 2.5 additionally contains a bug repair by which the SecureRandom library, for producing random numbers, which now prefers OS-provided sources over OpenSSL. Additionally, normal libraries similar to cmath, csv, date, dbm, and ipaddr have been promoted to gems.
The place to obtain Ruby 2.5
You may obtain model 2.5 by opening this tar.gz file or this Zip file.
This story, “What’s new in Ruby 2.6” was initially printed by