[#122369] [Ruby Bug#21392] Data classes do not allow overriding #inspect — "austin (Austin Ziegler) via ruby-core" <ruby-core@...>

Issue #21392 has been reported by austin (Austin Ziegler).

8 messages 2025/06/01

[#122411] [Ruby Bug#21396] Set#initialize should call Set#add on items passed in — "tenderlovemaking (Aaron Patterson) via ruby-core" <ruby-core@...>

Issue #21396 has been reported by tenderlovemaking (Aaron Patterson).

12 messages 2025/06/04

[#122506] [Ruby Feature#21435] Kernel#optional as a conditional #then — "Alexander.Senko (Alexander Senko) via ruby-core" <ruby-core@...>

SXNzdWUgIzIxNDM1IGhhcyBiZWVuIHJlcG9ydGVkIGJ5IEFsZXhhbmRlci5TZW5rbyAoQWxleGFu

11 messages 2025/06/10

[#122557] [Ruby Bug#21445] [BUG] push_mark_stack() called for broken object raised since cd9f447be247478d2eb3da985295735cce20cb23 — "yahonda (Yasuo Honda) via ruby-core" <ruby-core@...>

Issue #21445 has been reported by yahonda (Yasuo Honda).

10 messages 2025/06/19

[#122615] [Ruby Misc#21458] Test 'make install'? — "MSP-Greg (Greg L) via ruby-core" <ruby-core@...>

Issue #21458 has been reported by MSP-Greg (Greg L).

11 messages 2025/06/28

[ruby-core:122454] [Ruby Feature#21390] Deprecate passing arguments to Set#to_set and Enumerable#to_set

From: "knu (Akinori MUSHA) via ruby-core" <ruby-core@...>
Date: 2025-06-05 12:30:15 UTC
List: ruby-core #122454
Issue #21390 has been updated by knu (Akinori MUSHA).


I can agree with this.  As it turned out, subclassing Set classes did not become very common, so I think it's fine to deprecate this feature now.

----------------------------------------
Feature #21390: Deprecate passing arguments to Set#to_set and Enumerable#to_set
https://bugs.ruby-lang.org/issues/21390#change-113639

* Author: jeremyevans0 (Jeremy Evans)
* Status: Assigned
* Assignee: knu (Akinori MUSHA)
----------------------------------------
Array#to_a, Hash#to_h, Enumerable#to_a, and Enumerable#to_h do not allow you to specify subclasses.  This has undesired behavior when passing non-Set subclasses.  All of these are currently allowed, and none make sense:

```ruby
enum = [1,2,3].to_enum

enum.to_set(Hash)
enum.to_set(Struct.new("A", :a))
enum.to_set(ArgumentError)
enum.to_set(Thread){}
```

Users who want to create instances of a subclass of Set from an enumerable should pass the enumerable to SetSubclass.new instead of using to_set, similar to how they would have to handle subclasses of Array or Hash.

I've submitted a pull request that implements this: https://github.com/ruby/ruby/pull/13489

With the pull request, block arguments are still allowed (no warning). Positional and keyword argument use results in a deprecation warning.

I would like to deprecate this in Ruby 3.5 (next feature release), and remove it in Ruby 3.6 (following feature release).



-- 
https://bugs.ruby-lang.org/
______________________________________________
 ruby-core mailing list -- [email protected]
 To unsubscribe send an email to [email protected]
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/


In This Thread