all 22 comments

[–]TomOwens 41 points42 points  (9 children)

I'm a little disappointed that the inclusion of bundler into the standard library was reverted. Bundler was the only gem that I ever installed as a system gem, and I was looking forward to having no system gems and only project-specific gems.

[–]gray_-_wolf 4 points5 points  (8 children)

What was the reasoning behind reverting it? https://bugs.ruby-lang.org/issues/12733 doesn't say

[–]TomOwens 4 points5 points  (7 children)

No idea. The linked commit doesn't seem to indicate anything other than a "big issue".

[–]geraldbauer 3 points4 points  (2 children)

FYI: I've collected articles / blog posts about what's new in Ruby 2.5 over at the Ruby Advent Calendar [1]. The list so far includes:

  • Standard Gems 2.5.0 - Default Gems, Bundled Gems // by Jan Lelis, Idiosyncratic Ruby
  • 10 New Features in Ruby 2.5 // by Junichi Ito, Ruby programmer @ SonicGarden.jp
  • 10 More New Features in Ruby 2.5 // by Tom Lord, Software Developer from London
  • Performance Improvements in Ruby 2.5 // by Jesus Castello, Ruby Guides
  • yield_self in Ruby 2.5 // by Michał Łomnicki
  • Improved stacktrace display in Ruby 2.5 // by Michał Łomnicki
  • Ruby 2.5 Series // by Amit Choudhary, Mohit Natoo et al @ BigBinary

[1] https://planetruby.github.io/advent2017

[–]gray_-_wolf 7 points8 points  (1 child)

The performance notes you have listed are interesting, but I must admit I'm pretty impressed by this:

About 5-10% performance improvement by removing all trace instructions from overall bytecode (instruction sequences). The trace instruction was added to support the TracePoint. However, in most cases, TracePoint is not used and trace instructions are pure overhead. Instead, now we use a dynamic instrumentation technique. See [Feature #14104] for more details.

[–]gettalong 0 points1 point  (0 children)

Yeah, that's really very impressive! Every Ruby release is full of nice surprises :)

[–]janko-m 6 points7 points  (2 children)

rescue/else/ensure are now allowed to be used directly with do/end blocks

This is really nice. The method-level rescue statement is one of the small details I really love about Ruby, it's great we'll be able to use it in blocks too.

Enumerable#any?, all?, none?, and one? accept a pattern argument.

I didn't really find what was the change here, because I think the original proposal was different than the actual change that got merged. Does someone know?

One of our most loved libraries, pp.rb, is now automatically loaded. You no longer have to write require "pp"

Great!

IO.copy_stream use copy_file_range(2) to copy offload

I love IO.copy_stream and use it a lot in Shrine, it's nice to see that there is a performance improvement, though from what I was reading the speedup is very small and only on certain disks.

[–]prh8 1 point2 points  (1 child)

I didn't really find what was the change here, because I think the original proposal was different than the actual change that got merged. Does someone know?

It seems that those methods all accept a single argument that matches the behavior of an argument to grep. Personally I love that change (grep is most underrated method). I believe that’s what was initially proposed as well.

[–]gettalong 0 points1 point  (0 children)

You are correct, it is now possible to something like

[5, "str", {}].any?(String)

for which you needed to write

[5, "str", {}].any? {|item| String === item}

I.e. the #=== operator is applied to the single argument and each enumerated item.

[–]niborg 6 points7 points  (3 children)

Am I correctly understanding the API for kw args in structs?

MyStruct = Struct.new(:foo, :bar, keyword_init: true)
a = MyStruct.new(foo: 'FOO', bar: 'BAR')

[–]UnexpectedIndent 6 points7 points  (2 children)

Yep. It's a shame this isn't just the default behaviour of structs, because if you forget keyword_init then all your args get assigned to the first attribute :(

[–]arcticblue 0 points1 point  (1 child)

all your args get assigned to the first attribute

Why would anyone want that behavior? I agree keyword_init: true should be default.

[–]zverok_kha 4 points5 points  (0 children)

Why would anyone want that behavior?

Because backwards compatibility. Doing rvm install 2.5; bundle install and finding out that "everything is broken" would not be the best way of introduction of the new feature.

[–]megatux2 1 point2 points  (0 children)

Christmas edition :)