Hi, Adam I just get the feeling that this is exactly what we're currently discovered in some other threads in this mailing-list. We're now getting more and more closer to what we really want and a good way to write it the PHP-way.
Please try to get a rough overview over the last messages we wrote on the following threads: * [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting) * RE: [PHP-DEV] Scalar type hinting The second one is quite big ;) and sometimes the messages contain only religious stuff like "This will never be, go away" - but that's just because we're in discussion. Like the wind blows. But I think we'll get to list of rock-solid possible solutions here. I think we'll soon create a RFC for that and discuss it after we have it "on one paper". I would kind-of like the idea to add the *scalar *type in addition just to avoid objects or arrays in there, but let's look how the discussion goes. Bye Simon 2012/3/1 Adam Jon Richardson <adamj...@gmail.com> > First, phpunit is a fantastic tool! I'm thankful for your contributions to > all of the PHP community (especially with the code coverage capabilities.) > > I speak to your 2 points inline below: > > On Wed, Feb 29, 2012 at 9:36 PM, Sebastian Bergmann <sebast...@php.net > >wrote: > > > On 02/29/2012 09:01 PM, Adam Jon Richardson wrote: > > > >> However, the aliases would allow developers to better communicate > >> intentions AND provide more information for IDE's and static analyses > >> tools. > >> > > > > 1) You are trying to solve a social problem through technology. That > > usually does not work. > > > > I believe technology can provide effective tools for social problems, > although I won't go so far as to say that it usually does work. More > importantly, I believe programming is riddled with social problems: > > "Let us change our traditional attitude to the construction of programs. > Instead of imagining that our main task is to instruct a computer what to > do, let us concentrate rather on explaining to human beings what we want a > computer to do." > > D. Knuth > > 2) What you want to achieve is already possible through docblocks. > > > The greater part of the proposal rests on the general scalar hint. That > said, I still believe the aliases for the scalars hold value. Sure, the > communicative aspect of the aliases can be achieved through use of > docblocks. However, in cognitive psychology and human factors research, > proximity of relevant information plays a role in perception and > processing, and I would posit that code with the type intentions displayed > closer to the actual body of the function would hold benefits (this would > be very testable, though, and research could prove me wrong.) When > available, the scalar aliases could then be used to help auto-generate the > docblocks. > > I would appreciate the scalar hinting, along with the aliases I outlined > very much in my code. I believe that this form of hinting stays true to the > PHP principles outlined in Richard's PHP Philosophy thread (a great read), > and I believe it helps developers who want to better enforce (scalar > hinting) and communicate (scalar aliases) the intentions of their code. > > Thank you for the feedback, > > Adam >