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
51
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
210
How to Brew Coffee at Home - A Guide For Beginners
tetsuya
0
590
Dive into ‘An error occurred while installing mysql2’
tetsuya
0
16
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
19
Other Decks in Programming
See All in Programming
iOSアプリで測る!名古屋駅までの 方向と距離
ryunakayama
0
150
AI時代の開発者評価について
ayumuu
0
230
LRパーサーはいいぞ
ydah
5
1k
Cursor/Devin全社導入の理想と現実
saitoryc
28
22k
Vibe Coding の話をしよう
schroneko
14
3.7k
On-the-fly Suggestions of Rewriting Method Deprecations
ohbarye
3
5k
Bedrock × Confluenceで簡単(?)社内RAG
iharuoru
1
110
The Implementations of Advanced LR Parser Algorithm
junk0612
2
1.4k
API for docs
soutaro
4
1.7k
一緒に働きたくなるプログラマの思想 #QiitaConference
mu_zaru
80
20k
Boost Your Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
810
Serving TUIs over SSH with Go
caarlos0
0
600
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
94
13k
Faster Mobile Websites
deanohume
306
31k
Build The Right Thing And Hit Your Dates
maggiecrowley
35
2.7k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
21k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
Building Flexible Design Systems
yeseniaperezcruz
329
39k
Facilitating Awesome Meetings
lara
54
6.3k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.4k
How to Think Like a Performance Engineer
csswizardry
23
1.6k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
34
2.2k
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 }