Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Ruby without the Syntax
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Syed Faraaz Ahmad
December 16, 2023
120
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
Transcript
35 slides
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
More Decks by Syed Faraaz Ahmad
See All by Syed Faraaz Ahmad
BYOJ: Build your Own JIT (RubyConfTH 2023)
faraazahmad
0
120
Featured
See All Featured
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
640
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.3k
Context Engineering - Making Every Token Count
addyosmani
9
1.3k
30 Presentation Tips
portentint
PRO
1
470
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
400
Test your architecture with Archunit
thirion
2
2.5k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
300
Agile that works and the tools we love
rasmusluckow
331
22k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
480
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M