Adam, Sure. Basically, if you alias the int hint to scalar:
function foo(int $i) { } The following are all valid values for $i: $i = 1; $i = 1.5; $i = "1.9" $i = "foo" $i = true $i = fopen($file); So, in the future, if we wanted to implement loss-less casting (casting if possible without loosing information, but erroring otherwise, so passing "foo" to (int $i) would generate an error. This will change the meaning of the int type hint, so production code using it will break. Therefore we wouldn't be able to add magic casting because of BC breaks... Whereas if you implemented just the scalar hint without the aliases, it wouldn't be a problem at all to add them, since there would be no BC break at all... Anthony On Thu, Mar 1, 2012 at 9:33 AM, Adam Jon Richardson <adamj...@gmail.com> wrote: > On Thu, Mar 1, 2012 at 8:55 AM, Anthony Ferrara <ircmax...@gmail.com> wrote: >> >> Please do not implement int, float, etc as an alias to scalar. That's >> going to cause nothing but trouble later on. It will instantly close >> the door to any type of casting magic (due to BC concerns), be >> completely non-obvious ("I hinted for int, why is it a boolean?"), and >> cause nothing but confusion. >> >> If you only want to add a scalar hint, I'm fine with that (for now), >> but please only add the scalar hint, no aliases... >> >> Anthony > > > Anthony, can you provide an example so I can better understand your > concerns? > > Thanks, > > Adam -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php