Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80596 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86111 invoked from network); 15 Jan 2015 21:35:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jan 2015 21:35:01 -0000 Authentication-Results: pb1.pair.com header.from=marcio.web2@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=marcio.web2@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.177 as permitted sender) X-PHP-List-Original-Sender: marcio.web2@gmail.com X-Host-Fingerprint: 209.85.217.177 mail-lb0-f177.google.com Received: from [209.85.217.177] ([209.85.217.177:40315] helo=mail-lb0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1E/C4-61348-48238B45 for ; Thu, 15 Jan 2015 16:35:00 -0500 Received: by mail-lb0-f177.google.com with SMTP id b6so15482098lbj.8 for ; Thu, 15 Jan 2015 13:34:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=e6mKsMlnnnVlR5rvx2oO3Fmh4HivK3GMtWaoUFGagag=; b=RX7+y/ZI4BDleqwdGTN+NEw6T/U7T/Pk1UO+gbdDB1v3jlBWih3bPpRfgPRLR6H/yI DMYHEEiCQaWnVJT38/hYxVz1utXn22jLDYedi+0jM+CsjiDIBmpC1PqBfh30d4+zCGu9 vHydb1+ABR8kg8Waey3zjnfl/BowuGh4NIyfMl5lOKGmE2MLFLoOmjJe2KXRw+EC8WHl R4nj2PZeTmUyUqkYP6E5sNu03JejMpyNxU0PCLwHCxLvOub0HhBPYWEl6LEtzxMICE6y Bu/vS9+98WF7SIh3XZ/HYiuFVrXf2w1ozDQjR93duM5MMp6wM0kF52S1Itcbq5/NcRmB 67CA== X-Received: by 10.112.162.226 with SMTP id yd2mr5743422lbb.1.1421357697364; Thu, 15 Jan 2015 13:34:57 -0800 (PST) MIME-Version: 1.0 Received: by 10.152.21.101 with HTTP; Thu, 15 Jan 2015 13:34:36 -0800 (PST) Reply-To: marcio3w@gmail.com In-Reply-To: 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> <8BABA306-12CE-4568-98F3-419A1557F61B@ajf.me> <20150115201654.4674326139A@dd15934.kasserver.com> <20150115205902.802BC26139A@dd15934.kasserver.com> Date: Thu, 15 Jan 2015 18:34:36 -0300 Message-ID: To: "S.A.N" Cc: Thomas Bley , internals Content-Type: multipart/alternative; boundary=089e0112c86ca679c0050cb7a0a6 Subject: Re: [PHP-DEV] [RFC] Scalar Type Hints v0.2 From: marcio.web2@gmail.com (Marcio Almada) --089e0112c86ca679c0050cb7a0a6 Content-Type: text/plain; charset=UTF-8 S.A.N, > The main advantage of the two syntaxes: > > 1. Strict > function bar(int $num){} > > 2. Weak > function bar((int) $num){} > > Any junior-middle PHP developer, seeing this syntax in the code can > understand how it works, without studying the documentation and without > your complex conversion tables. > >Explicit is better than implicit, is the motto Python, here it is very >relevant. Just listing the advantages of the withdrawn ircmaxwell's RFC https://wiki.php.net/rfc/parameter_type_casting_hints over this one (both v0.1 and v0.2): 1. No BC breaks (classes named int, float, string would not become reserved) 2. More semantic and explicit (just like S.A.N said) 3. Will not block possible strict typing RFCs to get voted in the future 4. No reserved words added 5. Minimalist implementation (no runtime flags, configurations, etc) I'm not trying to highjack the topic here... just adding an alternative to an RFC that seems to become more and more polemic with both sides unsatisfied :) > I don't think any junior-middle php developer with understand how "(int)" works. > Just make a test and see how many will answer (int)'asd' with 1. Thomas, Actually `(int)'asd'` would be evaluated to 0 ;) ... `(int)'1asd'` would be evaluated to 1, though (I guess that's what you tried to say?). 2015-01-15 18:18 GMT-03:00 S.A.N : > The main advantage of the two syntaxes: > > 1. Strict > function bar(int $num){} > > 2. Weak > function bar((int) $num){} > > Any junior-middle PHP developer, seeing this syntax in the code can > understand how it works, without studying the documentation and without > your complex conversion tables. > > Explicit is better than implicit, is the motto Python, here it is very > relevant. > --089e0112c86ca679c0050cb7a0a6--