Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67874 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35601 invoked from network); 26 Jun 2013 14:41:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jun 2013 14:41:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.182 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.223.182 mail-ie0-f182.google.com Received: from [209.85.223.182] ([209.85.223.182:48334] helo=mail-ie0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A6/21-29746-B7DFAC15 for ; Wed, 26 Jun 2013 10:40:59 -0400 Received: by mail-ie0-f182.google.com with SMTP id s9so31319526iec.41 for ; Wed, 26 Jun 2013 07:40:56 -0700 (PDT) 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=zDhFfZ0KRaif9uqWoyskhSMEC3Ieh8bZ0XhY9Hs1dx0=; b=Jar4grfXUwqh2buyUhz3z6ggiQ3zYYn95nXggLNXXurXSI9IUK2BmuVxZQvQptE8Hn m5CNc8xXEW8mDLyQ4WQE+odDPid+SUV95WfeCH5eHVa1AJxXDYx9o7y5ocs7RTQp1A97 61T4W3MsP0GOvb6S1oQ5I28WHcd+ESIQCr0xbVTfQGnfxGbKqsOmP7IwR6MylpIaYZF/ /Gcxx87CTQh/S30gsgnyeOMPR6V+hrlH3zys0sPpvsX6QcDffuihmu0V2B+i2LsXbvL8 mk3CuD1cpuCJNGhpmX6ztv9Vzms9qy2k0UwtPyOfQk5FcRYTjs7O7fFhFtphJKH9/Xet bVjQ== MIME-Version: 1.0 X-Received: by 10.43.1.134 with SMTP id nq6mr2419391icb.55.1372257656707; Wed, 26 Jun 2013 07:40:56 -0700 (PDT) Received: by 10.50.65.8 with HTTP; Wed, 26 Jun 2013 07:40:56 -0700 (PDT) In-Reply-To: References: Date: Wed, 26 Jun 2013 16:40:56 +0200 Message-ID: To: Patrick ALLAERT Cc: Julien Pauli , Maxwell , Sherif Ramadan , Florin Patan , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=bcaec51619852b259204e00fa2fe Subject: Re: [PHP-DEV] Request for comments - new PHP feature: return typing From: tyra3l@gmail.com (Ferenc Kovacs) --bcaec51619852b259204e00fa2fe Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, Jun 26, 2013 at 4:21 PM, Patrick ALLAERT wr= ote: > 2013/6/26 Julien Pauli : > > But what Sherif said proves as well the limits of the idea. PHP is not > > strongly typed. So each check, should it be type hinting or return type > > hinting, has to be done at runtime , which is bad for performances. > > It doesn't mean you have to use it, just that it might be used instead > of implementing a manual check in every function/method callers, or, > alternatively, in the function/method itself. > Being done at runtime by the language will for sure not be worst for > performance than doing it manually in pure PHP. > > > Not talking about the type juggling which could lead the programmer as > > shooting himself. > > Sure! Hence why *if* this is taken into account, it should really be > done the same way as it is done for input parameter hinting, to not > introduce what we already don't want there. > > I think that the return typehints a bit easier topic than the input type hinting(for scalars), because that affects the caller, while return type hinting is more contained: you write the function, you put the return typehint there, if the method tries to return something else, then your code is at fault. So even if we would allow return typehints for scalars that would only affects those functions where the developer opts-in. --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --bcaec51619852b259204e00fa2fe--