Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74121 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67770 invoked from network); 12 May 2014 00:54:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 May 2014 00:54:02 -0000 Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 66.111.4.29 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 66.111.4.29 out5-smtp.messagingengine.com Received: from [66.111.4.29] ([66.111.4.29:38885] helo=out5-smtp.messagingengine.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EB/A4-37098-9AB10735 for ; Sun, 11 May 2014 20:54:01 -0400 Received: from compute4.internal (compute4.nyi.mail.srv.osa [10.202.2.44]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 5E0702092F for ; Sun, 11 May 2014 20:53:59 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Sun, 11 May 2014 20:53:59 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:date:from:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; s=smtpout; bh=47LObSUJzA5t2Fxn8PW7qJ xMghU=; b=F3hxTtajCUSjhLoSFawjozJG1WLa8e4rvpXiZNo6cdrcwdiBnV8Isr gqb2dOU/pFta80nnuKcptk0wPSzIOtn3gsaXOOj/PJUtzmS3I1WFY+iXqVjY1Tk5 4TiNkKs62i+dt8bzjuvr9NOJ0ekrX5PY1Q8LkOq4AwovdG2nM3rhs= X-Sasl-enc: gYcWfRtCFFX8nOfYxRqBTQRtDIPby7ry1+KLFpb+R5tT 1399856039 Received: from [192.168.42.22] (unknown [98.206.137.135]) by mail.messagingengine.com (Postfix) with ESMTPA id 249E3680112 for ; Sun, 11 May 2014 20:53:59 -0400 (EDT) Message-ID: <53701BA7.2040809@garfieldtech.com> Date: Sun, 11 May 2014 19:53:59 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: internals@lists.php.net References: <90B71511-4FB4-4916-9AC0-E3DD0D328C37@fb.com> <536D46C5.7040302@sugarcrm.com> <536D50B0.408@sugarcrm.com> In-Reply-To: <536D50B0.408@sugarcrm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Return Type Declarations pre-vote follow-up From: larry@garfieldtech.com (Larry Garfield) On 05/09/2014 05:03 PM, Stas Malyshev wrote: > Hi! > >> Our view is that this code was *already* wrong. The type annotations >> don't make it more or less wrong. What they do let you do is enforce, > Of course it is wrong. The whole point of having strict typing is to > catch wrong code. If everybody would write only right code, we wouldn't > need any type checks - everything would be ok anyway (not correct for > some compiled languages as there types also tell the compiler how to > convert values to bits, but true for languages like PHP). > >> once the annotation is in place, that it's correct moving forward for >> the places that are annotated. (And if you want to go fix up and > The whole point is that it won't be correct. In your model, when you use > typed function, essentially you know nothing about its return type, as > somebody could have overridden it with function returning anything. So > the only thing typing is useful for in your model is to document our > wishes about types. We already have that with @returns. I'm inclined to agree with Stas and and Levi here. If we want return-type-suggestions, that already exists in docblocks and any self-respecting IDE already takes advantage of that. If I use an actual return type, it means I *want* any such broken code to fatal and die (just as it would for a parameter type "hint"). That's how I know it's Doing It Wrong(tm) so I can fix it. If that means I can't actually commit the return type code until I fix the other code, so be it. That's my incentive to fix the already broken code. :-) --Larry Garfield