1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/NEWS

706 lines
20 KiB
Text
Raw Normal View History

# -*- rdoc -*-
= NEWS for Ruby 2.7.0
This document is a list of user visible feature changes made between
releases except for bug fixes.
Note that each entry is kept so brief that no reason behind or reference
information is supplied with. For a full list of changes with all
sufficient information, see the ChangeLog file or Redmine
(e.g. <tt>https://bugs.ruby-lang.org/issues/$FEATURE_OR_BUG_NUMBER</tt>)
== Changes since the 2.6.0 release
`$SAFE` as a process global state. [Feature #14250] * vm_core.h (rb_vm_t): move `rb_execution_context_t::safe_level` to `rb_vm_t::safe_level_` because `$SAFE` is a process (VM) global state. * vm_core.h (rb_proc_t): remove `rb_proc_t::safe_level` because `Proc` objects don't need to keep `$SAFE` at the creation. Also make `is_from_method` and `is_lambda` as 1 bit fields. * cont.c (cont_restore_thread): no need to keep `$SAFE` for Continuation. * eval.c (ruby_cleanup): use `rb_set_safe_level_force()` instead of access `vm->safe_level_` directly. * eval_jump.c: End procs `END{}` doesn't keep `$SAFE`. * proc.c (proc_dup): removed and introduce `rb_proc_dup` in vm.c. * safe.c (rb_set_safe_level): don't check `$SAFE` 1 -> 0 changes. * safe.c (safe_setter): use `rb_set_safe_level()`. * thread.c (rb_thread_safe_level): `Thread#safe_level` returns `$SAFE`. It should be obsolete. * transcode.c (load_transcoder_entry): `rb_safe_level()` only returns 0 or 1 so that this check is not needed. * vm.c (vm_proc_create_from_captured): don't need to keep `$SAFE` for Proc. * vm.c (rb_proc_create): renamed to `proc_create`. * vm.c (rb_proc_dup): moved from proc.c. * vm.c (vm_invoke_proc): do not need to set and restore `$SAFE` for `Proc#call`. * vm_eval.c (rb_eval_cmd): rename a local variable to represent clearer meaning. * lib/drb/drb.rb: restore `$SAFE`. * lib/erb.rb: restore `$SAFE`, too. * test/lib/leakchecker.rb: check `$SAFE == 0` at the end of tests. * test/rubygems/test_gem.rb: do not set `$SAFE = 1`. * bootstraptest/test_proc.rb: catch up this change. * spec/ruby/optional/capi/string_spec.rb: ditto. * test/bigdecimal/test_bigdecimal.rb: ditto. * test/fiddle/test_func.rb: ditto. * test/fiddle/test_handle.rb: ditto. * test/net/imap/test_imap_response_parser.rb: ditto. * test/pathname/test_pathname.rb: ditto. * test/readline/test_readline.rb: ditto. * test/ruby/test_file.rb: ditto. * test/ruby/test_optimization.rb: ditto. * test/ruby/test_proc.rb: ditto. * test/ruby/test_require.rb: ditto. * test/ruby/test_thread.rb: ditto. * test/rubygems/test_gem_specification.rb: ditto. * test/test_tempfile.rb: ditto. * test/test_tmpdir.rb: ditto. * test/win32ole/test_win32ole.rb: ditto. * test/win32ole/test_win32ole_event.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-28 15:09:24 -05:00
=== Language changes
`$SAFE` as a process global state. [Feature #14250] * vm_core.h (rb_vm_t): move `rb_execution_context_t::safe_level` to `rb_vm_t::safe_level_` because `$SAFE` is a process (VM) global state. * vm_core.h (rb_proc_t): remove `rb_proc_t::safe_level` because `Proc` objects don't need to keep `$SAFE` at the creation. Also make `is_from_method` and `is_lambda` as 1 bit fields. * cont.c (cont_restore_thread): no need to keep `$SAFE` for Continuation. * eval.c (ruby_cleanup): use `rb_set_safe_level_force()` instead of access `vm->safe_level_` directly. * eval_jump.c: End procs `END{}` doesn't keep `$SAFE`. * proc.c (proc_dup): removed and introduce `rb_proc_dup` in vm.c. * safe.c (rb_set_safe_level): don't check `$SAFE` 1 -> 0 changes. * safe.c (safe_setter): use `rb_set_safe_level()`. * thread.c (rb_thread_safe_level): `Thread#safe_level` returns `$SAFE`. It should be obsolete. * transcode.c (load_transcoder_entry): `rb_safe_level()` only returns 0 or 1 so that this check is not needed. * vm.c (vm_proc_create_from_captured): don't need to keep `$SAFE` for Proc. * vm.c (rb_proc_create): renamed to `proc_create`. * vm.c (rb_proc_dup): moved from proc.c. * vm.c (vm_invoke_proc): do not need to set and restore `$SAFE` for `Proc#call`. * vm_eval.c (rb_eval_cmd): rename a local variable to represent clearer meaning. * lib/drb/drb.rb: restore `$SAFE`. * lib/erb.rb: restore `$SAFE`, too. * test/lib/leakchecker.rb: check `$SAFE == 0` at the end of tests. * test/rubygems/test_gem.rb: do not set `$SAFE = 1`. * bootstraptest/test_proc.rb: catch up this change. * spec/ruby/optional/capi/string_spec.rb: ditto. * test/bigdecimal/test_bigdecimal.rb: ditto. * test/fiddle/test_func.rb: ditto. * test/fiddle/test_handle.rb: ditto. * test/net/imap/test_imap_response_parser.rb: ditto. * test/pathname/test_pathname.rb: ditto. * test/readline/test_readline.rb: ditto. * test/ruby/test_file.rb: ditto. * test/ruby/test_optimization.rb: ditto. * test/ruby/test_proc.rb: ditto. * test/ruby/test_require.rb: ditto. * test/ruby/test_thread.rb: ditto. * test/rubygems/test_gem_specification.rb: ditto. * test/test_tempfile.rb: ditto. * test/test_tmpdir.rb: ditto. * test/win32ole/test_win32ole.rb: ditto. * test/win32ole/test_win32ole_event.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-28 15:09:24 -05:00
==== Pattern matching
* Pattern matching is introduced as an experimental feature. [Feature #14912]
case [0, [1, 2, 3]]
in [a, [b, *c]]
p a #=> 0
p b #=> 1
p c #=> [2, 3]
end
case {a: 0, b: 1}
in {a: 0, x: 1}
:unreachable
in {a: 0, b: var}
p var #=> 1
end
json = <<END
{
"name": "Alice",
"age": 30,
"children": [{ "name": "Bob", "age": 2 }]
}
END
if JSON.parse(json, symbolize_names: true) in
{name: "Alice", children: [{name: "Bob", age: age}]}
p age #=> 2
end
* See the following slides in detail
* https://speakerdeck.com/k_tsj/pattern-matching-new-feature-in-ruby-2-dot-7
==== The spec of keyword arguments is changed towards 3.0
* Automatic conversion of keyword arguments and positional arguments is
deprecated, and conversion will be removed in Ruby 3. [Feature #14183]
* When a method call passes a Hash at the last argument, and when it
passes no keywords, and when the called method accepts keywords, a
warning is emitted. To continue treating as keywords, add a double
splat operator to avoid the warning and ensure correct behavior in
Ruby 3.
def foo(key: 42); end; foo({key: 42}) # warned
def foo(**kw); end; foo({key: 42}) # warned
def foo(key: 42); end; foo(**{key: 42}) # OK
def foo(**kw); end; foo(**{key: 42}) # OK
* When a method call passes keywords to a method that accepts keywords,
but it does not pass enough required positional arguments, the
keywords are treated as a final required positional argument, and a
warning is emitted. Pass the argument as a hash instead of keywords
to avoid the warning and ensure correct behavior in Ruby 3.
def foo(h, **kw); end; foo(key: 42) # warned
def foo(h, key: 42); end; foo(key: 42) # warned
def foo(h, **kw); end; foo({key: 42}) # OK
def foo(h, key: 42); end; foo({key: 42}) # OK
* When a method accepts specific keywords but not a keyword splat, and
a hash or keywords splat is passed to the method that includes both
Symbol and non-Symbol keys, the hash will continue to be split, and
a warning will be emitted. You will need to update the calling code
to pass separate hashes to ensure correct behavior in Ruby 3.
def foo(h={}, key: 42); end; foo("key" => 43, key: 42) # warned
def foo(h={}, key: 42); end; foo({"key" => 43, key: 42}) # warned
def foo(h={}, key: 42); end; foo({"key" => 43}, key: 42) # OK
* If a method does not accept keywords, and is called with keywords,
the keywords are still treated as a positional hash, with no warning.
This behavior will continue to work in Ruby 3.
def foo(opt={}); end; foo( key: 42 ) # OK
* Non-symbols are allowed as a keyword argument keys if method accepts
arbitrary keywords. [Feature #14183]
* Non-Symbol keys in a keyword arguments hash were prohibited in 2.6.0,
but are now allowed again. [Bug #15658]
2019-10-21 08:30:47 -04:00
def foo(**kw); p kw; end; foo("str" => 1) #=> {"str"=>1}
2019-09-28 00:51:27 -04:00
* <code>**nil</code> is allowed in method definitions to explicitly mark
that the method accepts no keywords. Calling such a method with keywords
will result in an ArgumentError. [Feature #14183]
def foo(h, **nil); end; foo(key: 1) # ArgumentError
def foo(h, **nil); end; foo(**{key: 1}) # ArgumentError
def foo(h, **nil); end; foo("str" => 1) # ArgumentError
def foo(h, **nil); end; foo({key: 1}) # OK
def foo(h, **nil); end; foo({"str" => 1}) # OK
* Passing an empty keyword splat to a method that does not accept keywords
no longer passes an empty hash, unless the empty hash is necessary for
a required parameter, in which case a warning will be emitted. Remove
the double splat to continue passing a positional hash. [Feature #14183]
h = {}; def foo(*a) a end; foo(**h) # []
h = {}; def foo(a) a end; foo(**h) # {} and warning
h = {}; def foo(*a) a end; foo(h) # [{}]
h = {}; def foo(a) a end; foo(h) # {}
==== Numbered parameter
* Numbered parameter as the default block parameter is introduced as an
experimental feature. [Feature #4475]
[1, 2, 10].map { _1.to_s(16) } #=> ["1", "2", "a"]
You can still define a local variable named _1 and so on, and that is honored when present, but renders warning.
_1 = 0
[1].each { p _1 } # prints 0 instead of 1, but also warns.
2019-10-21 08:26:47 -04:00
==== proc/lambda without block is deprecated
* Proc.new and Kernel#proc with no block in a method called with a block is
warned now.
def foo
proc
end
foo { puts "Hello" } #=> warning: Capturing the given block using Proc.new is deprecated; use `&block` instead
* Kernel#lambda with no block in a method called with a block raises an exception.
def bar
lambda
end
bar { puts "Hello" } #=> tried to create Proc object without a block (ArgumentError)
==== Other miscellaneous changes
* A beginless range is experimentally introduced. It might not be as useful
2019-04-28 12:17:27 -04:00
as an endless range, but would be good for DSL purpose. [Feature #14799]
ary[..3] # identical to ary[0..3]
where(sales: ..100)
* Setting <code>$;</code> to non-nil value is warned now. Use of it in
String#split is warned too.
* Setting <code>$,</code> to non-nil value is warned now. Use of it in
Array#join is warned too.
* Quoted here-document identifier must end within the same line.
<<"EOS
" # This had been warned since 2.4; Now it raises a SyntaxError
EOS
* The flip-flop syntax deprecation is reverted. [Feature #5400]
* Comment lines can be placed between fluent dot now.
foo
# .bar
.baz # => foo.baz
* Calling a private method with a literal <code>self</code> as the receiver
is now allowed. [Feature #11297] [Feature #16123]
* Modifier rescue now operates the same for multiple assignment as single
assignment:
a, b = raise rescue [1, 2]
# Previously parsed as: (a, b = raise) rescue [1, 2]
# Now parsed as: a, b = (raise rescue [1, 2])
2019-10-21 12:27:26 -04:00
* +yield+ in singleton class syntax is warned and will be deprecated later [Feature #15575].
def foo
class << Object.new
yield
end
end
foo { p :ok } #=> warning: `yield' in class syntax will not be supported from Ruby 3.0.
* Argument forwarding by <code>(...)</code> is introduced. [Feature #16253]
2019-10-18 14:05:03 -04:00
def foo(...)
bar(...)
end
All arguments to +foo+ are forwarded to +bar+, including keyword and
block arguments.
Note that the parentheses are mandatory. `bar ...` is parsed as an endless range.
2019-10-18 14:05:03 -04:00
2019-11-14 15:15:01 -05:00
* Access and setting of <code>$SAFE</code> is now always warned. <code>$SAFE</code>
will become a normal global variable in Ruby 3.0. [Feature #16131]
* <code>Object#{taint,untaint,trust,untrust}</code> and related functions in the C-API
no longer have an effect (all objects are always considered untainted), and are now
warned in verbose mode. This warning will be disabled even in non-verbose mode in
2019-11-28 07:45:43 -05:00
Ruby 3.0, and the methods and C functions will be removed in Ruby 3.2. [Feature #16131]
2019-11-14 15:15:01 -05:00
=== Core classes updates (outstanding ones only)
`$SAFE` as a process global state. [Feature #14250] * vm_core.h (rb_vm_t): move `rb_execution_context_t::safe_level` to `rb_vm_t::safe_level_` because `$SAFE` is a process (VM) global state. * vm_core.h (rb_proc_t): remove `rb_proc_t::safe_level` because `Proc` objects don't need to keep `$SAFE` at the creation. Also make `is_from_method` and `is_lambda` as 1 bit fields. * cont.c (cont_restore_thread): no need to keep `$SAFE` for Continuation. * eval.c (ruby_cleanup): use `rb_set_safe_level_force()` instead of access `vm->safe_level_` directly. * eval_jump.c: End procs `END{}` doesn't keep `$SAFE`. * proc.c (proc_dup): removed and introduce `rb_proc_dup` in vm.c. * safe.c (rb_set_safe_level): don't check `$SAFE` 1 -> 0 changes. * safe.c (safe_setter): use `rb_set_safe_level()`. * thread.c (rb_thread_safe_level): `Thread#safe_level` returns `$SAFE`. It should be obsolete. * transcode.c (load_transcoder_entry): `rb_safe_level()` only returns 0 or 1 so that this check is not needed. * vm.c (vm_proc_create_from_captured): don't need to keep `$SAFE` for Proc. * vm.c (rb_proc_create): renamed to `proc_create`. * vm.c (rb_proc_dup): moved from proc.c. * vm.c (vm_invoke_proc): do not need to set and restore `$SAFE` for `Proc#call`. * vm_eval.c (rb_eval_cmd): rename a local variable to represent clearer meaning. * lib/drb/drb.rb: restore `$SAFE`. * lib/erb.rb: restore `$SAFE`, too. * test/lib/leakchecker.rb: check `$SAFE == 0` at the end of tests. * test/rubygems/test_gem.rb: do not set `$SAFE = 1`. * bootstraptest/test_proc.rb: catch up this change. * spec/ruby/optional/capi/string_spec.rb: ditto. * test/bigdecimal/test_bigdecimal.rb: ditto. * test/fiddle/test_func.rb: ditto. * test/fiddle/test_handle.rb: ditto. * test/net/imap/test_imap_response_parser.rb: ditto. * test/pathname/test_pathname.rb: ditto. * test/readline/test_readline.rb: ditto. * test/ruby/test_file.rb: ditto. * test/ruby/test_optimization.rb: ditto. * test/ruby/test_proc.rb: ditto. * test/ruby/test_require.rb: ditto. * test/ruby/test_thread.rb: ditto. * test/rubygems/test_gem_specification.rb: ditto. * test/test_tempfile.rb: ditto. * test/test_tmpdir.rb: ditto. * test/win32ole/test_win32ole.rb: ditto. * test/win32ole/test_win32ole_event.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-28 15:09:24 -05:00
2019-10-07 01:12:29 -04:00
Array::
New method::
* Added Array#intersection. [Feature #16155]
Comparable::
Modified method::
* Comparable#clamp now accepts a Range argument. [Feature #14784]
2019-10-21 08:30:47 -04:00
-1.clamp(0..2) #=> 0
1.clamp(0..2) #=> 1
3.clamp(0..2) #=> 2
Complex::
New method::
* Added Complex#<=>. So 0 <=> 0i will not raise NoMethodError. [Bug #15857]
Dir::
Modified methods::
2019-10-21 12:27:49 -04:00
* Dir.glob and Dir.[] no longer allow NUL-separated glob pattern.
Use Array instead. [Feature #14643]
Encoding::
2019-10-23 00:18:48 -04:00
New encoding::
* Added new encoding CESU-8 [Feature #15931]
Enumerable::
2019-07-14 04:54:22 -04:00
New methods::
2019-05-23 10:24:22 -04:00
* Added Enumerable#filter_map. [Feature #15323]
2019-10-21 08:30:47 -04:00
[1, 2, 3].filter_map {|x| x.odd? ? x.to_s : nil } #=> ["1", "3"]
* Added Enumerable#tally. [Feature #11076]
2019-10-21 08:30:47 -04:00
["A", "B", "C", "B", "A"].tally #=> {"A"=>2, "B"=>2, "C"=>1}
Enumerator::
2019-10-23 00:18:48 -04:00
New methods::
* Added Enumerator.produce to generate Enumerator from any custom
data-transformation. [Feature #14781]
require 'date'
dates = Enumerator.produce(Date.today, &:succ) #=> infinite sequence of dates
dates.detect(&:tuesday?) #=> next tuesday
* Added Enumerator::Lazy#eager that generates a non-lazy enumerator
from a lazy enumerator. [Feature #15901]
2019-10-22 06:39:42 -04:00
a = %w(foo bar baz)
2019-10-22 06:46:44 -04:00
e = a.lazy.map {|x| x.upcase }.map {|x| x + "!" }.eager
p e.class #=> Enumerator
p e.map {|x| x + "?" } #=> ["FOO!?", "BAR!?", "BAZ!?"]
2019-10-22 06:39:42 -04:00
* Added Enumerator::Yielder#to_proc so that a Yielder object
can be directly passed to another method as a block
argument. [Feature #15618]
2019-09-14 06:43:51 -04:00
Fiber::
New method::
* Added Fiber#raise that behaves like Fiber#resume but raises an
exception on the resumed fiber. [Feature #10344]
File::
Modified method::
* File.extname now returns a dot string at a name ending with a dot on
non-Windows platforms. [Bug #15267]
File.extname("foo.") #=> "."
FrozenError::
New method::
* Added FrozenError#receiver to return the frozen object that
modification was attempted on. To set this object when raising
FrozenError in Ruby code, pass it as the second argument to
FrozenError.new. [Feature #15751]
GC::
New method::
* Added GC.compact method for compacting the heap.
This function compacts live objects in the heap so that fewer pages may
be used, and the heap may be more CoW friendly. [Feature #15626]
Details on the algorithm and caveats can be found here:
https://bugs.ruby-lang.org/issues/15626
IO::
New method::
* Added IO#set_encoding_by_bom to check the BOM and set the external
encoding. [Bug #15210]
Integer::
Modified method::
* Integer#[] now supports range operation. [Feature #8842]
0b01001101[2, 4] #=> 0b0011
0b01001100[2..5] #=> 0b0011
0b01001100[2...6] #=> 0b0011
^^^^
2019-11-20 03:21:38 -05:00
Method::
2019-11-20 03:21:38 -05:00
Modified method::
2019-11-20 03:21:38 -05:00
* Method#inspect shows much information. [Feature #14145]
Module::
2019-10-23 00:18:48 -04:00
New methods::
2019-06-30 11:47:55 -04:00
* Added Module#const_source_location to retrieve the location where a
constant is defined. [Feature #10771]
* Added Module#ruby2_keywords for marking a method as passing keyword
arguments through a regular argument splat, useful when delegating
all arguments to another method in a way that can be backwards
compatible with older Ruby versions. [Bug #16154]
2019-10-23 00:18:48 -04:00
Modified methods::
* Module#autoload? now takes an +inherit+ optional argument, like as
Module#const_defined?. [Feature #15777]
2019-09-26 07:25:42 -04:00
2019-10-23 00:18:48 -04:00
* Module#name now always returns a frozen String. The returned String is
2019-09-26 07:41:41 -04:00
always the same for a given Module. This change is
experimental. [Feature #16150]
2019-11-20 03:21:38 -05:00
NilClass / TrueClass / FalseClass::
Modified methods::
* NilClass#to_s, TrueClass#to_s and FalseClass#to_s now always return a
frozen String. The returned String is always the same for each of these
values. This change is experimental. [Feature #16150]
2019-08-29 09:06:05 -04:00
ObjectSpace::WeakMap::
Modified method::
* ObjectSpace::WeakMap#[]= now accepts special objects as either key or
values. [Feature #16035]
Regexp::
Modified method::
2019-11-03 05:11:20 -05:00
* Regexp#match and Regexp#match? with a +nil+ argument are deprecated
and will raise a TypeError in the next release. [Feature #13083]
RubyVM::
Removed method::
* +RubyVM.resolve_feature_path+ moved to
<code>$LOAD_PATH.resolve_feature_path</code>. [Feature #15903] [Feature #15230]
String::
Unicode::
* Update Unicode version and Emoji version from 11.0.0 to
12.0.0. [Feature #15321]
* Update Unicode version to 12.1.0, adding support for
U+32FF SQUARE ERA NAME REIWA. [Feature #15195]
* Update Unicode Emoji version to 12.1 [Feature #16272]
Symbol::
New methods::
* Added Symbol#start_with? and Symbol#end_with? method. [Feature #16348]
2019-05-23 09:47:55 -04:00
Time::
2019-07-14 04:58:25 -04:00
New methods::
2019-05-23 09:47:55 -04:00
* Added Time#ceil method. [Feature #15772]
* Added Time#floor method. [Feature #15653]
Modified method::
* Time#inspect is separated from Time#to_s and it shows its sub
second. [Feature #15958]
UnboundMethod::
New method::
* Added UnboundMethod#bind_call method. [Feature #15955]
<code>umethod.bind_call(obj, ...)</code> is semantically equivalent
to <code>umethod.bind(obj).call(...)</code>. This idiom is used in
some libraries to call a method that is overridden. The added
method does the same without allocation of intermediate Method
object.
class Foo
def add_1(x)
x + 1
end
end
class Bar < Foo
def add_1(x) # override
x + 2
end
end
obj = Bar.new
p obj.add_1(1) #=> 3
p Foo.instance_method(:add_1).bind(obj).call(1) #=> 2
p Foo.instance_method(:add_1).bind_call(obj, 1) #=> 2
$LOAD_PATH::
2019-07-14 04:58:25 -04:00
New method::
* Added <code>$LOAD_PATH.resolve_feature_path</code>. [Feature #15903] [Feature #15230]
=== Stdlib updates (outstanding ones only)
`$SAFE` as a process global state. [Feature #14250] * vm_core.h (rb_vm_t): move `rb_execution_context_t::safe_level` to `rb_vm_t::safe_level_` because `$SAFE` is a process (VM) global state. * vm_core.h (rb_proc_t): remove `rb_proc_t::safe_level` because `Proc` objects don't need to keep `$SAFE` at the creation. Also make `is_from_method` and `is_lambda` as 1 bit fields. * cont.c (cont_restore_thread): no need to keep `$SAFE` for Continuation. * eval.c (ruby_cleanup): use `rb_set_safe_level_force()` instead of access `vm->safe_level_` directly. * eval_jump.c: End procs `END{}` doesn't keep `$SAFE`. * proc.c (proc_dup): removed and introduce `rb_proc_dup` in vm.c. * safe.c (rb_set_safe_level): don't check `$SAFE` 1 -> 0 changes. * safe.c (safe_setter): use `rb_set_safe_level()`. * thread.c (rb_thread_safe_level): `Thread#safe_level` returns `$SAFE`. It should be obsolete. * transcode.c (load_transcoder_entry): `rb_safe_level()` only returns 0 or 1 so that this check is not needed. * vm.c (vm_proc_create_from_captured): don't need to keep `$SAFE` for Proc. * vm.c (rb_proc_create): renamed to `proc_create`. * vm.c (rb_proc_dup): moved from proc.c. * vm.c (vm_invoke_proc): do not need to set and restore `$SAFE` for `Proc#call`. * vm_eval.c (rb_eval_cmd): rename a local variable to represent clearer meaning. * lib/drb/drb.rb: restore `$SAFE`. * lib/erb.rb: restore `$SAFE`, too. * test/lib/leakchecker.rb: check `$SAFE == 0` at the end of tests. * test/rubygems/test_gem.rb: do not set `$SAFE = 1`. * bootstraptest/test_proc.rb: catch up this change. * spec/ruby/optional/capi/string_spec.rb: ditto. * test/bigdecimal/test_bigdecimal.rb: ditto. * test/fiddle/test_func.rb: ditto. * test/fiddle/test_handle.rb: ditto. * test/net/imap/test_imap_response_parser.rb: ditto. * test/pathname/test_pathname.rb: ditto. * test/readline/test_readline.rb: ditto. * test/ruby/test_file.rb: ditto. * test/ruby/test_optimization.rb: ditto. * test/ruby/test_proc.rb: ditto. * test/ruby/test_require.rb: ditto. * test/ruby/test_thread.rb: ditto. * test/rubygems/test_gem_specification.rb: ditto. * test/test_tempfile.rb: ditto. * test/test_tmpdir.rb: ditto. * test/win32ole/test_win32ole.rb: ditto. * test/win32ole/test_win32ole_event.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-28 15:09:24 -05:00
Bundler::
* Upgrade to Bundler 2.1.0.pre.3
See https://github.com/bundler/bundler/blob/2-1-stable/CHANGELOG.md#210pre3-november-12-2019
CGI::
* CGI.escapeHTML becomes 2~5x faster when there's at least one escaped character.
https://github.com/ruby/ruby/pull/2226
CSV::
2019-10-12 01:03:21 -04:00
* Upgrade to 3.1.2.
See https://github.com/ruby/csv/blob/master/NEWS.md.
Date::
* Date.jisx0301, Date#jisx0301, and Date.parse support the new Japanese
era. [Feature #15742]
2019-06-01 11:42:11 -04:00
Delegator::
* Object#DelegateClass accepts a block and module_evals it in the context
of the returned class, similar to Class.new and Struct.new.
ERB::
* Prohibit marshaling ERB instance.
IRB::
2019-06-01 11:42:11 -04:00
* Introduce syntax highlight inspired by pry.gem to Binding#irb source lines,
REPL input, and inspect output of some core-class objects.
2019-07-15 03:25:50 -04:00
* Introduce multiline mode by Reline.
* Show documents when completion.
* Enable auto indent and save/load history by default.
Net::FTP::
* Add Net::FTP#features to check available features, and Net::FTP#option to
enable/disable each of them. [Feature #15964]
Net::HTTP::
* Add ipaddr optional parameter to Net::HTTP#start to replace the address for
TCP/IP connection [Feature #5180]
Net::IMAP::
* Add Server Name Indication (SNI) support. [Feature #15594]
2019-07-14 04:22:13 -04:00
open-uri::
* Warn open-uri's "open" method at Kernel.
Use URI.open instead. [Misc #15893]
* The default charset of text/* media type is UTF-8 instead of
ISO-8859-1. [Bug #15933]
2019-07-14 04:22:13 -04:00
OptionParser::
* Now show "Did you mean?" for unknown option. [Feature #16256]
test.rb:
require 'optparse'
OptionParser.new do |opts|
opts.on("-f", "--foo", "foo") {|v| }
opts.on("-b", "--bar", "bar") {|v| }
opts.on("-c", "--baz", "baz") {|v| }
end.parse!
example:
$ ruby test.rb --baa
Traceback (most recent call last):
test.rb:7:in `<main>': invalid option: --baa (OptionParser::InvalidOption)
Did you mean? baz
bar
2019-07-15 02:45:51 -04:00
Pathname::
2019-07-14 04:44:33 -04:00
* Delegates 3 arguments from Pathname.glob to Dir.glob to
accept base: keyword.
2019-06-20 02:59:20 -04:00
Racc::
2019-06-20 04:40:08 -04:00
* Merge 1.4.15 from upstream repository and added cli of racc.
2019-06-20 02:59:20 -04:00
2019-07-15 02:49:59 -04:00
Reline::
* New stdlib that is compatible with readline stdlib by pure Ruby and also
has a multiline mode.
2019-10-11 23:07:15 -04:00
REXML::
* Upgrade to 3.2.3.
See https://github.com/ruby/rexml/blob/master/NEWS.md.
RSS::
* Upgrade to RSS 0.2.8.
See https://github.com/ruby/rss/blob/master/NEWS.md.
RubyGems::
* Upgrade to RubyGems 3.1.0.pre3
See https://github.com/rubygems/rubygems/blob/3.1/History.txt#L3
2019-10-13 23:40:50 -04:00
StringScanner::
* Upgrade to 1.0.3.
See https://github.com/ruby/strscan/blob/master/NEWS.md.
=== Compatibility issues (excluding feature bug fixes)
2019-10-21 03:59:52 -04:00
* The following libraries are no longer bundled gems.
Install corresponding gems to use these features.
2019-10-23 00:23:43 -04:00
* CMath (cmath gem)
* Scanf (scanf gem)
* Shell (shell gem)
* Synchronizer (sync gem)
* ThreadsWait (thwait gem)
2019-11-29 03:15:56 -05:00
* E2MM (e2mmap gem)
Proc::
* Proc#to_s format was changed. [Feature #16101]
=== Stdlib compatibility issues (excluding feature bug fixes)
`$SAFE` as a process global state. [Feature #14250] * vm_core.h (rb_vm_t): move `rb_execution_context_t::safe_level` to `rb_vm_t::safe_level_` because `$SAFE` is a process (VM) global state. * vm_core.h (rb_proc_t): remove `rb_proc_t::safe_level` because `Proc` objects don't need to keep `$SAFE` at the creation. Also make `is_from_method` and `is_lambda` as 1 bit fields. * cont.c (cont_restore_thread): no need to keep `$SAFE` for Continuation. * eval.c (ruby_cleanup): use `rb_set_safe_level_force()` instead of access `vm->safe_level_` directly. * eval_jump.c: End procs `END{}` doesn't keep `$SAFE`. * proc.c (proc_dup): removed and introduce `rb_proc_dup` in vm.c. * safe.c (rb_set_safe_level): don't check `$SAFE` 1 -> 0 changes. * safe.c (safe_setter): use `rb_set_safe_level()`. * thread.c (rb_thread_safe_level): `Thread#safe_level` returns `$SAFE`. It should be obsolete. * transcode.c (load_transcoder_entry): `rb_safe_level()` only returns 0 or 1 so that this check is not needed. * vm.c (vm_proc_create_from_captured): don't need to keep `$SAFE` for Proc. * vm.c (rb_proc_create): renamed to `proc_create`. * vm.c (rb_proc_dup): moved from proc.c. * vm.c (vm_invoke_proc): do not need to set and restore `$SAFE` for `Proc#call`. * vm_eval.c (rb_eval_cmd): rename a local variable to represent clearer meaning. * lib/drb/drb.rb: restore `$SAFE`. * lib/erb.rb: restore `$SAFE`, too. * test/lib/leakchecker.rb: check `$SAFE == 0` at the end of tests. * test/rubygems/test_gem.rb: do not set `$SAFE = 1`. * bootstraptest/test_proc.rb: catch up this change. * spec/ruby/optional/capi/string_spec.rb: ditto. * test/bigdecimal/test_bigdecimal.rb: ditto. * test/fiddle/test_func.rb: ditto. * test/fiddle/test_handle.rb: ditto. * test/net/imap/test_imap_response_parser.rb: ditto. * test/pathname/test_pathname.rb: ditto. * test/readline/test_readline.rb: ditto. * test/ruby/test_file.rb: ditto. * test/ruby/test_optimization.rb: ditto. * test/ruby/test_proc.rb: ditto. * test/ruby/test_require.rb: ditto. * test/ruby/test_thread.rb: ditto. * test/rubygems/test_gem_specification.rb: ditto. * test/test_tempfile.rb: ditto. * test/test_tmpdir.rb: ditto. * test/win32ole/test_win32ole.rb: ditto. * test/win32ole/test_win32ole_event.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-28 15:09:24 -05:00
2019-11-14 02:09:36 -05:00
* Promote stdlib to default gems
* The following default gems was published at rubygems.org
2019-11-24 20:54:09 -05:00
* benchmark
2019-11-14 02:09:36 -05:00
* cgi
* delegate
* getoptlong
* net-pop
* net-smtp
* open3
* pstore
* singleton
* The following default gems only promoted ruby-core, Not yet published at rubygems.org.
* monitor
* observer
* timeout
* tracer
* uri
* yaml
pathname::
* Kernel#Pathname when called with a Pathname argument now returns
the argument instead of creating a new Pathname. This is more
similar to other Kernel methods, but can break code that modifies
the return value and expects the argument not to be modified.
profile.rb, Profiler__::
* Removed from standard library. No one maintains it from Ruby 2.0.0.
=== C API updates
`$SAFE` as a process global state. [Feature #14250] * vm_core.h (rb_vm_t): move `rb_execution_context_t::safe_level` to `rb_vm_t::safe_level_` because `$SAFE` is a process (VM) global state. * vm_core.h (rb_proc_t): remove `rb_proc_t::safe_level` because `Proc` objects don't need to keep `$SAFE` at the creation. Also make `is_from_method` and `is_lambda` as 1 bit fields. * cont.c (cont_restore_thread): no need to keep `$SAFE` for Continuation. * eval.c (ruby_cleanup): use `rb_set_safe_level_force()` instead of access `vm->safe_level_` directly. * eval_jump.c: End procs `END{}` doesn't keep `$SAFE`. * proc.c (proc_dup): removed and introduce `rb_proc_dup` in vm.c. * safe.c (rb_set_safe_level): don't check `$SAFE` 1 -> 0 changes. * safe.c (safe_setter): use `rb_set_safe_level()`. * thread.c (rb_thread_safe_level): `Thread#safe_level` returns `$SAFE`. It should be obsolete. * transcode.c (load_transcoder_entry): `rb_safe_level()` only returns 0 or 1 so that this check is not needed. * vm.c (vm_proc_create_from_captured): don't need to keep `$SAFE` for Proc. * vm.c (rb_proc_create): renamed to `proc_create`. * vm.c (rb_proc_dup): moved from proc.c. * vm.c (vm_invoke_proc): do not need to set and restore `$SAFE` for `Proc#call`. * vm_eval.c (rb_eval_cmd): rename a local variable to represent clearer meaning. * lib/drb/drb.rb: restore `$SAFE`. * lib/erb.rb: restore `$SAFE`, too. * test/lib/leakchecker.rb: check `$SAFE == 0` at the end of tests. * test/rubygems/test_gem.rb: do not set `$SAFE = 1`. * bootstraptest/test_proc.rb: catch up this change. * spec/ruby/optional/capi/string_spec.rb: ditto. * test/bigdecimal/test_bigdecimal.rb: ditto. * test/fiddle/test_func.rb: ditto. * test/fiddle/test_handle.rb: ditto. * test/net/imap/test_imap_response_parser.rb: ditto. * test/pathname/test_pathname.rb: ditto. * test/readline/test_readline.rb: ditto. * test/ruby/test_file.rb: ditto. * test/ruby/test_optimization.rb: ditto. * test/ruby/test_proc.rb: ditto. * test/ruby/test_require.rb: ditto. * test/ruby/test_thread.rb: ditto. * test/rubygems/test_gem_specification.rb: ditto. * test/test_tempfile.rb: ditto. * test/test_tmpdir.rb: ditto. * test/win32ole/test_win32ole.rb: ditto. * test/win32ole/test_win32ole_event.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-28 15:09:24 -05:00
* Many <code>*_kw</code> functions have been added for setting whether
the final argument being passed should be treated as keywords. You
may need to switch to these functions to avoid keyword argument
separation warnings, and to ensure correct behavior in Ruby 3.
* The <code>:</code> character in rb_scan_args format string is now
treated as keyword arguments. Passing a positional hash instead of
keyword arguments will emit a deprecation warning.
* C API declarations with +ANYARGS+ are changed not to use +ANYARGS+
https://github.com/ruby/ruby/pull/2404
=== Implementation improvements
`$SAFE` as a process global state. [Feature #14250] * vm_core.h (rb_vm_t): move `rb_execution_context_t::safe_level` to `rb_vm_t::safe_level_` because `$SAFE` is a process (VM) global state. * vm_core.h (rb_proc_t): remove `rb_proc_t::safe_level` because `Proc` objects don't need to keep `$SAFE` at the creation. Also make `is_from_method` and `is_lambda` as 1 bit fields. * cont.c (cont_restore_thread): no need to keep `$SAFE` for Continuation. * eval.c (ruby_cleanup): use `rb_set_safe_level_force()` instead of access `vm->safe_level_` directly. * eval_jump.c: End procs `END{}` doesn't keep `$SAFE`. * proc.c (proc_dup): removed and introduce `rb_proc_dup` in vm.c. * safe.c (rb_set_safe_level): don't check `$SAFE` 1 -> 0 changes. * safe.c (safe_setter): use `rb_set_safe_level()`. * thread.c (rb_thread_safe_level): `Thread#safe_level` returns `$SAFE`. It should be obsolete. * transcode.c (load_transcoder_entry): `rb_safe_level()` only returns 0 or 1 so that this check is not needed. * vm.c (vm_proc_create_from_captured): don't need to keep `$SAFE` for Proc. * vm.c (rb_proc_create): renamed to `proc_create`. * vm.c (rb_proc_dup): moved from proc.c. * vm.c (vm_invoke_proc): do not need to set and restore `$SAFE` for `Proc#call`. * vm_eval.c (rb_eval_cmd): rename a local variable to represent clearer meaning. * lib/drb/drb.rb: restore `$SAFE`. * lib/erb.rb: restore `$SAFE`, too. * test/lib/leakchecker.rb: check `$SAFE == 0` at the end of tests. * test/rubygems/test_gem.rb: do not set `$SAFE = 1`. * bootstraptest/test_proc.rb: catch up this change. * spec/ruby/optional/capi/string_spec.rb: ditto. * test/bigdecimal/test_bigdecimal.rb: ditto. * test/fiddle/test_func.rb: ditto. * test/fiddle/test_handle.rb: ditto. * test/net/imap/test_imap_response_parser.rb: ditto. * test/pathname/test_pathname.rb: ditto. * test/readline/test_readline.rb: ditto. * test/ruby/test_file.rb: ditto. * test/ruby/test_optimization.rb: ditto. * test/ruby/test_proc.rb: ditto. * test/ruby/test_require.rb: ditto. * test/ruby/test_thread.rb: ditto. * test/rubygems/test_gem_specification.rb: ditto. * test/test_tempfile.rb: ditto. * test/test_tmpdir.rb: ditto. * test/win32ole/test_win32ole.rb: ditto. * test/win32ole/test_win32ole_event.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-28 15:09:24 -05:00
Fiber::
* Allow selecting different coroutine implementation by using
`--with-coroutine=`, e.g.
2019-10-22 23:00:44 -04:00
./configure --with-coroutine=ucontext
./configure --with-coroutine=copy
* Replace previous stack cache with fiber pool cache. The fiber pool
allocates many stacks in a single memory region. Stack allocation
becomes O(log N) and fiber creation is amortized O(1). Around 10x
performance improvement was measured in micro-benchmarks.
File::
* File.realpath now uses realpath(3) on many platforms, which can
significantly improve performance.
Hash::
* Change data structure of small Hash objects. [Feature #15602]
Monitor::
* Monitor class is written in C-extension. [Feature #16255]
Thread::
* VM stack memory allocation is now combined with native thread stack,
improving thread allocation performance and reducing allocation related
failures. ~10x performance improvement was measured in micro-benchmarks.
JIT::
* JIT-ed code is recompiled to less-optimized code when an optimization assumption is invalidated.
* Method inlining is performed when a method is considered as pure.
This optimization is still experimental and many methods are NOT considered as pure yet.
* Default value of +--jit-max-cache+ is changed from 1,000 to 100
* Default value of +--jit-min-calls+ is changed from 5 to 10,000
=== Miscellaneous changes
2019-06-30 11:47:55 -04:00
* Support for IA64 architecture has been removed. Hardware for testing was
difficult to find, native fiber code is difficult to implement, and it added
non-trivial complexity to the interpreter. [Feature #15894]
* Require compilers to support C99 [Misc #15347]
* Details of our dialect: https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/C99
* Ruby's upstream repository is changed from Subversion to Git.
2019-04-23 09:26:40 -04:00
* https://git.ruby-lang.org/ruby.git
* RUBY_REVISION class is changed from Integer to String.
* RUBY_DESCRIPTION includes Git revision instead of Subversion's one.
* Support built-in methods in Ruby with `__builtin_` syntax. [Feature #16254]
Some methods are defined in *.rb (such as trace_point.rb).
For example, it is easy to define a method which accepts keyword arguments.