Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74125 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94130 invoked from network); 12 May 2014 07:27:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 May 2014 07:27:18 -0000 Authentication-Results: pb1.pair.com header.from=linepogl@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=linepogl@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.170 as permitted sender) X-PHP-List-Original-Sender: linepogl@gmail.com X-Host-Fingerprint: 209.85.214.170 mail-ob0-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:41058] helo=mail-ob0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 47/32-14093-5D770735 for ; Mon, 12 May 2014 03:27:17 -0400 Received: by mail-ob0-f170.google.com with SMTP id uy5so7725997obc.1 for ; Mon, 12 May 2014 00:27:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=4S783cX7D0xMaiZXD1U0PqKf/WhVGXFuKnn+QpyoeKU=; b=wkFHWXmxFXIMW+GkIjLPGfSGlHyYHuMEddOoQqon7nwlVMjHSiRPFc9QDvXDJflFSP 66pbBaXqkBmV1xajIvFgaBB3AvohBfg5aj7FrJ/a5RcXZ2GpF0Pdq3Ym9rzspptRpLix FnHU3ZnZQgRahw2ykYPuaDMceGvQxQdF1iUpBV3o6Dcb3gbghoqqC1a/QSzeOxRmsPQP Ulu1YKpk06NR2gknTxRAzWecWi/KX+QczOwwv4Qq2r/ul0WaNz8Zn/oh5Gw8tzBXBTm6 LYIPpuC1Kvmm32Zt95dAXnqKmnXjV0DgnNlk2E5RyXfAB6+OoqOVV9EFb2Z48kMRxNs7 V8Sg== X-Received: by 10.182.102.99 with SMTP id fn3mr1750036obb.57.1399879634529; Mon, 12 May 2014 00:27:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.76.132.6 with HTTP; Mon, 12 May 2014 00:26:54 -0700 (PDT) In-Reply-To: <53701BA7.2040809@garfieldtech.com> References: <90B71511-4FB4-4916-9AC0-E3DD0D328C37@fb.com> <536D46C5.7040302@sugarcrm.com> <536D50B0.408@sugarcrm.com> <53701BA7.2040809@garfieldtech.com> Date: Mon, 12 May 2014 09:26:54 +0200 Message-ID: To: Larry Garfield Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=089e013d0d6858453604f92ee040 Subject: Re: [PHP-DEV] [RFC] Return Type Declarations pre-vote follow-up From: linepogl@gmail.com (Lazare Inepologlou) --089e013d0d6858453604f92ee040 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hello, 2014-05-12 2:53 GMT+02:00 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 (jus= t > as it would for a parameter type "hint"). That's how I know it's Doing I= t > 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 incenti= ve > to fix the already broken code. :-) > > Docblocks is not the solution. If you want to take profit of static analysis without the penalty of runtime type checking, Hack has shown the way with its "soft type hints". Lazare INEPOLOGLOU Ing=C3=A9nieur Logiciel --089e013d0d6858453604f92ee040--