Hi!

Yeah, hmm, no, and it is disingenuous of you to equate type hints to
PHP becoming statically typed. I'm sure that some people would love to

See? That's exactly why I am so opposed to calling it "type hints". Because if you called it proper name - strict typing, you'd say "it is disingenuous of you to equate strict typing to PHP becoming statically typed" and it'd make you think that maybe it doesn't sound good.

have optional static typing in parts of their code, but I like being
able to use my vars freely when I need to. Being able to enforce what

That only leads to very bad coding practices. If you have strictly typed parameter "int $foo", any data path that leads to $foo should be verified to always produce "int" - otherwise your code blows up at runtime (no compile-time checks, remember?). That can be achieved in one of two ways:
1. Having convert/check before each call to the function
2. Having variables and parameters to upstream functions typed

1 is insanely-ugly code, 2 is static typing. You choose.

PHP being dynamically typed shouldn't be an argument to prevent people
from enforcing method signatures. You're saying that PHP users should
have no control over what variable types are passed to their
functions.

No, I'm not saying that. I'm saying, see above, that there are consequences to strictly typed parameters. You can, of course, choose third way and have half-assed implementation, but that would prove to work badly very quickly. As soon as you discover it, you'd ask for typed variables and typed returns and typed properties, etc. etc. Enter static typing. The fact that you won't use it for every variable doesn't matter.

More seriously, one of PHP's most popular quality is that it is
flexible. When I started using PHP, I would never initialize variables

Flexible doesn't mean "changes at my every whim without regard for consequences". This change is bad. It should be rolled back.

back then no one told me "oh you want warnings on initialized
variables? You should use C++ then! Haha!" PHP was flexible enough to

Unitialized vars notice is one of the great mistakes in PHP. The amount of ugly boilerplate code that it brings along is mind-boggling. You can't just say if($_REQUEST['blah'] == 'blah') do_stuff(); - you have to put isset() there or you get a very costly, annoying and completely useless error message. It was a mistake to create it. But that's another discussion, not for now.

to their functions what they want. And you're against that on...
ideological grounds?

I'm against it on sanity and logic grounds. I explained the reasons (for the Nth time) above. If you still can't comprehend that there's logic behind what I am saying and call it "ideology" - well, I guess there's a limit of what one can explain.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to