RE: [PHP-DEV] Make switch/case to type sensitive comparison in PH P 5?
| From: | Ford, Mike [LSS] | Date: | Wed, 26 Mar 2003 17:08:25 +0000 |
| Subject: | RE: [PHP-DEV] Make switch/case to type sensitive comparison in PH P 5? | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-307@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Rasmus Lerdorf [mailto:rasmus@lerdorf.com]
> Sent: 26 March 2003 16:42
> To: Ford, Mike [LSS]
> > > I'd really not love to see it :) Use an if-else chain of ===
> > > comparisons
> > > instead if that's what you really need.
> >
> > Oh, well, fair enough -- I can live with that, although I
> think it's a less
> > elegant way of programming it. Still, nothing ventured
> nothing gained...!
> > ;)
>
> Mike, changing this would break all sorts of stuff, and I
> think it would
> confuse a lot of people.
Huh??? What would it break? And I don't see how it would be confusing (in
fact, in my opinion it would be exactly the reverse).
Choosing between "case 0:" and (say) "case_identical 0:" would only be the
same as choosing between == and === in an if statement -- it would just give
the opportunity to do it using the elegant switch structure instead of the
clumsy if...elseif...else chain.
It just seems a shame not to have an === equivalent available within switch
structures -- but, hey, it was only a speculative suggestion, I'm perfectly
happy to bow to contrary opinion, and this is absolutely my last word on the
subject ... ;))
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211