Skip to content

Commit 1c77be7

Browse files
committed
Advent of Changelog: Day 17
1 parent cbd60c2 commit 1c77be7

File tree

2 files changed

+73
-6
lines changed

2 files changed

+73
-6
lines changed

_data/book.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,27 @@ chapters:
177177
path: "/3.3.html#processstatus--and--are-deprecated"
178178
- title: "<code>TracePoint</code> supports <code>:rescue</code> event"
179179
path: "/3.3.html#tracepoint-supports-rescue-event"
180+
- title: Standard library
181+
path: "/3.3.html#standard-library"
182+
children:
183+
- title: Version updates
184+
path: "/3.3.html#version-updates"
185+
children:
186+
- title: Default gems
187+
path: "/3.3.html#default-gems"
188+
- title: Bundled gems
189+
path: "/3.3.html#bundled-gems"
190+
- title: Standard library content changes
191+
path: "/3.3.html#standard-library-content-changes"
192+
children:
193+
- title: Additions
194+
path: "/3.3.html#additions"
195+
- title: Removals
196+
path: "/3.3.html#removals"
197+
- title: Default gems that became bundled
198+
path: "/3.3.html#default-gems-that-became-bundled"
199+
- title: Gems that are warned to become bundled in the next version
200+
path: "/3.3.html#gems-that-are-warned-to-become-bundled-in-the-next-version"
180201
- title: Ruby 3.2
181202
path: "/3.2.html"
182203
is_version: true

_src/3.3.md

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -621,8 +621,6 @@ Allows to trace when some exception was `rescue`'d in the code of interest.
621621
* **Notes:** The event-specific attribute for the event is the same as for `:raise`: [#raised_exception](https://docs.ruby-lang.org/en/master/TracePoint.html#method-i-raised_exception).
622622

623623

624-
## Standard library
625-
626624
## Standard library
627625

628626
Since Ruby 3.1 release, most of the standard library is extracted to either _default_ or _bundled_ gems; their development happens in separate repositories, and changelogs are either maintained there, or absent altogether. Either way, their changes aren't mentioned in the combined Ruby changelog, and I'll not be trying to follow all of them.
@@ -633,6 +631,33 @@ Since Ruby 3.1 release, most of the standard library is extracted to either _def
633631

634632
A few changes to mention, though:
635633

634+
* [BasicSocket#recv](https://docs.ruby-lang.org/en/master/BasicSocket.html#method-i-recv) and [BasicSocket#recv_nonblock](https://docs.ruby-lang.org/en/master/BasicSocket.html#method-i-recv_nonblock) returns `nil` instead of an empty string on closed connections. [BaicSocket#recvmsg](https://docs.ruby-lang.org/en/master/BasicSocket.html#method-i-recvmsg) and BasicSocket#recvmsg_nonblock returns `nil` instead of an empty packet on closed connections. Discussion: [Bug #19012]
635+
* Name resolution such as [Socket.getaddrinfo](https://docs.ruby-lang.org/en/master/Socket.html#method-c-getaddrinfo), [Socket.getnameinfo](https://docs.ruby-lang.org/en/master/Socket.html#method-c-getnameinfo), [Addrinfo.getaddrinfo](https://docs.ruby-lang.org/en/master/Addrinfo.html#method-c-getaddrinfo) can now be interrupted. Discussion: [Feature #19965]
636+
* [Random::Formatter#alphanumeric](https://docs.ruby-lang.org/en/master/Random/Formatter.html#method-i-alphanumeric): `chars` keyword argument. [Feature #18183]:
637+
```ruby
638+
require 'random/formatter'
639+
# The default behavior: uses English alphabet + numbers
640+
Random.alphanumeric
641+
#=> "fhCshEkcGfCTO6Ny"
642+
643+
# With the argument provided:
644+
Random.alphanumeric(chars: ['a', 'b', 'c'])
645+
#=> "cbacacbababccccc"
646+
647+
# Note that the argument should be an array.
648+
# So if you have a string of characters, you can do:
649+
Random.alphanumeric(chars: 'abc'.chars)
650+
#=> "abbaccaacbacbccc"
651+
652+
# Any object is acceptable as an array element, the method
653+
# would just use their `#to_s`; arrays would be flattened:
654+
Random.alphanumeric(chars: [1, true, [2], Object.new])
655+
#=> "111true11211true2true#<Object:0x00007fe804e79f48>221"
656+
657+
# An empty array just hangs forever:
658+
Random.alphanumeric(chars: []) # never returns
659+
```
660+
636661
### Version updates
637662

638663
#### Default gems
@@ -716,17 +741,38 @@ A few changes to mention, though:
716741

717742
### Standard library content changes
718743

719-
* `ext/readline` is retired
744+
#### Additions
745+
746+
* [prism](https://github.com/ruby/prism) (nee YARP) is added. It is a new Ruby code parser, developed by Kevin Newton, which intends to become _the_ Ruby parser, shared by all implementations (not only CRuby/MRI, but also TruffleRuby, JRuby, and others) and tools that need to parser Ruby code (like Sorbet or Rubocop). It doesn't replace CRuby's Ruby parser at least for now, but can be used to parse Ruby quickly and produce robust, easy to use AST.
747+
748+
#### Removals
749+
750+
* `readline` extension is removed. It was a standard library written in C to wrap [GNU Readline](https://tiswww.case.edu/php/chet/readline/rltop.html), used to implement interactive consoles like IRB. Ruby includes pure-Ruby replacement called [reline](https://github.com/ruby/reline) [since 2.7](2.7.html#new-libraries), and now `require 'readline'` will just require it and make an alias `Readline = Reline`. Though, if the [readline-ext](https://github.com/ruby/readline-ext) gem is installed explicitly, `require 'readline'` would require it. Discussion: [Feature #19616].
751+
```ruby
752+
require 'readline'
720753

721-
The following default gem is added.
754+
Readline
755+
# Ruby 3.2:
756+
# => Readline -- a separate library/constant
757+
# Ruby 3.3:
758+
# => Reline -- Readline is just an alias
722759

723-
* prism 0.19.0
760+
Readline.method(:readline)
761+
# Ruby 3.2:
762+
# => #<Method: Readline.readline(*)> -- a C-defined method with no location/signature extracted
763+
# Ruby 3.3:
764+
# => #<Method: Reline.readline(*args, &block) <...>/lib/ruby/3.3.0+0/forwardable.rb:231>
765+
```
724766

725767
#### Default gems that became bundled
726768

769+
_This means that if your dependencies are managed by Bundler and your code depend on `racc`, it should be added to a `Gemfile`._
770+
727771
* racc 1.7.3
728772

729-
### Gems that are warned to become bundled in the next version
773+
#### Gems that are warned to become bundled in the next version
774+
775+
These gems wouldn't in a Bundler-managed environment unless explicitly added to `Gemfile` since the next version of Ruby. For now, requiring them in such environment would produce a warning. Discussion: [Feature #19351] (initial proposal to promote many gems, which then was deemed problematic), [Feature #19776] (the warning proposal)
730776

731777
* abbrev
732778
* base64

0 commit comments

Comments
 (0)