Ruby Under a Microscope

1593275277


1 review

Written by Pat Shaughnessy

Published by No Starch Press

Nov, 2013

248 pages

READ       REVIEWS       DOWLOAD

Description

Ruby Under a Microscope: Learning Ruby Internals Through Experiment Ruby is a powerful programming language with a focus on simplicity, but beneath its elegant syntax, the language is performing countless unseen tasks. Ruby Under a Microscope gives developers an inside, hands-on look at Ruby's core, using simple diagrams coupled with clear explanations. Author Pat Shaughnessy takes a scientific approach, laying out a series of experiments with Ruby code to demonstrate how things work. Shaughnessy's lucid illustrations will serve as a guide for developers writing Ruby programs. Developers of all stripes will find this a fascinating behind the scenes look at how programming languages work.

The Table of Contents

1. Tokenization, Parsing and Compilation 13
Tokens: the words that make up the Ruby language 15
Parsing: how Ruby understands the code you write 24
Compilation: how Ruby translates your code into a new language 43
Tokenization, parsing and compilation in JRuby 64
Tokenization, parsing and compilation in Rubinius 68 2. How Ruby Executes Your Code 74
YARV’s internal stack and your Ruby stack 76
Local and dynamic access of Ruby variables 88
How YARV controls your program’s execution flow 102
How JRuby executes your code 113
How Rubinius executes your code 117 3. Objects, Classes and Modules 122
What’s inside a Ruby object? 124
Deducing what’s inside the RClass structure 136
How Ruby implements modules and method lookup 149
Objects, classes and modules in JRuby 163
Objects, classes and modules in Rubinius 168 4. Hash Tables 171
Hash tables in Ruby 173
How hash tables expand to accommodate more values 180
How Ruby implements hash functions 189
Hash tables in JRuby 199
Hash tables in Rubinius 202 5. How Ruby borrowed a decades old idea from Lisp 204
Blocks: Closures in Ruby 206
Lambdas and Procs: treating functions as a first class citizen 219
Metaprogramming and closures: eval, instance_eval and binding 239
Closures in JRuby 253
Closures in Rubinius 256

Publish

Title: Ruby Under a Microscope
Author: Pat Shaughnessy
Language: English
Length: 248
Edition: 1
Publisher: No Starch Press
Publication Date: 2013-11-22
ISBN-10: 1593275277
ISBN-13: 9781593275273
NOTICE: BOOK CONTENT AND LINKS HAVE HARVESTED FROM THE INTERNET, YOU MAY GET BROKEN LINK OR COPYRIGHT INFRINGEMENT COMPLAINT. YOU CAN BUY THIS BOOK OR PLEASE MAIL TO MICHAELJBREUER@GMX.COM TO REPORT ISSUE

Tags