-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathruby-under-a-microscope.html
More file actions
27 lines (27 loc) · 9.2 KB
/
ruby-under-a-microscope.html
File metadata and controls
27 lines (27 loc) · 9.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>Pat Shaughnessy</title><meta name="description" content=""><meta name="author" content=""><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/assets/css/normalize.css"><link rel="stylesheet" href="/assets/css/skeleton.css"><link rel="alternate" type="application/atom+xml" title="Pat Shaughnessy - Feed" href="http://feeds2.feedburner.com/patshaughnessy"><link rel="icon" type="image/png" href="images/favicon.png"></head><body><div id="banner"><a href="/"><span id="title">Pat Shaughnessy</span><span id="tagline"> blogger, rubyist, aspiring author</span></a></div><div style="margin-top: 35px"><div class="nine columns"><div class="container"><div class="row"><article class="book"><p><i>I've started working on a new edition of Ruby Under a
Microscope that covers Ruby 3.x. I'm working on this in my
spare time, so it will take a while to finish. Leave a comment
or <a href="mailto:pat@patshaughnessy.net?subject=Ruby Under a Microscope Update">drop me a line</a> and I'll email you when it's finished.</i></p><header><h1>Have You Ever Wondered How Ruby Works Internally?</h1></header><section class="content"><div style="float: right; margin: 5px 0 0 15px;"><div id="book-tweet"><a class="top-buy-now" href="http://nostarch.com/rum">Buy Now at NoStarch.com</a></div><a href="http://nostarch.com/rum"><img id="book-cover" src="/assets/images/RUM_coverfront.png"></img></a></div><p></p></section><p>Everyone knows that Ruby is a powerful language. Its dynamic nature allows you to concisely write the code you need to actually solve a problem instead of burying yourself under mountains of boilerplate. You don't have to fight it; you just get to enjoy the ride.</p><p>But how is the magic created? And can you trust it? After all, MRI is written in C - a statically typed, compiled language which is pretty much the antithesis of Ruby. What <span>dark voodoo</span> is breathed into C to enable Ruby's features - closures, metaprogramming, and so much more?</p><h2>Find out with Science!</h2><p>Ruby Under a Microscope will guide you through the internals of some of Ruby's
most-used facets. Using experimentation, theory, and two truckloads of diagrams,
you'll <span>clearly see how Ruby is implemented</span>.</p><div class="diagram"><img src="/assets/images/tokenize.png"></img><div class="caption">Here's just one of the diagrams out of the two truckloads.</div><div class="caption">Did you think that was a exaggeration? Well, it isn't!</div></div><p>Here's a science fact for you: before they understood the nature of combustion,
Enlightenment chemists believed fire resulted from the release of a negative-weight
particle called "phlogiston". Then Antoine-Laurent Lavoisier knocked that theory
on its derrière by discovering oxygen and proving how combustion really works.</p><p>This book will offer you the same clarity. Instead of pointing at a Ruby block and
yelling, "Phlogiston!", you'll be able to lucidly explain how Ruby copies
variables from the stack to the heap in order to allow access to them even after
a function has returned.</p><p>Have no clue what that means? Well, that's exactly why you need to read this book.</p><p>And good news: you don't need to know a lick of C! If you can't tell your pointers
from your pointers to pointers, then have no fear. <span>Ruby Under a Microscope is accessible to anyone</span> with an interest in learning how Ruby works internally.</p><h2>People Already Love It</h2><p>Here's what people are already saying about <span>Ruby Under a Microscope</span>:</p><blockquote><div class="pic"><img src="/assets/images/avatars/peter.png"></img></div><div class="content">Many people have dug into the Ruby source code but few make it back out
and tell the tale as elegantly as Pat does in Ruby Under A Microscope! I
particularly love the diagrams - and there are lots of them - as they
make many opaque implementation topics a lot easier to understand,
especially when coupled with Pat's gentle narrative. This book is a
delight for language implementation geeks and Rubyists with a penchant
for digging into the guts of their tools.<footer>–<cite>Peter Cooper (<a href="https://twitter.com/peterc">@peterc</a>) — Editor of Ruby Inside and Ruby Weekly</cite></footer></div></blockquote><blockquote><div class="pic"><img src="/assets/images/avatars/xavier.jpg"></img></div><div class="content">going to proofread a draft of @pat_shaughnessy's "Ruby Under a Microscope", man this book was missing in the Ruby landscape, awesome content<footer>–<cite>Xavier Noria (<a href="https://twitter.com/fxn">@fxn</a>) — Ruby Hero, Ruby on Rails Core Team Member</cite></footer></div></blockquote><blockquote><div class="pic"><img src="/assets/images/avatars/santiago.jpg"></img></div><div class="content">Pat Shaughnessy did a tremendous job writing THE book about Ruby internals. Definitely a must read, you won't find information like this anywhere else.<footer>–<cite>Santiago Pastorino (<a href="https://twitter.com/spastorino">@spastorino</a>) — WyeWorks Co-Founder, Ruby on Rails Core Team Member</cite></footer></div></blockquote><blockquote><div class="pic"><img src="/assets/images/avatars/vlad.jpg"></img></div><div class="content">I really enjoyed the book and now know have a far better understanding of both Ruby and CS - thanks. Your writing made very complex topics (at least for me) very accessible and I found the book hard to put down. Diagrams were awesome and already are popping in my head as I code. This is by far one of my top 3 favourite Ruby books written.<footer>–<cite>Vlad Ivanovic (<a href="https://twitter.com/vladiim">@vladiim</a>) — Digital Strategist @ MassMedia Sydney.</cite></footer></div></blockquote><blockquote><div class="pic"><img src="/assets/images/avatars/deryl.jpg"></img></div><div class="content">While I'm not usually digging into Ruby Internals, your book was an absolute awesome read. Best $20 I've spent in ages.<footer>–<cite>David Deryl Downey (<a href="https://twitter.com/daviddwdowney">@daviddwdowney</a>) — Founder of CyberSpace Technologies Group</cite></footer></div></blockquote><h2>Table of Contents</h2><p></p><table id="toc"><tr><td class="main">Foreword by Aaron Patterson</td><td>xv</td></tr><tr><td class="main">Acknowledgments</td><td>vi</td></tr><tr><td class="main">Introduction</td><td>ix</td></tr><tr><td class="main">Chapter 1: Tokenization and Parsing</td><td>3</td></tr><tr><td class="main">Chapter 2: Compilation</td><td>31</td></tr><tr><td class="main">Chapter 3: How Ruby Executes Your Code</td><td>55</td></tr><tr><td class="main">Chapter 4: Control Structures and Method Dispatch</td><td>83</td></tr><tr><td class="main">Chapter 5: Objects and Classes</td><td>105</td></tr><tr><td class="main">Chapter 6: Method Lookup and Constant Lookup</td><td>133</td></tr><tr><td class="main">Chapter 7: The Hash Table: The Workhorse of Ruby Internals</td><td>167</td></tr><tr><td class="main">Chapter 8: How Ruby Borrowed a Decades-Old Idea from Lisp</td><td>191</td></tr><tr><td class="main">Chapter 9: Metaprogramming</td><td>219</td></tr><tr><td class="main">Chapter 10: JRuby: Ruby on the JVM</td><td>251</td></tr><tr><td class="main">Chapter 11: Rubinius: Ruby Implemented with Ruby</td><td>273</td></tr><tr><td class="main">Chapter 12: Garbage Collection in MRI, JRuby, and Rubinius</td><td>295</td></tr><tr><td class="main">Index</td><td>327</td></tr></table><h2>About Pat</h2><div id="mugshot"><img src="/assets/images/pat2.jpeg"></img></div><p>Pat Shaughnessy writes a blog about Ruby development here on this web site, <a href="https://patshaughnessy.net">patshaughnessy.net</a>. Pat's articles and presentations have been featured multiple times on the Ruby
Weekly newsletter, the Ruby5 podcast and the Ruby Show.</p><p>When he's not at the keyboard, Pat enjoys spending time with his wife and
two kids. Pat is also a fluent Spanish speaker and travels frequently to
Spain to visit his wife's family.</p><section class="comments"><div id="disqus_thread"><script type="text/javascript">var disqus_identifier = 'https://patshaughnessy.net/ruby-under-a-microscope'; var disqus_shortname = 'patshaughnessy';</script></div><script type="text/javascript" src="https://disqus.com/forums/patshaughnessy/embed.js"></script><noscript><a href="https://patshaughnessy.disqus.com/?url=ref">View the discussion thread.</a></noscript></section></article></div></div></div><script type="text/javascript">(function () {
var s = document.createElement('script'); s.async = true;
s.type = 'text/javascript';
s.src = 'https://' + disqus_shortname + '.disqus.com/count.js';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());</script></div><div id="footer" class="ten columns"><p>Content and UI design © 2008-2025 Pat Shaughnessy</p></div></body></html>