A presentation at Saint P Ruby Summer Meetup in August 2021 in St Petersburg, Russia by Svyatoslav Kryukov
Next Ruby Crafting a new ideal language with DSL and ruby-next
Ruby dev team goals • Performance (JIT) • Concurrency (Ractors) • Typing (RBS)
? ? ?
HR inbox
Are you ready to drop Ruby?
Are you ready to drop Ruby? Results YES NO 146% 0%
Wait a minute Who are you?
What’s next?
How to move away from Ruby? • Complete rewrite • Microservices • Perfect solution, silver bullet…
Let’s write Go
Let’s write Go in Ruby!
A Tour of Go: Hello World
Go package Functions, types, variables, and constants are visible to all source files within the same package
Go package Functions, types, variables, and constants are visible to all source files within the same package Feels like a Ruby Module
One method_missing to rule them all
Go, Ruby, Go!
= :
: SyntaxError
How to fix this? • Ask the Core team to add := • Fork Ruby • Juggle AST like it’s 1999
:=
Coming up next, ruby-next
: (lvasgn :a (str “Hello, 世界”))
: gem “parser”
Serious Shchi
Ragel State Machine Compiler • Finite-state machine compiler and a parser generator. • Works with a lot of languages (C, C++, Java, Go, Ruby, etc.)
2 + 2 Lexer [tNUMBER, 2], [tPLUS, “+”], [tNUMBER, 2]
Rake Rack Racc • Yacc/Bison like parser generator • Grammar le should contain: • parser class with de ned #next_token fi fi • rules block
[tNUMBER, 2], [tPLUS, “+”], [tNUMBER, 2] Parser [:send, [:number, 2], :+, [:number, 2]]
Lexer Parser
Lexer Parser “2 + (1 + 7) * 5”
Vin again
Transpiler mode Runtime mode
: (lvasgn :a (str “Hello, 世界”)) a = “Hello, 世界” (lvasgn :a (str “Hello, 世界”))
: (lvasgn :a (str “Hello, 世界”)) a = “Hello, 世界” ^ tEQL “=” (lvasgn :a (str “Hello, 世界”))
If you give a man a fish…
https://evl.ms/obey
Questions?
View Next Ruby. Crafting a new ideal language with DSL and ruby-next on Notist.
Dismiss