ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:121804] [Ruby Bug#21302] Remove or Fix Set#to_h
@ 2025-05-03  7:35 jeremyevans0 (Jeremy Evans) via ruby-core
  2025-05-03 18:39 ` [ruby-core:121819] " byroot (Jean Boussier) via ruby-core
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jeremyevans0 (Jeremy Evans) via ruby-core @ 2025-05-03  7:35 UTC (permalink / raw)
  To: ruby-core; +Cc: jeremyevans0 (Jeremy Evans)

Issue #21302 has been reported by jeremyevans0 (Jeremy Evans).

----------------------------------------
Bug #21302: Remove or Fix Set#to_h
https://bugs.ruby-lang.org/issues/21302

* Author: jeremyevans0 (Jeremy Evans)
* Status: Open
* Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
When backwards-compatible marshalling support for Set was added in commit:926411171d296859839745a536aa86bc1e18aa76, Set#to_h was added.  I'm not sure if intentionally or accidentally (@nobu knows).  The method is not backwards compatible with the previous Set#to_h method (Enumerable#to_h), so it should be fixed or removed.  Since it is a new method added to a core class, it should be officially approved if we want to keep it.

I would prefer removing it.  Users that want a `true`-valued hash can use `to_h { [it, true] }` instead of `to_h`. I have submitted a pull request to remove it: https://github.com/ruby/ruby/pull/13247

However, if we want to keep it, we should fix it to be backwards compatible and add tests and documentation.  I have submitted a pull request for that as well: https://github.com/ruby/ruby/pull/13248



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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:121819] [Ruby Bug#21302] Remove or Fix Set#to_h
  2025-05-03  7:35 [ruby-core:121804] [Ruby Bug#21302] Remove or Fix Set#to_h jeremyevans0 (Jeremy Evans) via ruby-core
@ 2025-05-03 18:39 ` byroot (Jean Boussier) via ruby-core
  2025-05-04 10:43 ` [ruby-core:121824] " nobu (Nobuyoshi Nakada) via ruby-core
  2025-05-13  1:10 ` [ruby-core:122033] " jeremyevans0 (Jeremy Evans) via ruby-core
  2 siblings, 0 replies; 4+ messages in thread
From: byroot (Jean Boussier) via ruby-core @ 2025-05-03 18:39 UTC (permalink / raw)
  To: ruby-core; +Cc: byroot (Jean Boussier)

Issue #21302 has been updated by byroot (Jean Boussier).


I think you can just remove it. I used it in Pysch because it was there, if it wasn't intended to be added, just remove it and psych will use something else.

----------------------------------------
Bug #21302: Remove or Fix Set#to_h
https://bugs.ruby-lang.org/issues/21302#change-112880

* Author: jeremyevans0 (Jeremy Evans)
* Status: Open
* Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
When backwards-compatible marshalling support for Set was added in commit:926411171d296859839745a536aa86bc1e18aa76, Set#to_h was added.  I'm not sure if intentionally or accidentally (@nobu knows).  The method is not backwards compatible with the previous Set#to_h method (Enumerable#to_h), so it should be fixed or removed.  Since it is a new method added to a core class, it should be officially approved if we want to keep it.

I would prefer removing it.  Users that want a `true`-valued hash can use `to_h { [it, true] }` instead of `to_h`. I have submitted a pull request to remove it: https://github.com/ruby/ruby/pull/13247

However, if we want to keep it, we should fix it to be backwards compatible and add tests and documentation.  I have submitted a pull request for that as well: https://github.com/ruby/ruby/pull/13248



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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:121824] [Ruby Bug#21302] Remove or Fix Set#to_h
  2025-05-03  7:35 [ruby-core:121804] [Ruby Bug#21302] Remove or Fix Set#to_h jeremyevans0 (Jeremy Evans) via ruby-core
  2025-05-03 18:39 ` [ruby-core:121819] " byroot (Jean Boussier) via ruby-core
@ 2025-05-04 10:43 ` nobu (Nobuyoshi Nakada) via ruby-core
  2025-05-13  1:10 ` [ruby-core:122033] " jeremyevans0 (Jeremy Evans) via ruby-core
  2 siblings, 0 replies; 4+ messages in thread
From: nobu (Nobuyoshi Nakada) via ruby-core @ 2025-05-04 10:43 UTC (permalink / raw)
  To: ruby-core; +Cc: nobu (Nobuyoshi Nakada)

Issue #21302 has been updated by nobu (Nobuyoshi Nakada).


I agree to remove it.

----------------------------------------
Bug #21302: Remove or Fix Set#to_h
https://bugs.ruby-lang.org/issues/21302#change-112887

* Author: jeremyevans0 (Jeremy Evans)
* Status: Open
* Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
When backwards-compatible marshalling support for Set was added in commit:926411171d296859839745a536aa86bc1e18aa76, Set#to_h was added.  I'm not sure if intentionally or accidentally (@nobu knows).  The method is not backwards compatible with the previous Set#to_h method (Enumerable#to_h), so it should be fixed or removed.  Since it is a new method added to a core class, it should be officially approved if we want to keep it.

I would prefer removing it.  Users that want a `true`-valued hash can use `to_h { [it, true] }` instead of `to_h`. I have submitted a pull request to remove it: https://github.com/ruby/ruby/pull/13247

However, if we want to keep it, we should fix it to be backwards compatible and add tests and documentation.  I have submitted a pull request for that as well: https://github.com/ruby/ruby/pull/13248



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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:122033] [Ruby Bug#21302] Remove or Fix Set#to_h
  2025-05-03  7:35 [ruby-core:121804] [Ruby Bug#21302] Remove or Fix Set#to_h jeremyevans0 (Jeremy Evans) via ruby-core
  2025-05-03 18:39 ` [ruby-core:121819] " byroot (Jean Boussier) via ruby-core
  2025-05-04 10:43 ` [ruby-core:121824] " nobu (Nobuyoshi Nakada) via ruby-core
@ 2025-05-13  1:10 ` jeremyevans0 (Jeremy Evans) via ruby-core
  2 siblings, 0 replies; 4+ messages in thread
From: jeremyevans0 (Jeremy Evans) via ruby-core @ 2025-05-13  1:10 UTC (permalink / raw)
  To: ruby-core; +Cc: jeremyevans0 (Jeremy Evans)

Issue #21302 has been updated by jeremyevans0 (Jeremy Evans).

Status changed from Open to Closed

Fixed by commit:203199251f723d02f23f5782523d16f91277ea82

----------------------------------------
Bug #21302: Remove or Fix Set#to_h
https://bugs.ruby-lang.org/issues/21302#change-113183

* Author: jeremyevans0 (Jeremy Evans)
* Status: Closed
* Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
When backwards-compatible marshalling support for Set was added in commit:926411171d296859839745a536aa86bc1e18aa76, Set#to_h was added.  I'm not sure if intentionally or accidentally (@nobu knows).  The method is not backwards compatible with the previous Set#to_h method (Enumerable#to_h), so it should be fixed or removed.  Since it is a new method added to a core class, it should be officially approved if we want to keep it.

I would prefer removing it.  Users that want a `true`-valued hash can use `to_h { [it, true] }` instead of `to_h`. I have submitted a pull request to remove it: https://github.com/ruby/ruby/pull/13247

However, if we want to keep it, we should fix it to be backwards compatible and add tests and documentation.  I have submitted a pull request for that as well: https://github.com/ruby/ruby/pull/13248



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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-05-13  1:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-03  7:35 [ruby-core:121804] [Ruby Bug#21302] Remove or Fix Set#to_h jeremyevans0 (Jeremy Evans) via ruby-core
2025-05-03 18:39 ` [ruby-core:121819] " byroot (Jean Boussier) via ruby-core
2025-05-04 10:43 ` [ruby-core:121824] " nobu (Nobuyoshi Nakada) via ruby-core
2025-05-13  1:10 ` [ruby-core:122033] " jeremyevans0 (Jeremy Evans) via ruby-core

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).