Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81889 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23205 invoked from network); 5 Feb 2015 09:51:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Feb 2015 09:51:49 -0000 Authentication-Results: pb1.pair.com header.from=pajousek@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pajousek@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.53 as permitted sender) X-PHP-List-Original-Sender: pajousek@gmail.com X-Host-Fingerprint: 74.125.82.53 mail-wg0-f53.google.com Received: from [74.125.82.53] ([74.125.82.53:47116] helo=mail-wg0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 92/0D-51979-53D33D45 for ; Thu, 05 Feb 2015 04:51:49 -0500 Received: by mail-wg0-f53.google.com with SMTP id a1so6514803wgh.12 for ; Thu, 05 Feb 2015 01:51:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=TpDdc4D0q41m6OQnD/teD1rJaDq5XkhYdKrUMKVCSMg=; b=wGWS3pDf01sei56UfU9w9jiR61Kj80f4xuZAmscmRgh7KNA282Zkd8l1vHdlWvKuEg kg9VrxMW8Pb9s4ax9B4WOyp+0MXlSbYA1JyPsAFOnBsOnC6mE7scwnAhR8r9Gad21x+X g+DtJ/FBTlMwo1N09OEM1UwulhhgPp1ICiZMRMjEpAbc3g9GzdNBpB2/7Cdrvdn5kogh T+cabae85HEHhLY+/MgtiUaRMtYWbFLpP8fia5YdUzieqWAYxPUsZ6sCbhCchCcxXD8l zsJSfoG2oclMbxi305Uw5gvzDT5gPtpAjzZ88k7B6gQYvmeQyIHI6FZFrerNQ3i35pcH yWbA== MIME-Version: 1.0 X-Received: by 10.194.48.74 with SMTP id j10mr6150458wjn.38.1423129906446; Thu, 05 Feb 2015 01:51:46 -0800 (PST) Received: by 10.27.225.3 with HTTP; Thu, 5 Feb 2015 01:51:46 -0800 (PST) In-Reply-To: <54D330E7.9090100@gmail.com> References: <00c101d04049$ca411ec0$5ec35c40$@tekwire.net> <54D1CA7C.8060204@php.net> <54D1E6EC.7060702@php.net> <54D2B3FA.6020900@gmail.com> <54D2C018.6050803@gmail.com> <54D31A25.3040905@gmail.com> <54D330E7.9090100@gmail.com> Date: Thu, 5 Feb 2015 10:51:46 +0100 Message-ID: To: Stanislav Malyshev Cc: Pierre Joye , Andrey Andreev , 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: pajousek@gmail.com (=?UTF-8?Q?Pavel_Kou=C5=99il?=) On Thu, Feb 5, 2015 at 9:59 AM, Stanislav Malyshev wrote: > Hi! > >> However I feel like the fact that it only affects your app (even if >> you use a library relying on strictness) if you want to is not clear >> for everyone replying here. Is this point clear for you? > > I was addressing the idea that every scalar type mention should be > strict. If it is a choice, I am more open to it, even though I think > declare is a very ugly way of doing it. I'd rather have foo(scalar $bar) > for traditional (coercive) scalar typing, and something like foo(scalar! > $bar) (you can bikeshed the syntax if you like) for strict typing. It is > immediately clear what each one does, does not conflict with PHP > tradition, and allows to freely choose and intermix strictness levels as > one's hear desires. > > -- > Stas Malyshev > smalyshev@gmail.com > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > Hi, the problem with foo(string $bar) and foo(string! $bar) or foo((string) $bar) is that the writer of the method is deciding, not the caller - but in both cases, the method gets exactly what it needs to have, so the way how it should be passed should be upon the caller. Also, this discussion shows why exactly is it a bad idea to have two ways of passing parameters - it's a mess and there isn't an ideal way how to solve it.