Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80481 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33792 invoked from network); 14 Jan 2015 19:33:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jan 2015 19:33:48 -0000 Authentication-Results: pb1.pair.com header.from=marcio.web2@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=marcio.web2@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.177 as permitted sender) X-PHP-List-Original-Sender: marcio.web2@gmail.com X-Host-Fingerprint: 209.85.217.177 mail-lb0-f177.google.com Received: from [209.85.217.177] ([209.85.217.177:57939] helo=mail-lb0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6F/A8-19120-A94C6B45 for ; Wed, 14 Jan 2015 14:33:46 -0500 Received: by mail-lb0-f177.google.com with SMTP id b6so9680406lbj.8 for ; Wed, 14 Jan 2015 11:33:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=hIY+lo+rQEzc4r2FGkK7SyRSi8vJJxJCMmuozUe0y54=; b=sezu3n3CdhEFODoVLF/KWrbKXRSoCppbrfyXkWbGBsyQd/4iUeq4Cr/JZ4ANd2tYEE H8SJGFQ/1LAy3H0X7fhjaJhuqCtm4dc3uNKSphWwdn0TYrpxP4rI37OeHD3NV4f5a6N+ BBX064Zh2blHKuCX9OwD1hNatd9iNTpaos04g4vEsmnpBNSK/aRmoxYHRiLNajYsmUrl 3drOEzImStYLxHf5GcWr9vbMj99Y9tSBKYeYOx5rRxehmH4nGqbXLu0ItnfOR8wCF2Dx XZf3BsZUp2x+oefKQnMltOiiK+hgdlCaRO9hb12i5yJRrSCBNbz7STB2VDFYZ42LywZS rYKw== X-Received: by 10.153.7.100 with SMTP id db4mr5718297lad.79.1421264023239; Wed, 14 Jan 2015 11:33:43 -0800 (PST) MIME-Version: 1.0 Received: by 10.152.21.101 with HTTP; Wed, 14 Jan 2015 11:33:22 -0800 (PST) Reply-To: marcio3w@gmail.com In-Reply-To: <54B6C047.3070301@mabe.berlin> References: <52243BA6.5040905@sugarcrm.com> <54B6C047.3070301@mabe.berlin> Date: Wed, 14 Jan 2015 16:33:22 -0300 Message-ID: To: Marc Bennewitz Cc: PHP internals Content-Type: multipart/alternative; boundary=001a1134730e3cc10f050ca1d12d Subject: Re: [PHP-DEV] [RFC] Skipping parameters take 2 From: marcio.web2@gmail.com (Marcio Almada) --001a1134730e3cc10f050ca1d12d Content-Type: text/plain; charset=UTF-8 Marc Bennewitz, Stas, > But I think adding "default" as new keyword is a big BC break! > I personally also don't like it and asked myself why can't the parameter simply skipped? Default is already a reserved word AFAIK. But I've been thinking about alternatives to parameter skipping syntax which brought me the Golang blank identifier _ to mind: create_query("deleted=0", "name", _, _, true); Still not sure if it's better than `default`, though. 2015-01-14 16:15 GMT-03:00 Marc Bennewitz : > Hi Stas, > > I really like this RFC. It makes it simple to use defined defaults without > the need to know about them of to updated. > > But I think adding "default" as new keyword is a big BC break! > I personally also don't like it and asked myself why can't the parameter > simply skipped? > > function foo ($a='a', $b='b') {} > > foo(); > foo($a); > foo(, $b); > foo($a,); > foo(,); > > Is it possible to use the default parameter on inheritance? > > class Bar { > function foo($a='a', $b='b') {} > } > > class Baz extends Bar { > function foo($a=default, $b=default) { > // do something > parent::foo($a, $b); > } > } > > > Marc > > > Am 02.09.2013 um 09:17 schrieb Stas Malyshev: > >> Hi! >> >> I've finally took some time to revive the skipping parameter RFC and >> patch. For those who doesn't remember what it is please see: >> https://wiki.php.net/rfc/skipparams >> TLDR version: >> >> The idea is to allow skipping parameters in function with optional >> arguments so that this: >> function create_query($where, $order_by, $join_type='INNER', $execute >> = false, $report_errors = true) >> >> can be called like this: >> create_query("deleted=0", "name", default, default, >> /*report_errors*/ true); >> >> Instead of trying to remember what the defaults are. >> The patch is here: >> >> https://github.com/php/php-src/pull/426 >> >> Any comments or feedback on the RFCs and the code are welcome, >> especially pointing out the cases where it may not work (which means we >> need more phpt's there :) >> > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a1134730e3cc10f050ca1d12d--