Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Ruby 3.0.0 コネタ集
Search
Kazuhiro NISHIYAMA
March 24, 2021
Programming
0
260
Ruby 3.0.0 コネタ集
[Fukuoka.rb 200回 LT大会 (#202) - connpass](
https://fukuokarb.connpass.com/event/206956/)での発表資料です
。
Kazuhiro NISHIYAMA
March 24, 2021
Tweet
Share
More Decks by Kazuhiro NISHIYAMA
See All by Kazuhiro NISHIYAMA
Ubuntuのriscv64版をqemuで動かした
znz
0
10
lilo.linux.or.jpをbusterからbullseyeに上げた
znz
0
27
小規模個人アプリをRails 7.xにバージョンアップした話
znz
0
17
Ruby リファレンスマニュアル改善計画 2022 進捗報告
znz
0
81
Rubyist Magazine Reboot
znz
0
82
History of Japanese Ruby reference manual, and future
znz
0
1.4k
qemuのriscv64にDebianを入れてみた
znz
0
88
systemd 再入門
znz
0
280
livedoor天気API終了対応
znz
0
250
Other Decks in Programming
See All in Programming
WinActorの勉強を継続する方法
tamai_63
0
130
『WordPressコミュニティで学ぶ』OSS貢献の多様性
ippey
0
290
Exploring the Implementation of “t.Run”, “t.Parallel”, and “t.Cleanup”
akarin
1
160
ServerAction で Progressive Enhancement はどこまで頑張れるか? / progressive-enhancement-with-server-action
takefumiyoshii
6
520
RuboCop: LSP and Prism
koic
1
110
Powerfully Typed TypeScript
euxn23
4
1.8k
Docker_OSS_ホスティング入門
satokoki645
0
140
TypeScriptから始める VR生活
tamagokakeg
2
140
ソースコードを美しくたもつために ~コードレビューの認知限界を突破し、年間400リリースを達成する~
kotauchisunsun
1
790
Revisiting the Hotwire Landscape after Turbo 8 @ RailsConf 2024, Detroit
marcoroth
3
610
PHPコードの実行モデルを理解する / Understanding-the-PHP-Execution-Model
shin1x1
0
1.1k
Jetpack Composeとデザインシステム
rmakiyama
0
240
Featured
See All Featured
Design by the Numbers
sachag
274
18k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
155
14k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
12
1.1k
Fireside Chat
paigeccino
22
2.7k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
21
2k
Build your cross-platform service in a week with App Engine
jlugia
226
17k
Scaling GitHub
holman
457
140k
Rebuilding a faster, lazier Slack
samanthasiow
74
8.3k
Mobile First: as difficult as doing things right
swwweet
217
8.6k
jQuery: Nuts, Bolts and Bling
dougneiner
60
7.2k
GitHub's CSS Performance
jonrohan
1025
450k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
34
8.9k
Transcript
Ruby 3.0.0 コネタ集 Kazuhiro NISHIYAMA Fukuoka.rb 200回 LT大会 (#202) 2021-03-24
株式会社Ruby開発 Powered by Rabbit 2.2.1
自己紹介 西山 和広 Ruby のコミッター twitter, github など: @znz 株式会社Ruby開発
www.ruby-dev.jp 1/14
はじめに LT なので内容はコネタ集です 2/14
Ractor 関連
Ractor で SEGV 3.0.0 では SEGV コア実装の experimental な機能は SEGV
バグがみつけやすいかも? % ruby -e Ractor.current.dup -e:1:in `dup': allocator undefined for Ractor (TypeError) from -e:1:in `<main>' 4/14
Ractor をまたぐ Thread Ractor 終了時なら Thread がそのまま 別 Ractor に移動可能
他の制限にひっかかって問題が起きる可 能性は未発見 % ruby -W0 -e 'r=Ractor.new{p Thread.new{loop{}}}; p r.take' #<Thread:0x00007fcf2586bfb8 -e:1 run> #<Thread:0x00007fcf2586bfb8 -e:1 run> 5/14
Ractor as global Queue main Ractor を Queue 代わりに使えるかも? %
ruby -e 'Ractor.current.send("foo"); p Ractor.receive' "foo" 6/14
shareable の影響あり ただし shareable ではないオブジェクトはコ ピーされてしまうので Queue 代わりには使いに くい %
ruby -e 'Ractor.current.send("foo".tap{|x|p x.object_id}); p Ractor.receive.tap{|x|p x.object_id}' 60 80 "foo" 7/14
互換性関連 のコネタ
frozen_string_literal frozen_string_literal: true magic comment 対応を 3.0.0 以降のみで確認すると対 応漏れする可能性あり %
ruby --enable=frozen_string_literal -e 'p "#{}".frozen?' false string interpolation (文字列補間) があると frozen にならなくなった 9/14
Warning[:deprecated] ruby -w や ruby -v で $VERBOSE = true
に すると Warning[:deprecated] も true にな るが、プログラム中で $VERBOSE = true にし ても Warning[:deprecated] は false のま ま % ruby -e 'p Warning[:deprecated]' false % ruby -w -e 'p Warning[:deprecated]' true % ruby -e '$VERBOSE=true; p Warning[:deprecated]' false 10/14
ruby -T $SAFE 関連が消えて -T オプションが消えた ruby 3.0: % ruby
-T0 -e 0 ruby: invalid option -T (-h will show valid options) (RuntimeError) ruby 2.7: % ruby -T0 -e 0 ruby: warning: ruby -T will be removed in Ruby 3.0 将来何か他の意味に使われるかも? 11/14
$SAFE / $KCODE 普通のグローバル変数になった (これも普通は使 わない) % ruby -e '$KCODE
= "foo"; p $KCODE' "foo" 12/14
TRUE / FALSE / NIL ついに消えたので普通の定数として利用可能 (普 通は使わない) % ruby
-e 'NIL = :dummy; p NIL.nil?' false 13/14
おわり Ractor はまだバグがありそうなので探 すと面白いかも 気付きにくい非互換もあるので複数 ruby バージョン対応するときには注意 長い間残っていて 3.0 で消えているもの
があります 14/14 Powered by Rabbit 2.2.1