From: info@ttanimichi.com
To: ruby-dev@ruby-lang.org
Subject: [ruby-dev:51088] [Ruby master Bug#18067] Composite procs with `instance_exec` aren't executed within the context of the receiver
Date: Sun, 08 Aug 2021 13:09:26 +0000 (UTC) [thread overview]
Message-ID: <redmine.issue-18067.20210808130917.12651@ruby-lang.org> (raw)
In-Reply-To: <redmine.issue-18067.20210808130917.12651@ruby-lang.org>
Issue #18067 has been reported by ttanimichi (Tsukuru Tanimichi).
----------------------------------------
Bug #18067: Composite procs with `instance_exec` aren't executed within the context of the receiver
https://bugs.ruby-lang.org/issues/18067
* Author: ttanimichi (Tsukuru Tanimichi)
* Status: Open
* Priority: Normal
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
```ruby
func1 = -> (x) { x + y }
class A
def y
10
end
end
A.new.instance_exec(1, &func1) # => 11
func2 = -> (x) { x * 2 }
f = func1 >> func2
A.new.instance_exec(1, &f) # => undefined local variable or method `y' for main:Object (NameError)
```
--
https://bugs.ruby-lang.org/
next parent reply other threads:[~2021-08-08 13:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-08 13:09 info [this message]
2021-08-09 17:57 ` [ruby-dev:51090] " merch-redmine
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=redmine.issue-18067.20210808130917.12651@ruby-lang.org \
--to=info@ttanimichi.com \
--cc=ruby-dev@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 NNTP newsgroup(s).