Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:21514 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72546 invoked by uid 1010); 13 Jan 2006 12:52:50 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 72531 invoked from network); 13 Jan 2006 12:52:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Jan 2006 12:52:50 -0000 X-Host-Fingerprint: 195.225.34.5 fw01.axit.nl Received: from ([195.225.34.5:26219] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id E9/CD-25674-1A2A7C34 for ; Fri, 13 Jan 2006 07:52:50 -0500 Message-ID: To: internals@lists.php.net References: <43C67431.9090003@prohost.org><3A366ACB-20D4-42C7-BBAE-46F643E3A91F@intuitivefuture.com><878581203.20060112153625@ionzoft.com> <7.0.0.16.2.20060112154219.029d06c8@zend.com><43C75FEE.7040908@php.net> <6C.F4.25674.EFD67C34@pb1.pair.com> <43C786E5.1020400@mysql.com> <43C7975A.2070504@php.net> <43C79801.7070101@mysql.com> <43C79A23.6010701@php.net> <43C79DC8.6000207@php.net> <43C79EE0.909@php.net> Date: Fri, 13 Jan 2006 13:52:30 +0100 Lines: 60 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2670 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 X-Posted-By: 195.225.34.5 Subject: Re: [PHP-DEV] Re: Named arguments revisited From: r.korving@xit.nl ("Ron Korving") I think everybody should be open to a new way of dealing with functions. The advantages apply to many many functions. Take for example: mysqli mysqli_connect ( [string host [, string username [, string passwd [, string dbname [, int port [, string socket]]]]]] ) It would be nice to be able to do $conn = mysqli_connect(host: $host, port: $port); without having to worry about anything else than the parameters I care about. It's a new way of doing things, and that may be scary, but think how useful this can be for programmers. When you call a function, the order in which you present the function parameters is never interesting, except for a few rare cases like printf(). But unlike printf(), the functioning of a strpos() function doesn't require a certain order in parameters. It requires a needle and a haystack. In any situation, including function parameters, I consider requiring a certain order where it's not needed an overspecification. Just like this is an overspecification: for ($i=0; $i < count($array); $i++) echo $array[$i]; compared to: foreach ($array as $element) echo $element; because you simply don't need $i. Named parameters are, like foreach, a means to reduce overspecification. - Ron "Lukas Smith" schreef in bericht news:43C79EE0.909@php.net... > Hartmut Holzgraefe wrote: >> Lukas Smith wrote: >>> Its sole purpose is to deal with situations where you have a >>> considerable number of parameters. >> >> well, i for one would love to write something like >> >> $pos = strpos(haystack=$str, needle="foobar"); >> >> instead of looking up parameter orders all the time :) > > I would specifically not go there. This would create the inconsistant > situation you describe. It would be fixing one past mistake with a new > evil. > > As noted the cases are not as wide as most people make it sound, also its > not really related to this discussion. > > regards, > Lukas