The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Someone's Growing an Annotator for Himself and Others

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Red Handed

Posts: 1158
Nickname: redhanded
Registered: Dec, 2004

Red Handed is a Ruby-focused group blog.
Someone's Growing an Annotator for Himself and Others Posted: Nov 22, 2005 11:40 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Red Handed.
Original Post: Someone's Growing an Annotator for Himself and Others
Feed Title: RedHanded
Feed URL: http://redhanded.hobix.com/index.xml
Feed Description: sneaking Ruby through the system
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Red Handed
Latest Posts From RedHanded

Advertisement

If you haven’t already subscribed, Mauricio Fernandez’ new blog at eigenclass.org is the most exciting blogride on the Ruby frontier. These hacks he’s posting are amazing. If there were a commercial for his blog, it’d show a kid chewing gum. Then a tidal wave. Then fruit syrup gushing through the kids mouth and jets of juice shooting out between his teeth like the dam’s gonna blow.

It does. Indigenous peoples die playing their bongos. Kids everywhere want their mouths to explode, too.

Take his xmp.rb, hacked in conspiracy with young and bright-futured and tumblicious and tumblelificent chris2. You feed this thing bunch of Ruby code and it annotates the code with output from the script, errors and warnings.

 RUBY_VERSION # => "1.8.3" 
 a = @a # !> instance variable @a not initialized
 class Foo
   def baz(n)
     (1..n).inject do |s,x|
       s + x   # => 3, 6, 10
     end
   end

   def bar(x)
     x.gsub(/foo/, "bar") # => "this is a bar", "this bar is bar" 
   end

   1+1 # => 2
 end

Look at the inject loop! It’ll print a joined list of values. Very tricky, Mauricio, you sly little man. I don’t know exactly how tall you are, Mauricio, but no one this conniving can be anyone other than the real Rumpelstiltzkin. Spinning code into gold. A gold purse for the rubies, how dare they glitter so brilliantly in mine eyes.

You know what would be wild? To use this as a way of writing test cases. You write the code that needs to be tested and annotate it with the asserts. (Also see Mauricio’s Changes in 1.9, a painstaking summary of what’s in Ruby’s HEAD right now.)

Read: Someone's Growing an Annotator for Himself and Others

Topic: Signal vs. Noise Closes Comments to Non-Hoodwink'rs Previous Topic   Next Topic Topic: FuseFS - a hidden gem!

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use