Project

General

Profile

Actions

Bug #5966

closed

->{} doesn't work in BasicObject

Added by ktsj (Kazuki Tsujimoto) almost 13 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 2.0.0dev (2012-02-03 trunk 34424) [x86_64-linux]
Backport:
[ruby-core:42349]

Description

=begin
$ ./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 '

I'm not sure it is a bug or not, but I think lambda syntax should work everywhere.
=end


Files

0001-Bug-5966-lambda-in-BasicObject.patch (2.42 KB) 0001-Bug-5966-lambda-in-BasicObject.patch nobu (Nobuyoshi Nakada), 02/11/2012 06:56 AM

Updated by nobu (Nobuyoshi Nakada) almost 13 years ago

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) almost 13 years 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

Actions #3

Updated by nobu (Nobuyoshi Nakada) almost 13 years 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.
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0