Permalink
Browse files

Fix typo.

  • Loading branch information...
1 parent 2f51aca commit 9ed928da1dd1f5524bf867d798248ddbeae39e1c @r00k r00k committed May 23, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 2012/05/anaphora.md
View
@@ -44,7 +44,7 @@ Could anaphors be added to Ruby where none previously existed? Yes. Sort of.
A *block anaphor* is a meta-variable that can be used in a Ruby block to refer to its only parameter. Consider the popular Symbol#to\_proc. Symbol#to\_proc is the standard way to abbreviate blocks that consist of a single method invocation, typically without parameters. For example if you want the first name of a collection of people records, you might use `Person.all(...).map(&:first_name)`.
-Some languages provide a special meta-variable that can be used in a similar way. if `it` was a block anaphor in Ruby, you could write `Person.all(...).map { it.first_name }`. Of course, Ruby doesn't have block anaphora built in, so people kludged workarounds, and sting#to\_proc was so popular that it became enshrined in the language itself.
+Some languages provide a special meta-variable that can be used in a similar way. if `it` was a block anaphor in Ruby, you could write `Person.all(...).map { it.first_name }`. Of course, Ruby doesn't have block anaphora built in, so people kludged workarounds, and Symbol#to\_proc was so popular that it became enshrined in the language itself.
Jay Phillips implemented a simple block anaphor called [Methodphitamine](http://jicksta.com/posts/the-methodphitamine "The Methodphitamine at Adhearsion Blog by Jay Phillips"). `it` doesn't seem like much of a win when you just want to send a message without parameters. But if you want to do more, such as invoke a method with a parameter, or if you want to chain several methods, you are out of luck. Symbol#to\_proc does not allow you to write `Person.all(...).map(&:first_name[0..3])`. With Methodphitamine you can write:

0 comments on commit 9ed928d

Please sign in to comment.