Skip to content

Commit

Permalink
fix linx
Browse files Browse the repository at this point in the history
  • Loading branch information
raganwald committed Oct 30, 2012
1 parent c90a1f1 commit 0f92b73
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 27 deletions.
26 changes: 13 additions & 13 deletions README.md
@@ -1,14 +1,14 @@
The RewriteRails Plug-In
========================

The [RewriteRails](http://github.com/raganwald/rewrite_rails/tree/master) plug-in adds syntactic abstractions like [Andand](http://github.com/raganwald/rewrite_rails/tree/master/doc/andand.textile "") and [String to Block](http://github.com/raganwald/rewrite_rails/tree/master/doc/string_to_block.md#readme "") to Rails projects [without monkey-patching](http://avdi.org/devblog/2008/02/23/why-monkeypatching-is-destroying-ruby/ "Monkeypatching is Destroying Ruby"). All of the power and convenience, none of the compatibility woes and head-aches.
The [RewriteRails](http://github.com/raganwald-deprecated/rewrite_rails/tree/master) plug-in adds syntactic abstractions like [Andand](http://github.com/raganwald-deprecated/rewrite_rails/tree/master/doc/andand.textile "") and [String to Block](http://github.com/raganwald-deprecated/rewrite_rails/tree/master/doc/string_to_block.md#readme "") to Rails projects [without monkey-patching](http://avdi.org/devblog/2008/02/23/why-monkeypatching-is-destroying-ruby/ "Monkeypatching is Destroying Ruby"). All of the power and convenience, none of the compatibility woes and head-aches.

Status
---

![Abandoned Detroit Building](http://4.bp.blogspot.com/_KpwLRD2yHOc/SbV08STzgwI/AAAAAAAACOc/KLzn19-KAvM/s400/crumbling_dome_2.jpg)

RewriteRails is not in active development at this time. RewriteRails evolved from [Rewrite](http://github.com/raganwald/rewrite). Rewrite asked the question "Can syntactic meta-programming work in Ruby?" The answer was "Yes." RewriteRails asked the question "Can syntactic meta-programming be convenient enough to be useful in an actual production Rails project?" The answer was "Yes, but..."
RewriteRails is not in active development at this time. RewriteRails evolved from [Rewrite](http://github.com/raganwald-deprecated/rewrite). Rewrite asked the question "Can syntactic meta-programming work in Ruby?" The answer was "Yes." RewriteRails asked the question "Can syntactic meta-programming be convenient enough to be useful in an actual production Rails project?" The answer was "Yes, but..."

For more information, read [A Difficult Distraction](https://github.com/raganwald/homoiconic/blob/master/2010/02/difficult_distraction.md#readme) and [Why I Write Concept Software](https://github.com/raganwald/homoiconic/blob/master/2010/09/concept.md#readme). Also, [Forgotten Detroit][fg] has more interesting pictures like this.

Expand All @@ -28,21 +28,21 @@ Q & A

**What language features does RewriteRails support?**

* [Andand](http://github.com/raganwald/rewrite_rails/tree/master/doc/andand.textile) is a lightweight Maybe Monad. The RewriteRails version provides shortcut execution semantics.
* [Into](http://github.com/raganwald/rewrite_rails/tree/master/doc/into.md#readme) is a Thrush Combinator.
* [String to Block](http://github.com/raganwald/rewrite_rails/tree/master/doc/string_to_block.md#readme) provides a really lightweight syntax for writing pure functional blocks.
* [Call by Name](http://github.com/raganwald/rewrite_rails/tree/master/doc/call_by_name.md#readme) is a really easy way to fake your own macros without needing to fool around with syntax trees.
* [Extension Methods](http://github.com/raganwald/rewrite_rails/tree/master/doc/extension_methods.md#readme) lets you extend classes with your own methods without global monkey-patches.
* [Returning](http://github.com/raganwald/rewrite_rails/tree/master/doc/returning.md#readme) improves Rails' Kestrel Combinator by handling re-assignment.
* [Block Anaphora](http://github.com/raganwald/rewrite_rails/tree/master/doc/block_anaphora.md#readme) provides support for Groovy's `it` and Common Lisp's Anaphora.
* [Andand](http://github.com/raganwald-deprecated/rewrite_rails/tree/master/doc/andand.textile) is a lightweight Maybe Monad. The RewriteRails version provides shortcut execution semantics.
* [Into](http://github.com/raganwald-deprecated/rewrite_rails/tree/master/doc/into.md#readme) is a Thrush Combinator.
* [String to Block](http://github.com/raganwald-deprecated/rewrite_rails/tree/master/doc/string_to_block.md#readme) provides a really lightweight syntax for writing pure functional blocks.
* [Call by Name](http://github.com/raganwald-deprecated/rewrite_rails/tree/master/doc/call_by_name.md#readme) is a really easy way to fake your own macros without needing to fool around with syntax trees.
* [Extension Methods](http://github.com/raganwald-deprecated/rewrite_rails/tree/master/doc/extension_methods.md#readme) lets you extend classes with your own methods without global monkey-patches.
* [Returning](http://github.com/raganwald-deprecated/rewrite_rails/tree/master/doc/returning.md#readme) improves Rails' Kestrel Combinator by handling re-assignment.
* [Block Anaphora](http://github.com/raganwald-deprecated/rewrite_rails/tree/master/doc/block_anaphora.md#readme) provides support for Groovy's `it` and Common Lisp's Anaphora.

**Do we really have to go to all the trouble of rewriting code to support these features?**

Some of rewriters--such as [Into](http://github.com/raganwald/rewrite_rails/tree/master/doc/into.md#readme) and [Extension Methods](http://github.com/raganwald/rewrite_rails/tree/master/doc/extension_methods.md#readme)--could have been implemented by opening core classes and monkey-patching, but implementing them as rewriters means that you have higher performance and [fewer conflicts with existing code](http://blog.lawrencepit.com/2009/01/11/try-as-you-might/ "Try() as you might").
Some of rewriters--such as [Into](http://github.com/raganwald-deprecated/rewrite_rails/tree/master/doc/into.md#readme) and [Extension Methods](http://github.com/raganwald-deprecated/rewrite_rails/tree/master/doc/extension_methods.md#readme)--could have been implemented by opening core classes and monkey-patching, but implementing them as rewriters means that you have higher performance and [fewer conflicts with existing code](http://blog.lawrencepit.com/2009/01/11/try-as-you-might/ "Try() as you might").

Some of the rewriters--such as [Andand](http://github.com/raganwald/rewrite_rails/tree/master/doc/andand.textile) and [String to Block](http://github.com/raganwald/rewrite_rails/tree/master/doc/string_to_block.md#readme "doc/string_to_block.md")--have better semantics when implemented using rewriting instead of opening classes.
Some of the rewriters--such as [Andand](http://github.com/raganwald-deprecated/rewrite_rails/tree/master/doc/andand.textile) and [String to Block](http://github.com/raganwald-deprecated/rewrite_rails/tree/master/doc/string_to_block.md#readme "doc/string_to_block.md")--have better semantics when implemented using rewriting instead of opening classes.

And some of the rewriters--such as [Call by Name](http://github.com/raganwald/rewrite_rails/tree/master/doc/call_by_name.md#readme) and [Block Anaphora](http://github.com/raganwald/rewrite_rails/tree/master/doc/block_anaphora.md#readme "doc/block_anaphora.md")--simply cannot be implemented without rewriting code.
And some of the rewriters--such as [Call by Name](http://github.com/raganwald-deprecated/rewrite_rails/tree/master/doc/call_by_name.md#readme) and [Block Anaphora](http://github.com/raganwald-deprecated/rewrite_rails/tree/master/doc/block_anaphora.md#readme "doc/block_anaphora.md")--simply cannot be implemented without rewriting code.

**How does it work?**

Expand Down Expand Up @@ -107,7 +107,7 @@ Second, it's better for you *today*. If someone else goes wild with monkey-patch

**Sounds great! Are there any issues I should know about before jumping in with both feet?**

[Yes](http://github.com/raganwald/rewrite_rails/tree/master/doc/issues.md#readme "Issues").
[Yes](http://github.com/raganwald-deprecated/rewrite_rails/tree/master/doc/issues.md#readme "Issues").

**How does this differ from the old rewrite gem?**

Expand Down
4 changes: 2 additions & 2 deletions doc/block_anaphora.md
@@ -1,7 +1,7 @@
Block Anaphora
===

The [RewriteRails](http://github.com/raganwald/rewrite_rails/tree/master) plugin supports Block Anaphora: When writing a block that takes just one parameter, you can use either `it` or `its` as a parameter without actually declaring the parameter using `{ |it| ... }`. This is a win whenever the purpose of the block and the parameter is obvious, for example:
The [RewriteRails](http://github.com/raganwald-deprecated/rewrite_rails/tree/master) plugin supports Block Anaphora: When writing a block that takes just one parameter, you can use either `it` or `its` as a parameter without actually declaring the parameter using `{ |it| ... }`. This is a win whenever the purpose of the block and the parameter is obvious, for example:

Person.all(...).map { its.first_name }

Expand Down Expand Up @@ -33,4 +33,4 @@ The post [Anaphora in Ruby](http://github.com/raganwald/homoiconic/blob/master/2

---

[RewriteRails](http://github.com/raganwald/rewrite_rails/tree/master#readme)
[RewriteRails](http://github.com/raganwald-deprecated/rewrite_rails/tree/master#readme)
4 changes: 2 additions & 2 deletions doc/call_by_name.md
@@ -1,7 +1,7 @@
Call by Name
===

[RewriteRails](http://github.com/raganwald/rewrite_rails "raganwald's rewrite_rails at master - GitHub") supports creation of things that look like Kernel methods with [Call by Name](http://en.wikipedia.org/wiki/Call-by-value "Evaluation strategy - Wikipedia, the free encyclopedia") semantics. It works like this. First, you write an instance method in the `RewriteRails::CallByName` module:
[RewriteRails](http://github.com/raganwald-deprecated/rewrite_rails "raganwald's rewrite_rails at master - GitHub") supports creation of things that look like Kernel methods with [Call by Name](http://en.wikipedia.org/wiki/Call-by-value "Evaluation strategy - Wikipedia, the free encyclopedia") semantics. It works like this. First, you write an instance method in the `RewriteRails::CallByName` module:

RewriteRails::CallByName.class_eval do
def try_these(*expressions)
Expand Down Expand Up @@ -137,4 +137,4 @@ My answer: *You use them as if they were instance methods defined in Kernel, so

---

[RewriteRails](http://github.com/raganwald/rewrite_rails/tree/master#readme)
[RewriteRails](http://github.com/raganwald-deprecated/rewrite_rails/tree/master#readme)
4 changes: 2 additions & 2 deletions doc/extension_methods.md
Expand Up @@ -3,7 +3,7 @@ Extension Methods

> An **extension method** is a new language feature of C# starting with the 3.0 specification, as well as Visual Basic.NET starting with 9.0 and Oxygene with 2.0. Extension methods enable you to "add" methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type. Extension methods are a special kind of static method, but they are called as if they were instance methods on the extended type. For client code written in C# and Visual Basic, there is no apparent difference between calling an extension method and the methods that are actually defined in a type. --[Wikipedia](http://en.wikipedia.org/wiki/Extension_method "Extension Methods")
With [RewriteRails](http://github.com/raganwald/rewrite_rails "raganwald's rewrite_rails"), you can now write Extension Methods for your Ruby on Rails projects. Just like in C#, you can "add" methods to existing classes or module (like Enumerable) without modifying the original class or module. The benefit is that your changes *never* [conflict with other code](http://github.com/raganwald/homoiconic/blob/master/2009-04-08/sick.md#readme "I'm Sick of this Shit"). The headaches of opening core classes simply go away.
With [RewriteRails](http://github.com/raganwald-deprecated/rewrite_rails "raganwald's rewrite_rails"), you can now write Extension Methods for your Ruby on Rails projects. Just like in C#, you can "add" methods to existing classes or module (like Enumerable) without modifying the original class or module. The benefit is that your changes *never* [conflict with other code](http://github.com/raganwald/homoiconic/blob/master/2009-04-08/sick.md#readme "I'm Sick of this Shit"). The headaches of opening core classes simply go away.

**How to Write an Extension Method**

Expand Down Expand Up @@ -226,4 +226,4 @@ Don't forget that like extension methods defined in `RewriteRails::ExtensionMeth

---

[RewriteRails](http://github.com/raganwald/rewrite_rails/tree/master#readme)
[RewriteRails](http://github.com/raganwald-deprecated/rewrite_rails/tree/master#readme)
4 changes: 2 additions & 2 deletions doc/into.md
Expand Up @@ -26,7 +26,7 @@ But we are not interested in theory. `#into` may be equivalent to what we can ac
Rewriting `#into`
---

In [RewriteRails](http://github.com/raganwald/rewrite_rails "raganwald's rewrite_rails at master - GitHub"), `#into` is implemented with local assignment. So our example above:
In [RewriteRails](http://github.com/raganwald-deprecated/rewrite_rails "raganwald's rewrite_rails at master - GitHub"), `#into` is implemented with local assignment. So our example above:

(1..100).select(&:odd?).inject(&:+).into { |x| x * x }

Expand Down Expand Up @@ -55,4 +55,4 @@ The monkey-patching version also works with things that can be converted to proc

---

[RewriteRails](http://github.com/raganwald/rewrite_rails/tree/master#readme)
[RewriteRails](http://github.com/raganwald-deprecated/rewrite_rails/tree/master#readme)
6 changes: 3 additions & 3 deletions doc/returning.md
@@ -1,7 +1,7 @@
Returning
===

The [RewriteRails](http://github.com/raganwald/rewrite_rails/tree/master) plug-in now includes its own version of #returning that overrides the #returning shipping with ActiveSupport :-o
The [RewriteRails](http://github.com/raganwald-deprecated/rewrite_rails/tree/master) plug-in now includes its own version of #returning that overrides the #returning shipping with ActiveSupport :-o

When RewriteRails is processing source code, it turns code like this:

Expand Down Expand Up @@ -36,9 +36,9 @@ Like all processors in RewriteRails, #returning is only rewritten in `.rr` files

**More**

* [returning.rb](http://github.com/raganwald/rewrite_rails/tree/master/lib/rewrite_rails/returning.rb "")
* [returning.rb](http://github.com/raganwald-deprecated/rewrite_rails/tree/master/lib/rewrite_rails/returning.rb "")
* [Rewriting Returning in Rails](http://github.com/raganwald/homoiconic/blob/master/2009-08-29/returning.md#readme "")

---

[RewriteRails](http://github.com/raganwald/rewrite_rails/tree/master#readme)
[RewriteRails](http://github.com/raganwald-deprecated/rewrite_rails/tree/master#readme)
4 changes: 2 additions & 2 deletions doc/string_to_block.md
Expand Up @@ -96,7 +96,7 @@ When should we use all these tricks?
How does *String to Block* differ from `String#to_proc`?
---

First, [RewriteRails](http://github.com/raganwald/rewrite_rails "raganwald's rewrite_rails at master - GitHub") preprocesses your Ruby code before the file is read. Therefore, you only pay the cost of converting a String to a Block once, not every time the code is evaluated. This is a very big performance optimization. Second, *String to Block* only works with literal strings. It isn't possible to construct a string at run time and then convert it to a block with `&`.
First, [RewriteRails](http://github.com/raganwald-deprecated/rewrite_rails "raganwald's rewrite_rails at master - GitHub") preprocesses your Ruby code before the file is read. Therefore, you only pay the cost of converting a String to a Block once, not every time the code is evaluated. This is a very big performance optimization. Second, *String to Block* only works with literal strings. It isn't possible to construct a string at run time and then convert it to a block with `&`.

Third (and this is a subtle point), `String#to_proc` worked by using `eval` in the global environment, therefore the procs it produced were not closures in the ordinary sense of the word. For example, with `String#to_proc`:

Expand All @@ -116,4 +116,4 @@ This works because RewriteRails doesn't construct a string and ask Ruby to `eval

---

[RewriteRails](http://github.com/raganwald/rewrite_rails/tree/master#readme)
[RewriteRails](http://github.com/raganwald-deprecated/rewrite_rails/tree/master#readme)
2 changes: 1 addition & 1 deletion rewrite_rails.gemspec
Expand Up @@ -4,7 +4,7 @@ Gem::Specification.new do |s|
s.date = "2009-01-06"
s.summary = "Code rewriting for Ruby on Rails projects"
s.email = "reg@braythwayt.com"
s.homepage = "hhttp://github.com/raganwald/rewrite_rails/tree/master"
s.homepage = "hhttp://github.com/raganwald-deprecated/rewrite_rails/tree/master"
s.description = " Code rewriting for Ruby on Rails projects."
s.has_rdoc = false
s.authors = ["Reg Braithwaite"]
Expand Down

0 comments on commit 0f92b73

Please sign in to comment.