Project

General

Profile

Actions

Bug #10280

closed

Regression while evaluating default argments of a method

Added by iffyuva (Yuva Kumar) about 10 years ago. Updated about 10 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.0preview1 (2014-09-17 trunk 47616) [x86_64-darwin13]
[ruby-core:65213]

Description

class DefArg
  def calc(str, val=val)
    p val
  end
 
  def val
    10
  end
end
 
# ruby-2.2.0-preview1 => nil
# ruby-2.1.3          => 10
DefArg.new.calc("hello")

im not sure what ruby spec says. but it looks like this program should print 10 in both the cases.


Related issues 2 (0 open2 closed)

Related to Ruby master - Bug #10314: Default argument lookup fails in Ruby 2.2 for circular shadowed variable namesClosednobu (Nobuyoshi Nakada)Actions
Is duplicate of Ruby master - Bug #9593: Keyword arguments default argument assignment behaviour not consistent with optional argumentClosedmatz (Yukihiro Matsumoto)03/05/2014Actions

Updated by nobu (Nobuyoshi Nakada) about 10 years ago

  • Is duplicate of Bug #9593: Keyword arguments default argument assignment behaviour not consistent with optional argument added

Updated by nobu (Nobuyoshi Nakada) about 10 years ago

  • Description updated (diff)
  • Status changed from Open to Rejected

Updated by hsbt (Hiroshi SHIBATA) about 10 years ago

  • Related to Bug #10314: Default argument lookup fails in Ruby 2.2 for circular shadowed variable names added
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0