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!

Go, Ruby, Go!

= :

a “Hello, 世界” Lexer [tIDENTIFIER, “a”], [tCOLON, “:”], [tEQL, “=”], [tSTRING, “Hello, 世界”] Parser

: SyntaxError

How to fix this? • Ask the Core team to add := • Fork Ruby • Juggle AST like it’s 1999

Coming up next, ruby-next

a “Hello, 世界” Lexer [tIDENTIFIER, “a”], [tGOEQL, ” “], [tSTRING, “Hello, 世界”] Parser

:

: (lvasgn :a (str “Hello, 世界”))

a “Hello, 世界” Lexer [tIDENTIFIER, “a”], [tGOEQL, ” “], [tSTRING, “Hello, 世界”] Parser (lvasgn :a (str “Hello, 世界”))

:

: gem “parser”

a “Hello, 世界” Ragel Lexer [tIDENTIFIER, “a”], [tGOEQL, ” “], [tSTRING, “Hello, 世界”] Parser (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]

a “Hello, 世界” Ragel Lexer [tIDENTIFIER, “a”], [tGOEQL, ” “], [tSTRING, “Hello, 世界”] Parser (lvasgn :a (str “Hello, 世界”))

:

: gem “parser”

a “Hello, 世界” Ragel Lexer [tIDENTIFIER, “a”], [tGOEQL, ” “], [tSTRING, “Hello, 世界”] Racc Parser (lvasgn :a (str “Hello, 世界”))

:

: gem “parser”

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

a “Hello, 世界” Ragel Lexer [tIDENTIFIER, “a”], [tGOEQL, ” “], [tSTRING, “Hello, 世界”] Racc Parser (lvasgn :a (str “Hello, 世界”))

:

: gem “parser”

Transpiler mode Runtime mode

a “Hello, 世界”

: (lvasgn :a (str “Hello, 世界”))

a “Hello, 世界”

: (lvasgn :a (str “Hello, 世界”)) a = “Hello, 世界” (lvasgn :a (str “Hello, 世界”))

a “Hello, 世界” ^^ tGOEQL ” “

:

: (lvasgn :a (str “Hello, 世界”)) a = “Hello, 世界” ^ tEQL “=” (lvasgn :a (str “Hello, 世界”))

If you give a man a fish…

https://evl.ms/obey

Questions?