Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object#clonefreeze引数に関する説明を修正 #2923

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kyanagi
Copy link
Contributor

@kyanagi kyanagi commented Dec 2, 2024

3.0 で freeze: nil を受け取れるようになり、以後現在のような挙動になっています。

% docker run -it --rm rubylang/all-ruby env ALL_RUBY_SINCE=2.7 ./all-ruby -rset -e 'Object.new.clone(freeze: nil)'
ruby-2.7.0          -e:1:in `clone': unexpected value for freeze: NilClass (ArgumentError)
                        from -e:1:in `<main>'
                exit 1
...
ruby-2.7.8          -e:1:in `clone': unexpected value for freeze: NilClass (ArgumentError)
                        from -e:1:in `<main>'
                exit 1
ruby-3.0.0-preview1
...
ruby-3.4.0-preview1
% docker run -it --rm rubylang/all-ruby env ALL_RUBY_SINCE=3.0 ./all-ruby -rset -e 'o = Object.new; o.freeze; p [o.clone, o.clone(freeze: nil), o.clone(freeze: true), o.clone(freeze: false)].map(&:frozen?)'
ruby-3.0.0          [true, true, true, false]
...
ruby-3.4.0-preview1 [true, true, true, false]

% docker run -it --rm rubylang/all-ruby env ALL_RUBY_SINCE=3.0 ./all-ruby -rset -e 'o = Object.new; p [o.clone, o.clone(freeze: nil), o.clone(freeze: true), o.clone(freeze: false)].map(&:frozen?)'
ruby-3.0.0          [false, false, true, false]
...
ruby-3.4.0-preview1 [false, false, true, false]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant