Friday 20 January 2012

Scope, Space, Nursing, Informatics: Fusion I

Paolo Perrotta writes:
Imagine being a little debugger making your way through a Ruby program. You jump from statement to statement until you finally hit a breakpoint. Now, catch your breath and look around. See the scenery around you? That's your scope.

You can see bindings all over the scope. Look down at your feet, and you see a bunch of local variables. Raise your head, and you see that you're standing within an object, with its own methods and instance variables; that's the current object, also known as self. Further away, you see the tree of constants so clear that you could mark your current position on a map. Squint your eyes, and you can even see a bunch of global variables off in the distance. p.75.

Paolo Perrotta, (2010). Metaprogramming Ruby, The Pragmatic Bookshelf.

No comments:

Post a Comment