Really, it's not the most accurate test, to make it more accurate you
would only check parameter variables but I wanted something fast.
These are the calls to the is_* family from a major library. All calls
are within a Class { }. I think this shows several things, a couple I
would like to mention is that is_string is probably just to verify the
argument type in the method calls (as I browsed the sources that is
what it's use was), null being similar, but that use cannot be
alleviated really. The is_array calls are surprising considering that
we have array type hinting, as I browsed through it was used for a lot
more then argument parsing. The non-surprising one for me was the 4
calls to is_scalar.

This library would probably have ~300(String) + ~110(Int)
~40(Resource) ~30(Bool) ~10(Float) = 500 less function calls, and much
cleaner code if there was type hinting.

is_array: 508
is_string: 316
is_null: 121
is_numeric: 102
is_int: 81
is_resource: 44
is_bool: 36
is_object: 34
is_integer: 24
is_float: 14
is_callable: 6
is_scalar: 4

I understand a lot of the "Karma" having people not liking the idea,
but there is more then one feature in PHP I am sure people don't agree
with. Bottom line all stubbornness should be put aside and look to see
if it would improve the language use and appeal to a large user base,
at the same time without causing pain to people who don't wish to use
the extra functionality.

Just my opinion.

-Chris

On Feb 6, 2008 7:31 AM, Pierre Joye <[EMAIL PROTECTED]> wrote:
> HI Sam,
>
> On Feb 6, 2008 2:33 PM, Sam Barrow <[EMAIL PROTECTED]> wrote:
> > On Wed, 2008-02-06 at 14:20 +0100, Derick Rethans wrote:
> > > On Wed, 6 Feb 2008, Sam Barrow wrote:
> > >
> > > > On Wed, 2008-02-06 at 09:31 +0100, Derick Rethans wrote:
> > > > >
> > > > > I still we should add simple static typehints (ie. just the types that
> > > > > we use in the manual) - and they should behave in the same way as the
> > > > > other type hints that we laready have.
> > > >
> > > > True, but we have to consider the fact that we don't have enough support
> > > > on that side.
> > >
> > > This is not some election campaign were you change what you believe in
> > > just to go get followers. So no, I will not take that into
> > > consideration.
> > >
> > > Derick
> >
> > When did I change my opinion. I'm putting forth a compromise that may be
> > able to make both sides happy. If we can all agree to a scalar type hint
> > I don't see anything wrong with that.
>
> A scalar type brings none of the advantages of a full set of type
> hints. I see zero gain to scalar in comparison to what we have now.
> I'm still in favor of having all types available.
>
> Cheers,
>
> ps: nobody wants you to "shut up", it is an open list.
> --
> Pierre
> http://blog.thepimp.net | http://www.libgd.org
>
> --
>
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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

Reply via email to