Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68937 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94257 invoked from network); 7 Sep 2013 07:38:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Sep 2013 07:38:03 -0000 Authentication-Results: pb1.pair.com smtp.mail=simonsimcity@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=simonsimcity@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.172 as permitted sender) X-PHP-List-Original-Sender: simonsimcity@gmail.com X-Host-Fingerprint: 74.125.82.172 mail-we0-f172.google.com Received: from [74.125.82.172] ([74.125.82.172:53430] helo=mail-we0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 66/E3-00660-9D7DA225 for ; Sat, 07 Sep 2013 03:38:02 -0400 Received: by mail-we0-f172.google.com with SMTP id w61so2691703wes.3 for ; Sat, 07 Sep 2013 00:37:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=/yo1aa+DuuVy2W3ExOrET1yd46krbhJf7/N9n63Yy0o=; b=gpbeCkThZCwwB8239aA5lpWZM+ot6jMKreYnNewwojEm3rv86gf7rqzAgCwy0Y9CBm jXOZMnknglWahizbLlKAFaqPR1kWbMO+RSz4ox829rvfBitQLvBMSQIWN0PHFhAYFNlM 97KVv0xCgCLiN3QEDhWbjYN5mZ/TE+ktWmc0CW2hma7QUuRNQ0sLiZOFAn3twj+887AY LpgWPn2FteDjtCUVUOWlMxvOBqNUWGfXq0arF1Y0gph2cva99Yyec3J37FTdZ6i4OJSc LTUvUu2sXJW2IMrz4vGAvfMVa74UwUPNmeIMBptm8l/546onFDulZYs8s6aQoJLlMfiJ ETiQ== MIME-Version: 1.0 X-Received: by 10.180.91.16 with SMTP id ca16mr1224278wib.57.1378539478820; Sat, 07 Sep 2013 00:37:58 -0700 (PDT) Received: by 10.194.42.71 with HTTP; Sat, 7 Sep 2013 00:37:58 -0700 (PDT) In-Reply-To: References: <522A87EB.7080702@rotorised.com> Date: Sat, 7 Sep 2013 09:37:58 +0200 Message-ID: To: Matthew Leverton Cc: Ryan McCue , PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] Named parameters From: simonsimcity@gmail.com (Simon Schick) On Sat, Sep 7, 2013 at 5:29 AM, Matthew Leverton wrote: > > The big difference here is if I accept an options array, I understand > that the keys are important and would never break backward > compatibility by changing a parameter name. This isn't a case of "if > you don't like it, then don't use it" because every function I create > now has to respect the possibility of accepting named parameters, > whether I care about it or not. And I sure hope every function I call > is created by and maintained by somebody with those same > sensibilities. > > My opinion is that this really isn't as cool as it sounds, especially > since we have short array syntax. Again, I don't really care if it's > accepted into PHP, but I think it will be more of a minor nuisance for > me than anything else. > > -- > Matthew Leverton > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > Hi, all Would it be an option, to change the way named functions are declared? This way you would mark a function explicitly as having named parameters. This increases the learning-curve for PHP, but for me, it seems a valid approach ... An example that comes to my mind, is to call this a "named" function ... Feel free to add a better keyword. This would then look something like this: named function functionHavingNamedParamsEnabled($firstParam, $secondParam) {} function functionHavingNamedParamsDisabled($firstParam, $secondParam) {} functionHavingNamedParamsEnabled( "secondParam" => "secondValue", "firstParam" => "firstValue"); // Will work ... functionHavingNamedParamsDisabled( "secondParam" => "secondValue", "firstParam" => "firstValue"); // Will not work, because this function is not declared to support named params. Just an idea for a compromise .. What I don't like here would be if I'd have to add some cryptographic char instead of a keyword to the definition of the function. I, too, am quite neutral to this feature. Bye, Simon