Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: wmorgan-sup@masanjin.net (William Morgan)
Subject: [sup-talk] [PATCH] before-search hook
Date: Mon, 15 Jun 2009 10:44:25 -0700	[thread overview]
Message-ID: <1245087294-sup-6276@entry> (raw)
In-Reply-To: <1244612627-sup-982@javelin>

Hi Edward,

Thanks for the patch. I'm interested in integrating it into Sup
mainline. A couple comments:

1. Can you rename it to custom-search? I think that's a better
   description.

2. I would rather have the hook return a value. So this:
> -    subs = s.gsub(/\b(to|from):(\S+)\b/) do
> +    subs = String.new s
> +    HookManager.run("before-search", :subs => subs)
  I would rather see as:
    subs = HookManager.run("before-search", :subs => s) || s

3. It's not really an issue of mutation vs no mutation. The problem is
   that the parameter names in hooks are method calls, not variables. So
   while "subs = subs.gsub(...)" causes a 'subs' local variable to be
   created and initialized to nil, both "x = subs.gsub(...)" and "subs =
   self.subs.gsub(...)" work fine.

   This is probably less of an issue when the hook is returning a
   values, but if you could change the comments to be a warning about
   shadowing method calls instead that would be better.

Thanks!
-- 
William <wmorgan-sup at masanjin.net>


  parent reply	other threads:[~2009-06-15 17:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-10  5:44 Edward Z. Yang
2009-06-10 21:51 ` Edward Z. Yang
2009-06-15 17:44 ` William Morgan [this message]
2009-06-26 17:10   ` Edward Z. Yang
2009-07-27 17:40     ` Edward Z. Yang
2009-07-27 19:40       ` William Morgan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1245087294-sup-6276@entry \
    --to=wmorgan-sup@masanjin.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox