Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80604 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4244 invoked from network); 16 Jan 2015 00:32:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jan 2015 00:32:53 -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.182 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.214.182 mail-ob0-f182.google.com Received: from [209.85.214.182] ([209.85.214.182:55996] helo=mail-ob0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 14/D0-33406-33C58B45 for ; Thu, 15 Jan 2015 19:32:52 -0500 Received: by mail-ob0-f182.google.com with SMTP id wo20so16502300obc.13 for ; Thu, 15 Jan 2015 16:32:48 -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=bBGAVyYi7QIY/imOS+Z6DvLxmImx7/lEoOxZB602VcQ=; b=sqqfMvVROXiZUYYeo+KgiK1uElWRqvdKVMIM2zPZccsERSDmEqq+lZ5mlrr63unxI1 rOJGKvx2fT67x1z1OUGPe0Uc/BQNY1Nbetg1OQsMDfbw+7z3jcT3785SpXFSOVldYEcc mZM6Cvk1wf+VdgYJQnZPtZ3QZ084RwdOb/LjvkS3QX/xU12Ytj7irj0Y6/VhhR6JgTGe 2SZYedkfokxPHCrBrtDRjTkNed2zeOi6l8oxDsQ3qqmcKoylDqpsyWrSCAAkax5b5Ie1 UjsATrZxIZF6NIkPDaxX3IMZLCEfiwwDYdlb4MUoRvZuWnTt8V2tc24m9xRbyoyRTTzk 9NMg== X-Received: by 10.182.199.70 with SMTP id ji6mr7630128obc.3.1421368368867; Thu, 15 Jan 2015 16:32:48 -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 f125sm1438805oic.29.2015.01.15.16.32.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Jan 2015 16:32:48 -0800 (PST) Message-ID: <54B85C2B.9000901@gmail.com> Date: Thu, 15 Jan 2015 16:32:43 -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 , RQuadling@gmail.com, 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> 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! >> 1. Strict >> function bar(int $num){} >> >> 2. Lax >> function bar((int) $num){} I would rather have int $num for coercive typing - given that close to 100% of existing typed functions - namely internal functions - mean exactly that and are actually documented with this exact syntax. Yes, there are some functions that do strict, but those are in most cases are either close to bugs which nobody cares to fix since it's so narrow a case or some very special cases of some complex API where type matters for API-specific reasons. As for strict, maybe it can be int! $num or something like that. I'm not exactly supporting it, but out of what I have seen this would make the most sense for me - it expresses the intent pretty clearly ("give me int! or else!" :) and does not conflict with existing stuff. Putting it on the table as a brainstorming exercise. -- Stas Malyshev smalyshev@gmail.com