Hello Aidan, I think named parameters would be a useful feature... I'll leave it at that.
Here is a coding idea for you, in case you hadn't considered it... function highlight($text=NULL, $needle=NULL, $strip_links=NULL, ...) { is_null($text) && $text = SOME DEFAULT VALUE; is_null($needle) && $text = SOME DEFAULT VALUE; is_null($strip_links) && $text = SOME DEFAULT VALUE; ... } In that way, the user doesn't have to remember the default values, just the offsets. Best wishes with the proposal. -- Best regards, Jason mailto:[EMAIL PROTECTED] Wednesday, January 11, 2006, 8:53:11 PM, you wrote: AL> Andrei Zmievski wrote: >> On Jan 9, 2006, at 4:09 AM, Aidan Lister wrote: >> >>> As useful functions tend to increase in complexity over time, often so >>> does the number of parameters. >>> >>> It soon gets to the point where function calls look like: >>> foo(true, false, false, false, false, true) >>> The rest of the parameters being required to be supplied, with their >>> default value, when the user is only interested in changing the last >>> option. >>> >> >> If you get to the point where your function has a dozen parameters, I >> would suggest re-thinking the purpose and design of such a function, >> because you are likely trying to make it do too much. >> >> -Andrei AL> In a simple highlighting function I wrote (which at 16k hits is probably AL> considered useful) I needed most of the following parameters: AL> $text AL> $needle AL> $strip_links AL> $case_sensitive AL> $whole_word_only AL> $simple_text_only AL> $highlight_pattern AL> $return_or_print AL> $use_xhtml AL> $tooltips_or_divs AL> I imagine any function dealing with html may use a significant portion AL> of these. Obviously some of these are for effect, but I think my point AL> is clear enough. AL> We've discussed other options at developers disposal like associative AL> arrays, setOpt and getOpt functions in a class, but again each have AL> their drawbacks and named parameters solve the problem elegantly. AL> Could we properly discuss the pros and cons of a name parameters AL> implementation - even if it's only to put the whole issue to bed once AL> and for all? AL> Best wishes, AL> Aidan -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php