Reply to Re: Breaking backwards compatibility - good or bad?

Your name:

Reply:


Posted by tony on 12/21/05 11:19

>> You are not improving the language, you are killing it.

> On the contrary. PHP could be a *lot* more strict in my opinion. I like
the type hinting in PHP 5, as it saves me a *huge* amount of work in
parameter checking.

Type hinting is good, but this is an *addition* to the laguage that has
no effect on existing code.

> If you following "design by contract", you either
accept a parameter as valid and do something with it or reject it. Most

legacy code I encounter just accepts anything and hopes it does not
explode. Yuck. I even don't like the automatic string-number
conversion.
If I pass a string to a numeric function, there's something
fundamentally wrong with my code.

Automatic string-number conversion is there for a very good reason -
all input received from the HTML form is delivered as a string
regardless of whether it's supposed to be a date, a number or whatever.
The *feature* means that the programmer does not have to waste time
performing manual type conversions before being able to process each
field.

> I don't want that covered up by the
language, I want to get a decent error message. *Off course* foreach
should give an error when something other than an array is passed!

If you give it a string or a number, yes. But insisting that a null
value cannot automatically be treated as an empty array is going over
the top.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация