Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80549 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 97448 invoked from network); 15 Jan 2015 15:26:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jan 2015 15:26:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=pajousek@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pajousek@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.53 as permitted sender) X-PHP-List-Original-Sender: pajousek@gmail.com X-Host-Fingerprint: 209.85.192.53 mail-qg0-f53.google.com Received: from [209.85.192.53] ([209.85.192.53:46710] helo=mail-qg0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 17/5E-14306-B0CD7B45 for ; Thu, 15 Jan 2015 10:26:04 -0500 Received: by mail-qg0-f53.google.com with SMTP id a108so3708603qge.12 for ; Thu, 15 Jan 2015 07:26:01 -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=98/8ajPgbYFxQEpqHWoo6pYk2uW6CGmj8JLTMDwhkXQ=; b=MZPsDPed8w7GZ3wUqIGxqjhbil2rmOZPalgk7B6D3couLcl3QdelAn6DdFCsflNqQP LLq3sA9yaECFiDQndww6LUW8NHntKEOD5Gf3v785MtssEAhimbpUSg2VCTMwYqEfKO3Q ZDiGwJF/7HXmGCKFhvOND8z2vu/VBLE99vwCx72GMJSTTvFCRaCgel75Kq/Wh5LiMVzg lWIz/+7FVARIvJ+0vq7TfUTq/ogML4zapyVT53ZBN7hLL+OGViNkzxZ9BIZqmhfXOt9C zatbw2zJ8Om+5WanJjtdu99y7wJQ6+jN9EJl/gwZlyXNNNXqPFiRdL+P2tiFmURYaO0B yFXw== MIME-Version: 1.0 X-Received: by 10.140.35.114 with SMTP id m105mr15772345qgm.79.1421335554943; Thu, 15 Jan 2015 07:25:54 -0800 (PST) Received: by 10.96.55.138 with HTTP; Thu, 15 Jan 2015 07:25:54 -0800 (PST) In-Reply-To: <54B7D8AE.5090209@seld.be> References: <8DCD1B72-C81D-499E-B455-E4A042CD76E6@ajf.me> <54B7D8AE.5090209@seld.be> Date: Thu, 15 Jan 2015 16:25:54 +0100 Message-ID: To: Jordi Boggiano Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] Scalar Type Hints v0.2 From: pajousek@gmail.com (=?UTF-8?Q?Pavel_Kou=C5=99il?=) On Thu, Jan 15, 2015 at 4:11 PM, Jordi Boggiano wrote: > > Reading the thread at this point shows so much confusion, it seems half the > people reading the spec misunderstood that the declare() line affects > function calls only and not the API/implementation level. > > As much I think it was a smart idea and workaround, it is perhaps too clever > for its own good if nobody gets it. > > Anyway, as v0.2 appears to be v0.1 + declare(), why not keep those two > options separated in the vote? > > a) should be add weak typing > b) should we also add declare() for to get strict typing at call-site. > > If *a* passes it would be a great stepping stone towards adding *b* later > perhaps, or tweaking internal coercion rules to improve the behavior of the > weak types, having scalars in return hints (since return hints seem likely > to pass), etc. > > If *b* passes as well great we have a complete picture and every team can > have declare() Y/N in their own coding guidelines based on preference. > Yeah, while the confusion is definitely still there, I would personally argue that definitely some people who oppose the declare() get that it's only for calls in the file - and still don't find it clever. The potential issues with this are pretty real, to be honest. Simple things like moving a method from one class to another (let's say to parent or descendant) and getting to another typing context may cause unpredictable behavior if the user forgets to have declare() in both files. Pavel Kouril