Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80607 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 9296 invoked from network); 16 Jan 2015 00:54:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jan 2015 00:54:23 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.177 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.214.177 mail-ob0-f177.google.com Received: from [209.85.214.177] ([209.85.214.177:50303] helo=mail-ob0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FE/D1-33406-E3168B45 for ; Thu, 15 Jan 2015 19:54:22 -0500 Received: by mail-ob0-f177.google.com with SMTP id uy5so16087636obc.8 for ; Thu, 15 Jan 2015 16:54:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=vO/Xmkdn43w0GhKEayQxX2Iiy8cgDyUZhKCrxR/vkcM=; b=Q8IGcUf97jlUxrd/BczrENXrr/bzjCorssmvINpi5Wn65RIvlidV8LmpL6CpTCbWHg QRUGnzlRXRIQ8jwa7DhOseTGraPuY3FuukhdZJBfjgP12qeebfF7O/JkVZAH+TCJkHuu 635hwWPamWdPoT3Uk+532VWvREWd16ErhNyTiCxdf1BYHeqqoe3Qttsy4vtLswptE4UL ALhygUH+egWblzUVZSGT6ypK25D7hexJQh5GIBMM4wwoqXWzZBfAAa18eyPQWU4UuniF zeJCWNX5qTpBi9SD+vqaPbEs1AYy5gwMyYAchY5izBXfRnemSSplc919QQRA6Yk9pX2Y dE6A== X-Received: by 10.60.70.206 with SMTP id o14mr7783498oeu.78.1421369658848; Thu, 15 Jan 2015 16:54:18 -0800 (PST) Received: from Stas-Air.local (108-66-6-48.lightspeed.sntcca.sbcglobal.net. [108.66.6.48]) by mx.google.com with ESMTPSA id e66sm1488161oig.5.2015.01.15.16.54.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Jan 2015 16:54:18 -0800 (PST) Message-ID: <54B86134.1020801@gmail.com> Date: Thu, 15 Jan 2015 16:54:12 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: marcio3w@gmail.com CC: Andi Gutmans , Andrea Faulds , Zeev Suraski , Richard Quadling , Leigh , PHP Internals List References: <8DCD1B72-C81D-499E-B455-E4A042CD76E6@ajf.me> <4E2073DE-0951-498C-97BB-DDAC094F11FA@ajf.me> <9a033dd1f223f854e760924d118ab812@mail.gmail.com> <2ae0164cb9b9bf1c974d7a3c60af0466@mail.gmail.com> <6105ea99002e634373c09685310e26a6@mail.gmail.com> <85F6139E-6332-4645-91B8-C852B07EA62A@ajf.me> <12433808-9D62-48D3-B66E-74572C61BF68@zend.com> <54B85C2B.9000901@gmail.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Scalar Type Hints v0.2 From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > The hole point (at least for me) for being against `function bar(int > $num){}` to achieve type coercion is that the syntactic equivalent > code `function bar(array $numbers){}` won't do any coercion - (array) > $numbers - because BC break would be too big to handle. > > Having `int|integer|bool|float|real|string` as coercive type hints > while `array` is "strict" looks like an ugly hack (no pun intended). That's how all internal functions work. It looks like you didn't actually read my argument but just repeated "I want my use case". I know you want strict typing. I even proposed the option for it. But if you read "function bar(int $num)" in the PHP manual, coercive typing is exactly what it means. That's how it has been since forever. It has nothing to do with arrays, because - repeating it in like 10000th time in this discussion - arrays are not scalars and PHP does not coerce non-scalars, only scalars. You can make scalars work like non-scalars - that would mean turning PHP into strongly typed language, like Python. -- Stas Malyshev smalyshev@gmail.com