Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81853 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 38700 invoked from network); 5 Feb 2015 01:09:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Feb 2015 01:09:20 -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.218.49 as permitted sender) X-PHP-List-Original-Sender: narf@devilix.net X-Host-Fingerprint: 209.85.218.49 mail-oi0-f49.google.com Received: from [209.85.218.49] ([209.85.218.49:55912] helo=mail-oi0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C6/21-40930-7A2C2D45 for ; Wed, 04 Feb 2015 20:08:56 -0500 Received: by mail-oi0-f49.google.com with SMTP id a3so4190819oib.8 for ; Wed, 04 Feb 2015 17:08:52 -0800 (PST) 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; bh=0L25ObVQ/8fZyI3r6jvOfouWO2uKiBzof0xPLwP4UbI=; b=TIea2f2gpCwBee08orumqrLLI6C1eMJrvX33xvQ+tDwqdDIwiXeQtWS8h85vCDJ/DU /JXywmNGhIiXAi27HcgYFE1XN9glWJIUNIOKZi5vdLwGDDBWjX5ZRLX9Bo/NxUwDGMdh gWXvSx3z7kik71ahrz31xRPwnsYmYRFwhq8Jg= 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; bh=0L25ObVQ/8fZyI3r6jvOfouWO2uKiBzof0xPLwP4UbI=; b=iZliRFOVJaR4Rco2rK2m2AF4+L3sauLyV50EzkW55M9+b7ck6ZMqn9K1ZOIjB6NGlY NQyhKviSEAptPDGxxnBLVqlbvcCXzJEXdk0xgSD/yi4h0wpnm068Mc5sd85lC9YxUdpY prgcaED76aLFttnRGFxaaPg8UWBLxqakxVVQCGoXHUu/QHnrkgSYujD0J/4LkUh4JGjk 3YlfJ0j9Eeugg7nXKV7Imk2T0tG0ae8IIMaVKH1gVehDHVAWhk9UyKSy9SktKc5njrqt 8coNuINaVBBttQmS6DtXJGtZwKRkZhR+aj7qZkxvlzB8EfbGde1Hbn1y7LSRAnuB8sbC 2y8Q== X-Gm-Message-State: ALoCoQlW9WdVVcfhCPtldTmhpDCnwo1d9hmNd0kG8vUfhjYRUfkCjU3N36Z5VOUMzvp+eix5A+OE MIME-Version: 1.0 X-Received: by 10.60.149.232 with SMTP id ud8mr684626oeb.51.1423098532039; Wed, 04 Feb 2015 17:08:52 -0800 (PST) Received: by 10.202.214.205 with HTTP; Wed, 4 Feb 2015 17:08:51 -0800 (PST) In-Reply-To: <54D2C018.6050803@gmail.com> References: <00c101d04049$ca411ec0$5ec35c40$@tekwire.net> <54D1CA7C.8060204@php.net> <54D1E6EC.7060702@php.net> <54D2B3FA.6020900@gmail.com> <54D2C018.6050803@gmail.com> Date: Thu, 5 Feb 2015 03:08:51 +0200 Message-ID: To: Stanislav Malyshev Cc: Sebastian Bergmann , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] What do we need strict scalar type hints for? From: narf@devilix.net (Andrey Andreev) Hi, On Thu, Feb 5, 2015 at 2:58 AM, Stanislav Malyshev wrote: > Hi! > >> Adding another concept, not changing the existing ones. And really, >> it's just simplifying what is already present via is_() >> runtime checks, making our lives a little bit easier. > > There's a very big difference between allowing to check types (and then > do whatever you wish) and having functions throw fatal errors if types > do not match. > True, but obviously, us who want strict typehints want to be able to do this: function foo(int $bar) { /* ... */ } ... instead of something like this: function foo($bar) { if ( ! is_int($bar)) { trigger_error(sprintf('foo() expects argument 1 ($foo) to be int, %s given', gettype($bar)), E_USER_ERROR); exit(1); } /* ... */ } Hence, simplifying. :) Cheers, Andrey.