[#86787] [Ruby trunk Feature#14723] [WIP] sleepy GC — ko1@...

Issue #14723 has been updated by ko1 (Koichi Sasada).

13 messages 2018/05/01
[#86790] Re: [Ruby trunk Feature#14723] [WIP] sleepy GC — Eric Wong <normalperson@...> 2018/05/01

ko1@atdot.net wrote:

[#87095] [Ruby trunk Feature#14767] [PATCH] gc.c: use monotonic counters for objspace_malloc_increase — ko1@...

Issue #14767 has been updated by ko1 (Koichi Sasada).

9 messages 2018/05/17
[#87096] Re: [Ruby trunk Feature#14767] [PATCH] gc.c: use monotonic counters for objspace_malloc_increase — Eric Wong <normalperson@...> 2018/05/17

ko1@atdot.net wrote:

[ruby-core:87212] [Ruby trunk Feature#14778][Feedback] Make Object#dup accept a block

From: shyouhei@...
Date: 2018-05-21 09:00:18 UTC
List: ruby-core #87212
Issue #14778 has been updated by shyouhei (Shyouhei Urabe).

Status changed from Open to Feedback

Not an immediate NG, but curious why we should do this in core, instead of your gem?

Would you mind telling us the reason this should be enabled for all the ruby users around the world?

----------------------------------------
Feature #14778: Make Object#dup accept a block
https://bugs.ruby-lang.org/issues/14778#change-72202

* Author: hkdnet (Ko Sato)
* Status: Feedback
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
I'd like to use `Object#dup` with a block, which is equivalent to `dup.tap`.

An example for `dup.tap` is here.

```ruby
require 'uri'

module MyUri
  class << self
    def foo_uri
      base_uri.dup.tap { |e| e.path = '/foo' }
    end

    private

    def base_uri
      @base_uri ||= URI.parse('http://example.com')
    end
  end
end
```

With this patch, we can write `base_uri.dup { |e| e.path = '/foo' }` and it's simpler.

---Files--------------------------------
dup_with_block.diff (296 Bytes)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next