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
55
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
260
How to Brew Coffee at Home - A Guide For Beginners
tetsuya
0
620
Dive into ‘An error occurred while installing mysql2’
tetsuya
0
20
How Did Development Team Cope with Startup Chaos at U-NOTE
tetsuya
1
2k
Ansible - Where to start?
tetsuya
3
1.9k
How to Setup Your Mac
tetsuya
0
24
Other Decks in Programming
See All in Programming
Dive into Triton Internals
appleparan
0
420
AIのバカさ加減に怒る前にやっておくこと
blueeventhorizon
0
140
Swift Concurrency 年表クイズ
omochi
3
220
KoogではじめるAIエージェント開発
hiroaki404
1
290
Migration to Signals, Resource API, and NgRx Signal Store
manfredsteyer
PRO
0
140
React Nativeならぬ"Vue Native"が実現するかも?_新世代マルチプラットフォーム開発フレームワークのLynxとLynxのVue.js対応を追ってみよう_Vue Lynx
yut0naga1_fa
2
2k
GC25 Recap: The Code You Reviewed is Not the Code You Built / #newt_gophercon_tour
mazrean
0
140
iOSでSVG画像を扱う
kishikawakatsumi
0
180
One Enishi After Another
snoozer05
PRO
0
180
CSC305 Lecture 13
javiergs
PRO
0
350
Register is more than clipboard
satorunooshie
1
370
When Dependencies Fail: Building Antifragile Applications in a Fragile World
selcukusta
0
120
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
73
11k
Designing Experiences People Love
moore
142
24k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Bash Introduction
62gerente
615
210k
Leading Effective Engineering Teams in the AI Era
addyosmani
8
720
Optimising Largest Contentful Paint
csswizardry
37
3.5k
Documentation Writing (for coders)
carmenintech
76
5.1k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.6k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.7k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
A better future with KSS
kneath
239
18k
Gamification - CAS2011
davidbonilla
81
5.5k
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 }