Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: wmorgan-sup@masanjin.net (William Morgan)
Subject: [sup-talk] [PATCH] don't try to open the next thread if there isn't one available
Date: Sat, 02 Feb 2008 20:35:33 -0800	[thread overview]
Message-ID: <1202013064-sup-8151@south> (raw)
In-Reply-To: <1201732604-sup-4815@archie>

Reformatted excerpts from its.jeff.balogh's message of 2008-01-30:
> The :next case guards against this exception with 'if block_given? &&
> yield'.  If I put that in the :kill case, those two lines will be
> exact duplicates of the lines above.
> 
> Is there a clean way to handle this?  I'm learning Ruby as I go along,
> so please forgive me if the answer is obvious.

To answer your question, depends what you mean by clean. We can capture
the shared lines in a closure with lambda { ... }, or we can move them
to a function and call the function, but that's basically the extent of
the control flow power we have here. (Well, unless we want to start
using continuations!)

In the latest version of the code, the shared lines are now exactly the
same, and are simply duplicated. Maybe once a :prev branch is added a
refactor will be necessary.

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


  reply	other threads:[~2008-02-03  4:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-30  8:21 Jeff Balogh
2008-01-30 15:43 ` John Bent
2008-02-05 17:27   ` William Morgan
2008-02-06 16:21     ` John Bent
2008-01-30 23:05 ` Jeff Balogh
2008-02-03  4:35   ` William Morgan [this message]
2008-02-03  4:31 ` 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=1202013064-sup-8151@south \
    --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