Project

General

Profile

Actions

Feature #13985

closed

Avoid exception for #dup/#clone on Rational and Complex

Added by Eregon (Benoit Daloze) over 6 years ago. Updated over 6 years ago.

Status:
Closed
Assignee:
-
Target version:
[ruby-core:83169]

Description

Since #12979, true/false/nil/Integer/Float just return themselves on #dup/#clone.

But it seems a few were missed, notably mentioned in https://bugs.ruby-lang.org/issues/12979#note-15.

Rational and Complex seems obvious candidates for supporting #dup/#clone returning itself as well since they are pretty much values.

Rational and Complex are currently not frozen though (see #13983).

Kasper (in the comment linked above) also mentions Method, but I think that's worth its own issue as it's no longer simple numeric values.

Note that BigDecimal is currently not frozen, but supports #dup/#clone (returning a new instance) (see #13984).


Related issues 4 (0 open4 closed)

Related to Ruby master - Feature #13984: BigDecimal should be immutable/frozen and return itself on #dupClosedmrkn (Kenta Murata)Actions
Related to Ruby master - Feature #12979: Avoid exception for #dup on Integer (and similar cases)Closednobu (Nobuyoshi Nakada)Actions
Related to Ruby master - Feature #13983: Rational and Complex should be frozenClosedActions
Is duplicate of Ruby master - Bug #13237: Behavior for #dup and #clone on Rational/Complex/BigDecimal differs from Integer/FloatClosedActions
Actions #1

Updated by Eregon (Benoit Daloze) over 6 years ago

  • Related to Feature #13984: BigDecimal should be immutable/frozen and return itself on #dup added
Actions #2

Updated by Eregon (Benoit Daloze) over 6 years ago

  • Related to Feature #12979: Avoid exception for #dup on Integer (and similar cases) added
Actions #3

Updated by Eregon (Benoit Daloze) over 6 years ago

  • Related to Feature #13983: Rational and Complex should be frozen added
Actions #4

Updated by nobu (Nobuyoshi Nakada) over 6 years ago

  • Is duplicate of Bug #13237: Behavior for #dup and #clone on Rational/Complex/BigDecimal differs from Integer/Float added
Actions #5

Updated by nobu (Nobuyoshi Nakada) over 6 years ago

  • Status changed from Open to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0