Bug #5966

->{} doesn't work in BasicObject

Added by Kazuki Tsujimoto about 2 years ago. Updated about 2 years ago.

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

Description

=begin
$ ./ruby -ve 'BasicObject.new.instanceeval { ->{} }'
ruby 2.0.0dev (2012-02-03 trunk 34424) [x86
64-linux]
-e:1:in block in <main>': undefined methodlambda' 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

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

Associated revisions

Revision 34819
Added by Nobuyoshi Nakada about 2 years ago

  • compile.c (iseqcompileeach): call on special object instead of self. since stabby lambda is a syntax, so it should not be affected by the context. [Bug #5966]
  • insns.def (send): no special deal for FCALL. self should be put on TOS instead.

History

#1 Updated by Nobuyoshi Nakada about 2 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.

#2 Updated by Koichi Sasada about 2 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

#3 Updated by Nobuyoshi Nakada about 2 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 (iseqcompileeach): call on special object instead of self. since stabby lambda is a syntax, so it should not be affected by the context. [Bug #5966]
  • insns.def (send): no special deal for FCALL. self should be put on TOS instead.

Also available in: Atom PDF