-
Notifications
You must be signed in to change notification settings - Fork 316
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
String.new の :capacity の説明が合っていない? #2794
Comments
# あれ?余談ですが、 3.1.3 では |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
String.new
の:capacity
の説明ですが、以前のバージョンでの仕様は分からないのですが、 3.1.0 以降では、省略時のデフォルトの説明が実際の動作と合っていないように思われます。
:capacity
はRString
のas.heap.aux.capa
に相当するかと思いますが、実際には以下のような動作になるようです。:capacity
の指定の無い場合RString
に embed されるので capa を持たない:capacity
を指定した場合as.heap.aux.capa
は 63 になるas.heap.aux.capa
は指定した値になる※ 3.1.0 (USE_RVARGC 未指定) では 24 バイトから、 3.2.0 では 16 バイトから
説明のうまい修正案がちょっと思い付きませんが、「省略した場合」以降は削ってしまっても良いように思います。
メソッドシグネチャーの
も悩ましいですが、少なくとも
string.bytesize
になることは無いようなので 3 つ目は無くて良いように思います。確認に使用したスクリプトと実行結果を以下に示します。
The text was updated successfully, but these errors were encountered: