Issue #11660 has been updated by bughit (bug hit).


>  Ruby having a single nil, instead of JavaScript's null and undefined, is a net benefit, in my opinion.

undefined signals the absence of a value and makes possible composable default value design, where missing arguments can be forwarded and still trigger default value computation, which is a clear win for javascript.

> The popularity of an idea is not always a proxy to its merit, but if nobody else thinks the benefits of a proposal exceed the costs, maybe it isn't worth implementing.

Ok got it. Popularity does not always equal merit, but often it does and this must be one of those times, because of course it has no merit and it's unpopular. Ergo ipso facto, it has no merit.

----------------------------------------
Feature #11660: a falsy value (similar to js undefined) that facilitates forwarding of default arguments
https://bugs.ruby-lang.org/issues/11660#change-82467

* Author: bughit (bug hit)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
I'll call it "missing" here.  Consider the following scenario:

```ruby
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":

```ruby
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 




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>