From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-2.7 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 3FF401F454 for ; Mon, 4 Nov 2019 17:00:55 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 4B44A120940; Tue, 5 Nov 2019 02:00:46 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id 35C43120910 for ; Tue, 5 Nov 2019 02:00:44 +0900 (JST) Received: by filter0042p3iad2.sendgrid.net with SMTP id filter0042p3iad2-3342-5DC0593F-DD 2019-11-04 17:00:47.826498357 +0000 UTC m=+324236.599286548 Received: from herokuapp.com (unknown [3.88.230.70]) by ismtpd0062p1iad2.sendgrid.net (SG) with ESMTP id e29oaHZzSJG0S2octhwVBw for ; Mon, 04 Nov 2019 17:00:47.730 +0000 (UTC) Date: Mon, 04 Nov 2019 17:00:47 +0000 (UTC) From: bughitgithub@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 71263 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 11660 X-Redmine-Issue-Author: bughit X-Redmine-Sender: bughit X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?Lz0+3qGVJFpKTmjP+6UJd2KKTsj+AtuP2yOGs8HtvQJY=2FJUMh0YTyVF=2FZKY5mO?= =?us-ascii?Q?fc5ETyHuXy2g4NemzKvk1tx6couEsgVormJyhna?= =?us-ascii?Q?0L8NZpfabhwRoWv5KlHlYJAxug3849BA2FuTzdm?= =?us-ascii?Q?+TVYCknnLK+5M6+gNlt8KIUFM=2FVs=2Fw6QS0PQJ=2Ft?= =?us-ascii?Q?eCOWlDRLXf0TZAH6KhyZxFI3z=2FS5EvDbWOg=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 95671 Subject: [ruby-core:95671] [Ruby master Feature#11660] a falsy value (similar to js undefined) that facilitates forwarding of default arguments X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #11660 has been updated by bughit (bug hit). > The "penalty" I pay for this is one line of code The penalty the language pays is it has a demoware, checklist item, default value feature, where in any non-trivial scenario you have to produce the default value twice, first the intermediate default value through the default value expression, then the real default value in the body. You are not doing ruby any favors by defending this "design". ---------------------------------------- Feature #11660: a falsy value (similar to js undefined) that facilitates forwarding of default arguments https://bugs.ruby-lang.org/issues/11660#change-82459 * 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/