Re: Why no type hints for built-in types?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Terje Slettebø wrote:
> > I don't find this answer satisfactory. Yes, PHP has loose/weak typing,
but
> > at any one time, a value or a variable has a distinct type. In the
example
> > in the quote above, you'd have to ensure that the value you pass is of
the
> > right type.
>
> Well, like it or not, that is the way it is.  PHP is first and foremost
> a web scripting language.  Browsers don't send a type along with each
> bit of information they send.  Everything comes across as a string and
> as such all the internal PHP functions do the right thing when you pass
> a string to a function that really takes a number.  We have no plans to
> break this and create an inconsistent set of functions that no longer do
> this.

Thanks for your reply. I can understand the reasoning for that. However,
what the request was about was _optional_ explicit typing; the standard
library didn't have to use it at all, but it would be available to users.
Many places in a web application pass values between functions, where the
type is well-known (i.e. not directly from a browser).

Nevertheless, I assume the official answer is the same, and I understand it,
if this is not a reasonably commonly requested feature.

Regards,

Terje

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux