Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:14922 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86507 invoked by uid 1010); 14 Feb 2005 16:34:08 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 86458 invoked by uid 1007); 14 Feb 2005 16:34:07 -0000 Message-ID: <20050214163406.86457.qmail@lists.php.net> To: internals@lists.php.net Date: Mon, 14 Feb 2005 16:34:06 +0000 User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 References: <20050214091449.761.qmail@lists.php.net> <1108372801.42106d415a36a@webmail.jool.nl> In-Reply-To: <1108372801.42106d415a36a@webmail.jool.nl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 62.49.30.194 Subject: Re: [PHP-DEV] php suggestion From: nick.telford@ntlworld.com (Nicholas Telford) David Kingma | jool.nl wrote: > Quoting Ante Drnasin : > >>ex1: >>function AddToDb(mysql_scape_string($text)) { >> //enter $text to db >>} >>which would be the same as >>function AddToDb($text) { >> $text = mysql_escape_string($text); >> //enter $text to db >>} >> >>ex2: >> >>function removeDigitsFromText($text) { >> //return the text striped from digits >>} >> >>function AddTextToDB(removeDigitsFromText($text)) { >> //add text to db; >>} >> >>This could be very usefull although I do understand that it could cause >>problems (references for example) .... > > > Why could this be usefull? You're putting logic into the parameter list, I can't > think of a reason why you would like to do this. > > > > ---------------------------------------------------------------- > This message was sent using IMP, the Internet Messaging Program. This could never be useful. Trying to condense as much code as you can down to as few lines as possible doesn't actually speed up the execution, nor does it make it more readable. Having logic in the parameter list removes the possibility of properly documenting it and would be executed no quicker than having it done separately. If you're developing a public API as it seems you are, then the need for proper documentation far outweighs the need to condense all the code down, even for processes that are as obvious as escaping a string. In short, there's no good reason for this to exist in any language (as far as I can see) and would probably add more overhead to the processing of parameter lists. Nicholas Telford