On Sun, Sep 14, 2014 at 7:17 PM, Andrea Faulds <a...@ajf.me> wrote:
>
> On 14 Sep 2014, at 17:09, Andrey Andreev <n...@devilix.net> wrote:
>
>> I'm aware of that, hence why I said 'php-internals' to refer to the
>> mailing list. Again, userland devs don't care about that - PHP is
>> their language and they only care how we/they interact with it, not
>> what happens under the hood.
>
> Yes. Internal functions are used by userland developers. Userland developers 
> *do* care about internal functions. If we get rid of explode() or 
> json_decode() tomorrow, userland developers *will* complain.
>
> Perhaps I should explain what an “internal function” is in PHP parlance. An 
> internal function is one which is exposed to userland, but is implemented in 
> C via an extension, rather than in PHP. Examples include literally every 
> function in PHP’s documentation.

So why are we talking about "internal functions" at all? And what does
that have to do with type hints?

We know that explode() accepts strings, integers, floats ... we know
that's called type juggling. Strict type hints or type cast hints
wouldn't affect that. All we want is to be able to do the following:

    function foo(int $bar) {} // don't accept anything that's not an integer
    function foo((int) $bar) {} // cast $bar to an integer (if
possible, of course)

(you can ignore the syntax for that example)

That is what we want to be able to write in in a PHP application,
deffinately NOT what should be done to what I call "native" PHP
functions or "internal" PHP functions to you. We just assume those
functions don't have any kind of type hints and nobody has a problem
with that.

Cheers,
Andrey.

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

Reply via email to