Skip to content

different behavior of instance_eval #3029

@takahashim

Description

@takahashim

In CRuby, I can get the receiver through block argument, but in mruby, I can't.
Is it mruby's limitation?

$ cat tmp.rb
class Foo
  def initialize(&block)
    self.instance_eval(&block)
  end
end

Foo.new{ |arg| p arg }

$ ruby tmp.rb
#<Foo:0x007f97ca038798>
$ ./bin/mruby tmp.rb
nil

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions