Bug #5966
->{} doesn't work in BasicObject
| Status: | Closed | Start date: | 02/04/2012 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 100% |
||
| Category: | core | |||
| Target version: | 2.0.0 | |||
| ruby -v: | ruby 2.0.0dev (2012-02-03 trunk 34424) [x86_64-linux] |
Description
$ ./ruby -ve 'BasicObject.new.instance_eval { ->{} }'
ruby 2.0.0dev (2012-02-03 trunk 34424) [x86_64-linux]
-e:1:in `block in <main>': undefined method `lambda' for #<BasicObject:0x007ffff847ef28> (NoMethodError)
from -e:1:in `instance_eval'
from -e:1:in `<main>'I'm not sure it is a bug or not, but I think lambda syntax should work everywhere.
Associated revisions
* compile.c (iseq_compile_each): call on special object instead of
self. since stabby lambda is a syntax, so it should not be
affected by the context. [ruby-core:42349][Bug #5966]
* insns.def (send): no special deal for FCALL. self should be put
on TOS instead.
History
Updated by nobu (Nobuyoshi Nakada) 3 months ago
- File 0001-Bug-5966-lambda-in-BasicObject.patch added
- Status changed from Open to Assigned
- Assignee set to ko1 (Koichi Sasada)
I'm not sure why FCALL is dealt specially in op_send.
It doesn't seem needed if self is put instead of nil.
Updated by ko1 (Koichi Sasada) 3 months ago
Hi,
(2012/02/11 6:56), Nobuyoshi Nakada wrote:
> File 0001-Bug-5966-lambda-in-BasicObject.patch added
> Status changed from Open to Assigned
> Assignee set to Koichi Sasada
Thank you. Please commit it.
> I'm not sure why FCALL is dealt specially in op_send.
> It doesn't seem needed if self is put instead of nil.
It is a historical reason. No reason now.
--
// SASADA Koichi at atdot dot net
Updated by nobu (Nobuyoshi Nakada) 3 months ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r34819.
Kazuki, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
----------
* compile.c (iseq_compile_each): call on special object instead of
self. since stabby lambda is a syntax, so it should not be
affected by the context. [ruby-core:42349][Bug #5966]
* insns.def (send): no special deal for FCALL. self should be put
on TOS instead.