Re: Type hinting
| From: | Ferenc Kovacs | Date: | Thu, 03 Jun 2010 16:57:08 +0000 |
| Subject: | Re: Type hinting | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-48615@lists.php.net to get a copy of this message | ||
On Thu, Jun 3, 2010 at 6:32 PM, Lukas Kahwe Smith <mls@pooteeweet.org>wrote:
>
> On 03.06.2010, at 18:25, Josh Davis wrote:
>
> > On 1 June 2010 20:43, Stas Malyshev <smalyshev@sugarcrm.com> wrote:
> >
> >> It is very frequent that you want number and get "1" instead - almost
> >> all incoming data for PHP are strings.
> >
> > I'd like to point out that filter_input() does cast user input to the
> > right PHP type. And if memory serves, ext/filter is meant to be PHP's
> > standard way of handling user input. So in terms of incoming data, I'd
> > consider user input being covered already.
> >
> > The only other big source of data is the database. Unfortunately, it
> > seems that mysqlnd experiments in using MySQL's binary protocol for
> > all queries and not just prepared statements [1] didn't materialize.
> > But again, the same way filter was one of PHP 5.2's highlights,
> > mysqlnd is one of PHP 5.3's highlights and the recommended way to
> > communicate with MySQL, which means that if mysqlnd gained that
> > ability somewhere down the road then most of incoming data would be
> > correctly typed already. Emphasis on "would."
>
>
> Thats all fine and dandy if the ultimate goal is to turn PHP into a
> strictly typed language and of course if 90% of the API's you talk to
> require strict typing, then the question becomes why even use a dynamic
> language to begin with? Why not clean all of that "magic" out, get better
> memory management, less overhead in plenty of places, less chances for typos
> to result in hard to debug issues. Sure sounds good and I guess there
> probably is a market, maybe even an urgent need for a strictly typed
> scripting language for the web space.
>
> But really is PHP the best basis for this?
>
> regards,
> Lukas Kahwe Smith
> mls@pooteeweet.org
>
>
>
>
Sorry, I missed the point when Josh was suggesting to turn PHP into a
strictly typed language.
I think that you should have noted, that what suggestion/idea are you
against it.
Converting the variable type to the appropriate one?
Or the strict type hinting?
Tyrael
ps:
http://en.wikipedia.org/wiki/Straw_man
Straw man arguments often arise in public debates such as a (hypothetical)
prohibition <http://en.wikipedia.org/wiki/Prohibition>
debate:
Person A: *We should liberalise the laws on
beer<http://en.wikipedia.org/wiki/Beer>
.*Person B: *No, any society with unrestricted access to intoxicants loses
its work ethic and goes only for immediate gratification.*
The proposal was to relax laws on beer. Person B has exaggerated this to a
position harder to defend, i.e., "unrestricted access to
intoxicants".[1]<http://en.wikipedia.org/wiki/Straw_man#cite_note-book-0>