The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Rash of Ruby Releases

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
Ryan Davis

Posts: 651
Nickname: zenspider
Registered: Oct, 2004

Ryan Davis is a ruby nerd.
Rash of Ruby Releases Posted: Jul 14, 2005 1:26 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Ryan Davis.
Original Post: Rash of Ruby Releases
Feed Title: Polishing Ruby
Feed URL: http://blog.zenspider.com/index.rdf
Feed Description: Musings on Ruby and the Ruby Community...
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Ryan Davis
Latest Posts From Polishing Ruby

Advertisement

Toys

I just finished releasing a WHOLE bunch o' stuff, all gemified and cleaned up, mainly so that we could contribute the following solution to this week's ruby quiz (serializable procs):

require 'r2c_hacks'
class ProcStore # We have to have this because yaml calls allocate on Proc
  def initialize(&proc)
    @p = proc.to_ruby
  end

  def call(*args)
    eval(@p).call(*args)
  end
end

code = ProcStore.new { |x| return x+1 }
=> #<ProcStore:0x3db25c @p="proc do |x|\n  return (x + 1)\nend">

OK, well, that obviously isn't the whole solution, but now that we've added Proc.to_ruby, it really is that simple. To see how simple it really is, check out our implementation:

class Proc
  ProcStoreTmp = Class.new unless defined? ProcStoreTmp
  def to_ruby
    ProcStoreTmp.send(:define_method, :myproc, self)
    m = ProcStoreTmp.new.method(:myproc)
    result = m.to_ruby.sub!(/def myproc\(([^\)]+)\)/, 'proc do |\1|')
    return result
  end
end
We would have bypassed ProcStore entirely had we known how to get YAML to not call allocate on Proc when it was loading a proc back in. But, we were tired.

The Releases!

We released the following:

RubyInline 3.4.0 with:

+ 2 minor enhancements:
    + Changed inline to take the language and a hash of options.
        + Still backwards compatible, for now, and emits a warning.
    + Options are available via the builder passed to your block.
+ 2 bug fixes:
    + Modified caller discovery, yet again, due to changes in ruby 1.8.3.
    + More compatible and clean with non-gems systems.

ParseTree 1.3.7 with:

+ 3 bug fixes:
    + Fixed rubygem requires for non-gem systems.
    + Renamed on to on_error_in to make more clear.
    + Moved exceptions to their own tree to make catching cleaner.

ruby2c 1.0.0 beta 4 with:

+ 1 minor enhancements
    + Added gemspec (hastily).
+ 2 bug fixes
    + Translates bool type to VALUE since we were using Qtrue/Qfalse.
    + Fixed rubygems for non-gem systems.

and finally ZenHacks 1.0.1 with:

+ 4 minor enhancements:
    + Added Graph#save and edge accessors for customizations.
    + Added Proc#to_ruby in r2c_hacks.
    + Added RubyToRuby#rewrite_defn to support bmethods (read: procs).
    + Added Class#optimize(*methods) to zenoptimize.
    + Added bin/nopaste for cmdline access to nopaste on rafb.net.
    + Added bin/quickbench to generate ruby benchmark templates quickly.
+ 4 bug fixes:
    + Fixed gems for non-gem systems.
    + Fixed minor output problem with RubyToRuby#process_defn.
    + Added some minor (performance) enhancements to zenoptimize.
    + Added requirements to gemspec to quell whining.

Read: Rash of Ruby Releases

Topic: Agile India 2005, Mumbai Previous Topic   Next Topic Topic: Rails 0.13.1: Faster for all, eager limits, more Ajax

Sponsored Links



Google
  Web Artima.com   

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