

Ruby hacking guide - steveklabnik
http://ruby-hacking-guide.github.io/

======
Legion
Anyone interested in this kind of content should see Pat Shaughnessy's Ruby
Under a Microscope book: [http://patshaughnessy.net/ruby-under-a-
microscope](http://patshaughnessy.net/ruby-under-a-microscope)

It's the closest thing we have to a new Ruby Hacking Guide. It's a somewhat
gentler, more approachable treatment of the subject matter, but no less
awesome.

Shaughnessy also has a number of blog posts on his site that dive into the
same kind of details covered in his book (and RHG).

~~~
VeejayRampay
Pat is awesome and a great pedagogue. I second this, his articles, books and
guides are absolute must-reads for the Ruby enthusiast.

------
cremno
A better translation of chapter 11:
[http://whitequark.org/blog/2013/04/01/ruby-hacking-guide-
ch-...](http://whitequark.org/blog/2013/04/01/ruby-hacking-guide-ch-11-finite-
state-lexer/)

------
revskill
There is a quote: "Rails is like Bible. Unless you are a Saint, you do not
need to understand it and you probably will never understand; all you need to
do is to believe in it."

Ruby changed my life, it changed my mindset.

------
jamesbritt
Just how big are the differences between Ruby 1.7.3 (the topic of this hacking
guide) and the current version?

Has anything fundamental changed in how Ruby manages objects or does garbage
collection?

~~~
InAnEmergency
I suspect it has changed considerably, especially with the change from full
interpreter to VM in Ruby 1.9.

Garbage collection has changed from regular mark-and-sweep to lazy sweep to
using bitmap marking.

------
denysonique
Doesn't mention how @@ is evil. @@ are not your usual class variables. @@
should be avoided in most programs.

~~~
VeejayRampay
Yep, as Martin Fowler nicely points out in
[http://martinfowler.com/bliki/ClassInstanceVariable.html](http://martinfowler.com/bliki/ClassInstanceVariable.html)

"A class variable is shared across all instances of a class, which includes
all subclasses". Can be surprising when using inheritance.

~~~
meowface
Well, that behavior is not surprising or anything. Many other languages have
some kind of concept of a class instance variable (such as Python).

~~~
valisystem
You're right saying that it's the proper behavior for such a semantic. But the
problem is, @@ notation can make you forget you're not manipulating something
that might be shared and re-assigning an ancestor class variable accidentally,
messing up its behavior. And while it's common to check for method overrides,
class variable overrides is not something that is checked very frequently.

It is the kind of bug that can be very long to figure out, since when you make
this mistake, it's very likely because you forgot to think about this
behavior.

------
why-el
This is so awesome. I have been waiting for this to finish translating for
some time now. When I read the first two chapters almost a year ago, I was
pleased by how much detail the author goes into to explain the inner workings
of Ruby. I recommend it to everyone.

------
cjh_
This is extremely cool, I am becoming more interesting in the idea of trying
to write a small toy language and articles like this excite and inform, great
work.

------
djacobs
It would be great to host an up-to-date PDF with this, too. (Any interest in
publishing this when it's at 1.0?)

~~~
markburns
Sounds like a good idea. After a considerable length of inactivity we've had
some great translation contributions from github use ocha-. Taking it pretty
much to the finish line. I'll do some proofreading too, as I know he's not a
native English speaker. I guess epub formats etc would make sense too.

~~~
djacobs
I'm happy to contribute, too -- let me know if you're interested in any help
with editing or creating/maintaining a PDF.

~~~
markburns
Absolutely :) [https://github.com/ruby-hacking-guide/ruby-hacking-
guide.git...](https://github.com/ruby-hacking-guide/ruby-hacking-
guide.github.com/pulls/new) I'm taking the approach of trusting first, so if
your first PR isn't insane, then no reason not to add you to the team.

------
stephenitis
Thanks for taking the time and effort to create this Steve! I'm always looking
for more beginner and non-beginner resources to direct my friends too!

~~~
steveklabnik
I did not create this, I just saw the link float by Twitter.

------
theboywho
is there something like this for Scala ?

~~~
nahumfarchi
Or for python?

