Re: [RFC] skipping optional parameters

From: Date: Wed, 18 Apr 2012 09:48:42 +0000
Subject: Re: [RFC] skipping optional parameters
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-60176@lists.php.net to get a copy of this message
Adam Jon Richardson wrote:
I disagree with the suggestion that the "real" solution is to refactor functions. Is a function with 3 parameters too long? function foo($val1, $val2 = true, $val3 = false) { /* code */} If I want to pass in a value to the third argument but keep the default value for the second argument, I have to look up what the default is and then paste/type it in as the second argument.
OK we are back in the debate on what needs to be IN the runtime handling ... Eclipse gives be a pop-up with the parameter set so I know what is expected. I don't even need to go and 'lookup' anything. Where the parameter chain is more than a couple of entries, then use a parameter hash. Always a lot easier anyway when handling SQL type activities as one can add stuff later and the order is irrelevant anyway. When one uses the right support tools is this really something to be wasting even more time on? -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php

« previous php.internals (#60176) next »