Hi Matthew, > On 2 Feb 2015, at 16:45, Matthew Leverton <lever...@gmail.com> wrote: > > On Sun, Feb 1, 2015 at 5:49 PM, Andrea Faulds <a...@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.
Ah, that’s unfortunate. I know declare() is ugly and a little unwieldy, but I can’t see another way to do it which doesn’t cause bigger problems. I am convinced that if this RFC passed, people would probably get used to declare(). IDEs and command-line tools do exist. > 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. That’s how I feel as well. > 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. The implementation does work for testing. I still need to write tests for return types but they seem to work. Parameter types are fully-working, though, and they have extensive tests, so I know they’re working fine and you could add them to an existing project. Strictifying an existing library is a good idea. I’ll try “strictifying” one of my bigger personal projects (PictoSwap, a 3DS browser application with a PHP backend) and see how it goes. I expect it’ll be fairly smooth, we’ll see. Thanks for your thoughts. -- Andrea Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php