Project

General

Profile

Actions

Feature #11660

open

a falsy value (similar to js undefined) that facilitates forwarding of default arguments

Added by bughit (bug hit) over 8 years ago. Updated over 4 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:71353]

Description

I'll call it "missing" here. Consider the following scenario:

def foo(default1 = some_expression)
end

def bar(default1 = some_expression)
  foo default1
end

def foobar(default1 = some_expression)
  bar default1
end 

if you had "missing":

def foo(default1 = some_expression)
end

def bar(default1 = missing)
  foo default1
end

def foobar(default1 = missing)
  bar default1
end 

missing passed as arg would be ignored (as if it wasn't passed at all)
and you wouldn't have to repeat the default value expression in every method

I believe that's how undefined works in js6 with respect to default args

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0