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
Understanding Syntax Error on Ruby Blocks
Search
Tetsuya Kaneko
April 16, 2019
Programming
0
47
Understanding Syntax Error on Ruby Blocks
Tetsuya Kaneko
April 16, 2019
Tweet
Share
More Decks by Tetsuya Kaneko
See All by Tetsuya Kaneko
Migrate from Unicorn to Puma
tetsuya
0
160
How to Brew Coffee at Home - A Guide For Beginners
tetsuya
0
560
Dive into ‘An error occurred while installing mysql2’
tetsuya
0
12
How Did Development Team Cope with Startup Chaos at U-NOTE
tetsuya
1
2k
Ansible - Where to start?
tetsuya
3
1.8k
How to Setup Your Mac
tetsuya
0
16
Other Decks in Programming
See All in Programming
Cloudflare MCP ServerでClaude Desktop からWeb APIを構築
kutakutat
1
580
Online-Dokumentation, die hilft: Strukturen, Prozesse, Tools
ahus1
0
100
Асинхронность неизбежна: как мы проектировали сервис уведомлений
lamodatech
0
1.1k
「Chatwork」Android版アプリを 支える単体テストの現在
okuzawats
0
190
fs2-io を試してたらバグを見つけて直した話
chencmd
0
250
テストコードのガイドライン 〜作成から運用まで〜
riku929hr
5
1k
Beyond ORM
77web
9
1.3k
20年もののレガシープロダクトに 0からPHPStanを入れるまで / phpcon2024
hirobe1999
0
860
Go の GC の不得意な部分を克服したい
taiyow
3
860
ある日突然あなたが管理しているサーバーにDDoSが来たらどうなるでしょう?知ってるようで何も知らなかったDDoS攻撃と対策 #phpcon.2024
akase244
2
6.9k
どうして手を動かすよりもチーム内のコードレビューを優先するべきなのか
okashoi
3
650
責務を分離するための例外設計 - PHPカンファレンス 2024
kajitack
9
2.1k
Featured
See All Featured
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.4k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2k
Designing for Performance
lara
604
68k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5.1k
Unsuck your backbone
ammeep
669
57k
A Philosophy of Restraint
colly
203
16k
Reflections from 52 weeks, 52 projects
jeffersonlam
347
20k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Building Applications with DynamoDB
mza
91
6.1k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Transcript
Ruby Blocks ʹ͓͚Δ Syntax Error ͷṖΛ͏ 2019.4.16 ࣾLTେձ #1
@tetsuya
͜ͷίʔυಈ͘Ͱ͠ΐ͏͔ʁ 1.upto(2) {|i| p i }
ಈ͘ $ ruby -e '1.upto(2) {|i| p i } '
1 2
͡Ό͋ͬͪ͜ʁ 1.upto 2 {|i| p i }
͑
όʔδϣϯʹΑΔ
ྫ
Ruby 1.9.0-4 (ಈ͘) $ ruby -ve '1.upto 2 {|i| p
i} ' ruby 1.9.0 (2008-08-26 revision 18849) [i386-darwin18.2.0 ] 1 2
Ruby 2.3.3 (ಈ͔ͳ͍) $ ruby -ve '1.upto 2 {|i| p
i} ' ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin18 ] -e:1: syntax error, unexpected '{', expecting end-of-inpu t 1.upto 2 {|i| p i}
Ruby 2.4.0 (ಈ͘) $ ruby -ve '1.upto 2 {|i| p
i} ' ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin18 ] 1 2
Ruby 2.4.1 (ಈ͘) $ ruby -ve '1.upto 2 {|i| p
i} ' ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin18 ] 1 2
Ruby 2.4.2 (ಈ͔ͳ͍) $ ruby -ve '1.upto 2 {|i| p
i} ' ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin18 ] -e:1: syntax error, unexpected '{', expecting end-of-inpu t 1.upto 2 {|i| p i}
ͳ͔ͥ
ྺ࢙ΛḪΔ͜ͱ10 • ͱ1.9Ͱ༷มߋͱͯ͠Ճ͞ΕɺΑΓʹϒϩοΫΛղ ऍ͢ΔΑ͏ͳͷͩͬͨ • ʮϓϩάϥϚ a {|i| ...} ϝιουݺͼग़͠ͱͯ͠ղऍ͢Δ͕ɺ
2 {|i| …} ϝιουݺͼग़͠ͱղऍ͠ͳ͍ͣͩʯ • ʮϦςϥϧͰ͋Δ͔มͰ͋Δ͔ͰৼΔ͍͕ҟͳΔ͜ͱɺࠞ ཚΛট͘Մೳੑ͕͋Δʯ Bug #505: 1.upto 2 {|i| p i } - Ruby trunk - Ruby Issue Tracking System
ٞͷ * parse.y (yylex): "1.upto 2 {|i| p i }"
should be syntax error. · ruby/ruby@05edaf5
ͦͷޙಈ͍ͨΓಈ͔ͳ͔ͬͨΓ • Bug #13547: [].delete 1 { 'NG' } -
Ruby trunk - Ruby Issue Tracking System • Bug #14023: SyntaxError on array argument and block - Ruby trunk - Ruby Issue Tracking System
݁ • ɹɹɹɹɹɹɹɹɹ Syntax error ͕ͩɺRuby ͷόʔδϣϯ ʹΑͬͯಈ͍ͯ͠·͏ 1.upto 2
{|i| p i }