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
Ruby without the Syntax
Search
Syed Faraaz Ahmad
December 16, 2023
110
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Ruby without the Syntax
Syed Faraaz Ahmad
December 16, 2023
More Decks by Syed Faraaz Ahmad
See All by Syed Faraaz Ahmad
BYOJ: Build your Own JIT (RubyConfTH 2023)
faraazahmad
0
96
Featured
See All Featured
The Mindset for Success: Future Career Progression
greggifford
PRO
0
430
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.7k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.5k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
350
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
470
My Coaching Mixtape
mlcsv
0
180
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.4k
Navigating Team Friction
lara
192
16k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.7k
Facilitating Awesome Meetings
lara
57
7k
Transcript
ruby without the syntax
Faraaz Ahmad Twitter: @Faraaz98 Github: faraazahmad
interpreted? / compiled?
Y E S
Compiled, then interpreted 1 + 2 putobject 1 putobject 2
opt_plus leave
Yet Another Virtual Machine a.k.a YARV putobject 1 putobject 2
opt_plus leave YARV 010101010101 100001010101 001010101010 101000010101 010100001011
W.W.Y.D. What Would YARV Do?
github.com/ruby/ruby
Ruby on Cocaine…
Ruby C API
Ruby: def foo; end YARV: definemethod foo C API: rb_define_global_function(
"foo", my_method, argc );
class.c
Top level methods are stored in the Kernel module >
puts 25 25 => nil > Kernel.puts 25 25 => nil
Top level methods are stored in the Kernel module >
def foo = 420 => :foo > Kernel.private_methods => [..., :foo, ...]
None
PseudoRuby Examples
Init the VM
Sum of 2 numbers
Sum of 2 numbers
Area of circle
Area of circle
Define module and class
You can do all of it (I think) rb_require(...); rb_load(...);
rb_raise( rb_eRuntimeError, "Error code %d", 404 ); VALUE gv; rb_gv_set("$x", gv); gv = rb_gv_get("$x"); iv = rb_iv_get(obj, "@x");
Comparison
Ship your Ruby program as a single binary
Resources http://silverhammermba.github.io/emberb/c/ http://github.com/faraazahmad/pseudoruby
But why?
But why not?
None
None
None
Mess-around driven development
Mess-around driven development
Mess-around be nice. have fun.
Thank you