Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71078 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67351 invoked from network); 12 Jan 2014 08:16:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Jan 2014 08:16:21 -0000 Authentication-Results: pb1.pair.com header.from=bof@bof.de; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=bof@bof.de; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain bof.de designates 80.242.145.70 as permitted sender) X-PHP-List-Original-Sender: bof@bof.de X-Host-Fingerprint: 80.242.145.70 mars.intermailgate.com Received: from [80.242.145.70] ([80.242.145.70:50568] helo=mars.intermailgate.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A1/64-36150-25F42D25 for ; Sun, 12 Jan 2014 03:16:20 -0500 Received: (qmail 8135 invoked by uid 1009); 12 Jan 2014 09:16:15 +0100 Received: from 209.85.216.171 by mars (envelope-from , uid 89) with qmail-scanner-1.25-st-qms (clamdscan: 0.96.2/18339. spamassassin: 3.3.1. perlscan: 1.25-st-qms. Clear:RC:1(209.85.216.171):. Processed in 0.162311 secs); 12 Jan 2014 08:16:15 -0000 X-Antivirus-MYDOMAIN-Mail-From: bof@bof.de via mars X-Antivirus-MYDOMAIN: 1.25-st-qms (Clear:RC:1(209.85.216.171):. Processed in 0.162311 secs Process 8124) Received: from mail-qc0-f171.google.com (gmail@bof.de@209.85.216.171) by mars.intermailgate.com with RC4-SHA encrypted SMTP; 12 Jan 2014 09:16:15 +0100 Received: by mail-qc0-f171.google.com with SMTP id n7so3867163qcx.16 for ; Sun, 12 Jan 2014 00:16:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=yNzn5DXQ6cj6DviwDOd6MBF7XKRggwUO3LNmh5+r9Tc=; b=mTFjX+BozjxbjH4DPKVQsYIvviVByANxW4WveXlYkPjBFVzPZVcdJ1kcyNpkh14piQ AWs/J/KWwfC5rREzNc2QBJL91UoqEBbkiMft8Ng268O4oFg14Iocxxn/O7D6VlV7YuSm 0ugYo23AdeR8w952RLMBq5teKfO+jQLlNfM4dt+sJOzLMyGj7PtAB/1bAmu4Trg3sBFs 66vzWL8b1jnTUJ+jn7cUgNtdZGcHXwVe0R4i2Xj1cEKBGDE2vnC1N5P4x3QgNlJ87kZi V06XdV2Q1EdBz4mTnif+GznWd9F0EM/1fgh8cnEMJfMFQ+WRHSsCCAxokAcQ80SDomMd QBDA== MIME-Version: 1.0 X-Received: by 10.49.127.101 with SMTP id nf5mr26899420qeb.61.1389514573892; Sun, 12 Jan 2014 00:16:13 -0800 (PST) Received: by 10.140.84.175 with HTTP; Sun, 12 Jan 2014 00:16:13 -0800 (PST) Received: by 10.140.84.175 with HTTP; Sun, 12 Jan 2014 00:16:13 -0800 (PST) In-Reply-To: <581A185E-0F00-4B49-AA87-859D75E63BA2@googlemail.com> References: <581A185E-0F00-4B49-AA87-859D75E63BA2@googlemail.com> Date: Sun, 12 Jan 2014 09:16:13 +0100 Message-ID: To: nikic@php.net Cc: internals Content-Type: multipart/alternative; boundary=047d7b6dc0bc966dae04efc19259 Subject: Re: [PHP-DEV] Revisiting the "Named Arguments" RFC From: bof@bof.de (Patrick Schaaf) --047d7b6dc0bc966dae04efc19259 Content-Type: text/plain; charset=ISO-8859-1 First of all, I'd love seeing this feature in PHP, and it would be a very large incentive to upgrade to 5.6 asap when it would be included (without bugs of course :) I'd like to offer my thoughts on the open questions in the RFC: Regarding Syntax at the call site, I feel that it is exactly right the way it is proposed / implemented now. That way mirrors most closely the syntax of static array definition, while saving some typing (omitting of double quotes) where key names do not clash with keywords. In fact, once established, I would love static array initialization to also permit nonclashing keys to omit the doublequotes :) One question, given that syntax: would $foo = 'bar'; test($foo => 123); pass a named parameter named 'bar' ? That would be my visual expectation, and is what feels wrong about the alternate proposals. Regarding the separation of positional and named stuff when packing/unpacking (the python *kw vs. **kw distinction) I feel that would be unnatural. There is no syntactic precedent in PHP regarding notation, and I think where desired, explicit code using array functions should always easily be able to make the split in an obvious fashion. Regarding signature violation, and clearly just as a personal opinion, I don't see LSP as a law of languages, but just as a good coding practise. Thus, I would be happy to just have the same runtime checks in place for ordinary functions, against the actual method called, with exactly the same error behaviour as for ordinary function calls, instead of an additional set of errors and/or warning coming from structural checking of child and parent methods. I think that's what the RFC / current implementation does, but the RFC seems unclear in that regard. Finally, regarding internal functions and their arginfo and the naming of parameters there... in my imagination, that is the think that would still need the most work, and would tend to bikeshedding regading the parameter names set in stone in the process... Which leads me to the question whether that work wouldn't be best postponed: - create variations of the arginfo declarations that explicitly say, on a function-by-function basis, whether named parameters should be supported - forbid use of named parameters with any function not yet modified and reviewed in that fashion Personally, being able to use named parameters in our own userland functions and classes, is much more important than use against internal functions, and postponing the feature altogether due to the internal functions not being fit to accept named parameters, would be sad. best regards Patrick --047d7b6dc0bc966dae04efc19259--