Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ruby MRI Source Code Idioms #1: Accessing Data Via Macros (patshaughnessy.net)
43 points by rjsamson on Jan 23, 2013 | hide | past | favorite | 12 comments


MRI is the first language interpreter that I got deeply familiar with and it's a pleasure to read. It was really nice to be able to find the answer to questions like "how does Ruby decide when to trigger a thread switch" by spending just a few minutes going to the source.


Absolutely - it is a pleasure to read. Someday I'd like to learn how another language is implemented, maybe JavaScript or something like Haskell, but I'm afraid the language source code will be much more difficult to understand than Ruby's is.


You can maybe start with a Scheme parser, it's quite simple.


Interesting idea - thanks for the suggestion!



Yup, (re)reading SICP is definitely on my list!



Once you can read some C, I'd recommend reading over another bytecode interpreter, like mawk (Mike's AWK): http://invisible-island.net/mawk/ . Another good read is the TinyCC compiler (originally by Fabrice Bellard, who did QEMU among other things): http://savannah.nongnu.org/projects/tinycc . It's a small, mostly readable, fully functional C compiler.


Awesome links - thank you!


Very interesting indeed, sir. I've personally also found a lot of joy in diving down into C implementations (in my case, the JNI, although Ruby is my language of choice).

You've certainly inspired me to take a closer look at the MRI, as well as macros in general. Thanks!


Cool work, again, Pat. Makes me wish I was back in school and could justify spending more time on looking at the internals and finding that satisfaction in knowing how things truly work under the hood.


Thanks! Yea for some reason learning how things work is often more satisfying to me than building stuff... I guess I'm more of a scientist than an engineer?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: