Re: [RFC] Scalar Type Hints v0.2
| From: | Matthew Leverton | Date: | Mon, 02 Feb 2015 16:45:36 +0000 |
| Subject: | Re: [RFC] Scalar Type Hints v0.2 | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-81605@lists.php.net to get a copy of this message | ||
On Sun, Feb 1, 2015 at 5:49 PM, Andrea Faulds <ajf@ajf.me> wrote:
> Good evening,
>
> The RFC has been updated to cover return types, since Levi’s Return Types RFC has passed. The
> patch is a work in progress: it works, but lacks tests for return types.
>
> Version 0.3 of the RFC can be found here:
> https://wiki.php.net/rfc/scalar_type_hints
>
After thinking and talking this over, I do think your RFC is the only
option that makes sense *if* you want to support both weak and strict.
However, I think the usage of declare() makes it dead in the water.
Fair or not, I have a hard time looking past that.
I'm opposed to other compromises because I think it will be a big mess
from the caller's perspective. (Some functions would be strict, some
would not ... eventually forcing everybody to just use strict types.)
And, as I've stated previously, I prefer strict types.
Does the implementation of strict-only work for testing right now? (If
so, what branch is it on, etc?) It's easy for everybody to theorize
about how this would work, but why not actually take the time to
"strictify" some part of a commonly used library and see how it
actually works in practice? But a library with type-hints + a script
to prepend "use strict" to every PHP file would make testing impact on
real-world usage easy for anybody.
--
Matthew Leverton