Seattle.RBBQ 7 comments

posted Friday, August 4, 2006 by topfunky

On Tuesday night I hosted the Seattle.rb at my house. I have this great little backyard that came with an outdoor table and chairs.

As always, there was a lively discussion.

  • First, we chose Francis Hwang as the recipient of the first Topfunky Corp-sponsored Red Rover Ruby Speakers series. He’ll be talking about “The API Construction Kit.” Thanks also to Adam Bouhenguel who had a very interesting proposal on Filament and Jacob Harris for a proposal on XML.
  • Bernie Thompson asked about what it would take to have a Ruby IDE that provided meaningful auto-suggestion of methods. Evan Webb pointed out that the dynamic nature of Ruby would make this rather vague. Since method arguments are only infrequently typed in Ruby, auto-completion would have to suggest objects for arguments that were duck-type compatible with how the arguments were used in the method. In addition, Ruby methods usually take a small number of arguments and are easier to remember, making auto-completion less needed than it is in other languages. This is still confusing to me since most auto-completion shows you the methods available for an object, not the arguments to another method. Still, it would be tough.
  • I asked if it will be possible to get the name of the current method in YARV or MetaRuby. Apparently you can do this right now by calling another method and having it return the result of caller.
def method_name
  if  /`(.*)'/.match(caller.first)
    return $1
  end
  nil
end

You can write a method that calls method_name to get the name of the current method.

def foo
  puts method_name
end

foo
=> "foo" 

Finally, why the lucky stiff appeared right as it was getting too dark to see (I don’t have any lights in the backyard yet). I interviewed all my neighbors and three pitbulls who swear that they didn’t see anyone on the block for the previous hour. I’m sure he sensed that a gathering of Rubyists was happening and teleported himself to Seattle.

7 comments

Leave a response

  • As per Robert Klemme and the discussion relating to the ‘using the current method name within current [the] method’, wouldn’t you think this to be a better solution?

    
    module Kernel
    private
      def this_method
        caller[0] =~ /`([^']*)'/ and $1
      end
    end
    

    For one, the syntax is a bit shorter, and the regex is a bit more optimal. (Again, this is Robert Klemme’s suggestion on the discussion… mine was a bit more obtuse).

    Also, the way that it is defined, it makes it easy to simply ask for this_method within the method. :)

    Just passing on the results of the discussion.

    M.T.

  • By the by, beautiful house!

  • Gravatar icon Danno

    That _why guy is a wizard, I just know it. He’s a wizard from the cover of SICP.

  • Thanks for the snippet for grabbing the method name. That’ll come in handy.

  • Gravatar icon topfunky

    @Matt: That’s much simpler…I’ll use it. Thanks!

  • Gravatar icon Tony

    I am a recovering ColdFusion and PHP victim and I’m looking for a kick ass group of developers to teach me how to stop waisting my time and start programing with Ruby. So how do I sign up here?

  • Gravatar icon topfunky

    @Tony: There are many Ruby Brigades around the world that you could join: http://rubyholic.com/

    If you’re in Seattle, we meet every Tuesday night at the Red Line restaurant. I hope to see you there!

    http://rubyholic.com/groups/show/1

Your Comment

Nuby on Rails

Geoffrey Grosenbach / Ruby / Code / Graphics / Design / Rails / Merb / Javascript / CSS

Manufactured with

Subscribe

Subscribe (RSS)