ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: Cody Brocious <cody.brocious@gmail.com>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:25573] Re: Implicit block argument in Procs
Date: Mon, 14 Sep 2009 19:13:08 +0900	[thread overview]
Message-ID: <4987c3660909140313i5ebaaa43tc8b57ae3316fd4a@mail.gmail.com> (raw)
In-Reply-To: <4aae15dd.1608c00a.592f.099c@mx.google.com>

Thanks for the quick response.  If the block to 'set' is executed in
the top level context, though, why is it that an explicit block
argument works?  It seems that unless you're passing blocks into Procs
that assume no implicit block argument exists, this wouldn't change
the usual behavior.

On Mon, Sep 14, 2009 at 6:07 AM, Nobuyoshi Nakada <nobu@ruby-lang.org> wrote:
> Hi,
>
> At Mon, 14 Sep 2009 18:57:14 +0900,
> Cody Brocious wrote in [ruby-core:25571]:
>> Is this behavior intentional?  If not, is there a limitation in
>> rb_vm_invoke_proc() which makes passing an implicit block a problem?
>> It seems that killing the arg_block check would solve the issue if
>> there's no problem in rb_vm_invoke_proc().
>
> Absolutely intentional.  `yield' calls the block given to the
> context.  In your example, the yield in the block to `set' is
> executed in the top level context, which has no block.
>
> --
> Nobu Nakada
>
>

  reply	other threads:[~2009-09-14 10:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-14  9:57 [ruby-core:25571] Implicit block argument in Procs Cody Brocious
2009-09-14 10:07 ` [ruby-core:25572] " Nobuyoshi Nakada
2009-09-14 10:13   ` Cody Brocious [this message]
2009-09-15 12:28     ` [ruby-core:25601] " Nobuyoshi Nakada

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-list from there: mbox

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

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

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

  git send-email \
    --in-reply-to=4987c3660909140313i5ebaaa43tc8b57ae3316fd4a@mail.gmail.com \
    --to=ruby-core@ruby-lang.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).