Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77187 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27117 invoked from network); 14 Sep 2014 16:41:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Sep 2014 16:41:21 -0000 Authentication-Results: pb1.pair.com header.from=narf@devilix.net; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=narf@devilix.net; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain devilix.net designates 209.85.214.180 as permitted sender) X-PHP-List-Original-Sender: narf@devilix.net X-Host-Fingerprint: 209.85.214.180 mail-ob0-f180.google.com Received: from [209.85.214.180] ([209.85.214.180:61592] helo=mail-ob0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E9/0B-53483-035C5145 for ; Sun, 14 Sep 2014 12:41:20 -0400 Received: by mail-ob0-f180.google.com with SMTP id wp4so1836110obc.39 for ; Sun, 14 Sep 2014 09:41:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=devilix.net; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=hmTFnma2FmP2Wk72EKf35AHvX64LlDSAq/as2MZzy1c=; b=gfQprnOKCIri9TwOxOudt8G/2rKdkm28aIXGV8T/J/Hu9KqX8sUb0JXU82WhIl8+zo p5Ob7fyYDgjgILUbeCLyVdnVY5aD6toAXpV5dI644/Uf8iSXYNLcDew2TGnsYPHwPRTX dZjG+zXIsMWLkZwJ7wqGIc6YZEyPz9IAHgALU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=hmTFnma2FmP2Wk72EKf35AHvX64LlDSAq/as2MZzy1c=; b=ZKQIBNiInxuDc4RqaAHzr8A1zmg+Wc37TByqn+e7TjgOj0/TkFmYzyBUbsY6zfnUA9 EVVO036tHIHYVnXhKmc3QLfXJkwHlFgIIknQdggR+K94JGZy9FpFQfhfz83/GIYwaM/S AbNyod359BUP9OJaknJz7WAcynYe37F0t3QznxgAePkc2pa+WmHVPhXZHLqiJFaF34bY FwdqxRuTNoxazS8RkQgHPfWg7Tilns7TnwCXbGYu8MENWBMwrcbXc1Hyeo90eiKvVe3K KmTUky98IZHVa/6hr3GvKNN/FhhQTTYZs5FoAPSF8/8jwFt4JRbE6VKEprXz32hROSOz Tyzw== X-Gm-Message-State: ALoCoQl3/PoDa/H8jXf5MRlQI4XBoe/993C6msFZM44cRvrlYxQtaO4+VryF7Av26Hikg0eBg83I MIME-Version: 1.0 X-Received: by 10.60.134.76 with SMTP id pi12mr21772239oeb.51.1410712878048; Sun, 14 Sep 2014 09:41:18 -0700 (PDT) Received: by 10.202.75.205 with HTTP; Sun, 14 Sep 2014 09:41:17 -0700 (PDT) In-Reply-To: References: <6893A97A-EC4C-4124-B804-96E2A26B953F@ajf.me> <20140914000718.GB14312@phcomp.co.uk> <3177B936-50C1-4E5D-8687-FD235C72B411@ajf.me> <54153692.7050500@sugarcrm.com> <9CE963B0-E624-4267-BC2A-0F8D1F985DAE@ajf.me> <6f2236e18c61d30b247e1c6bb2de10f1@mail.gmail.com> <8556C1E7-EDF3-47E2-9DA0-C9AB63DE56E6@ajf.me> <6E402FE8-119A-4BBB-B652-97A0DBEC8BC9@ajf.me> Date: Sun, 14 Sep 2014 19:41:17 +0300 Message-ID: To: Andrea Faulds Cc: Zeev Suraski , Stas Malyshev , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [VOTE][RFC] Scalar Type Hinting with Cast From: narf@devilix.net (Andrey Andreev) On Sun, Sep 14, 2014 at 7:17 PM, Andrea Faulds wrote: > > On 14 Sep 2014, at 17:09, Andrey Andreev 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 develop= ers *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 =E2=80=9Cinternal function=E2=80=9D is i= n PHP parlance. An internal function is one which is exposed to userland, b= ut is implemented in C via an extension, rather than in PHP. Examples inclu= de literally every function in PHP=E2=80=99s 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 intege= r 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.