You know, given how worried you seem to be about this issue, could you
booby trap your so that if the developers use the wrong type (int vs.
string) the program throws fatal errors with nasty error messages that
explain how much trouble the developer is in at the userland code level?

While I like the of protecting idiot developers from themselves, I'm still
not sure that this isn't a half solutions that just hide the pieces of the
problem that it doesn't solve.

I don't think we can solve the problem of developers not writing code
correctly or QA would mostly be out of job (instead of being a growth
segment).

How about a full type system that would make Java programmer scream? I'm
sure with a bit of thought we can make one heavier than Java.


Walter

On Mon, May 11, 2015 at 5:56 PM, Yasuo Ohgaki <yohg...@ohgaki.net> wrote:

> Hi all,
>
> Firstly, I don't intend this for PHP 7.0 strictly.
>
> PHP is made for Web. It means PHP is made for interacting other
> systems/data. Currently, we only have "int" and "float" strictly bounded
> to native "unsigned int" and "IEEE 754 double". This causes problems
> for interacting other systems/data.
>
> Conversion to native data type causes problem like RFC 7159 "6 Numbers"
> points out.
> https://tools.ietf.org/html/rfc7159
> PHP's "int" is more limited because safe value is least common and it's
> signed 32 bit integer.
>
>
> To resolve this issue, how about to have
>
>  - is_digits() and digits type for digits only inputs(integer like string)
>  - is_numeric() and numeric type for float like string
>
> These check if variable contains only digits or float like string.
> It's pseudo type, but it prevents developers to specify "int"/"float" type
> wrongly.
> These may be extended to allow GMP int/float.
>
> Having these make sense for a language made for interaction and make basic
> type hint use intuitive. IMO.
>
> I wouldn't like to write too long mail. My thoughts and concerns are in my
> blog
> mostly.
>
>
> http://blog.ohgaki.net/php7-is-going-to-be-strictly-typed-language-will-this-work
> http://blog.ohgaki.net/dont-use-php7-type-hint-for-external-data
>
> Any comments?
>
> Regards,
>
> --
> Yasuo Ohgaki
> yohg...@ohgaki.net
>



-- 
The greatest dangers to liberty lurk in insidious encroachment by men of
zeal, well-meaning but without understanding.   -- Justice Louis D. Brandeis

Reply via email to