Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78753 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14714 invoked from network); 5 Nov 2014 22:26:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Nov 2014 22:26:36 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.218.48 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.218.48 mail-oi0-f48.google.com Received: from [209.85.218.48] ([209.85.218.48:35233] helo=mail-oi0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AB/C3-27106-A14AA545 for ; Wed, 05 Nov 2014 17:26:34 -0500 Received: by mail-oi0-f48.google.com with SMTP id x69so92830oia.7 for ; Wed, 05 Nov 2014 14:26:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=bzhXjb+p5v6Fz+RkcxrRW3IydGrM35TJzDrBrWXpyes=; b=hNBvga/Be8qTD8EJwBvA/xAAUp2iZbKeAKl4FAfnVWVAkVN6hSeyVOE2m6cFKTKHAT FJEfB6KrmXcln5/3X8MuHt+5aNJa6fXk7ARRkfqNpbkCRc8gOe3k49wgwStxLj3Xm/BM LIhyeVi73tvj3BvXZ+eJD3m6BUDmQYVvveKyWdAWeI2njPTOzsNRggIKNmI2o3uVgxnu 0S3+nWj+wX/EOFNyVg/jcj4TJbssZtRx1Hl7faVSu/lRHEvTwPTDdDIHvXsmeLL6UzBn Q4CgfdjQw9/tW6lpyYwKveO/TJFb+sM5W3Xyl5v6Ym2SPcK3EDnaPwTnNAaWGoWMswxw wVqA== X-Gm-Message-State: ALoCoQm/xIFRHEmi5OOMdR2C3x6VPDW1r56eR0iGhpKxD/cinGNU9fX3GyHJjXcEpaZyJy1DTl4NVjFK0SNx1fIAE80DCNV88M/s8tmHKpm+OvxxSd/+ruVEocNuI3ZuIYBKmMTifK46sW6sGR/kraQXkdW5GvNs7g== MIME-Version: 1.0 X-Received: by 10.202.193.135 with SMTP id r129mr192012oif.66.1415226391391; Wed, 05 Nov 2014 14:26:31 -0800 (PST) Received: by 10.60.70.41 with HTTP; Wed, 5 Nov 2014 14:26:31 -0800 (PST) In-Reply-To: <545AA193.6060606@sugarcrm.com> References: <5B1B375C-328B-40BD-B715-8EDA158B44CE@ajf.me> <545A912A.2050202@sugarcrm.com> <545AA193.6060606@sugarcrm.com> Date: Thu, 6 Nov 2014 02:26:31 +0400 Message-ID: To: Stas Malyshev Cc: Andrea Faulds , Levi Morrison , internals , Nikita Popov Content-Type: multipart/alternative; boundary=001a113dc2a6560da90507241239 Subject: Re: [PHP-DEV] [RFC][Vote] Return Types From: dmitry@zend.com (Dmitry Stogov) --001a113dc2a6560da90507241239 Content-Type: text/plain; charset=UTF-8 I would also prefer to use the same return type hinting compatibility rules as for argument type-hinting. May be it's less smart, but more practical. http://en.wikipedia.org/wiki/Covariance_and_contravariance_%28computer_science%29 Thanks. Dmitry. On Thu, Nov 6, 2014 at 1:15 AM, Stas Malyshev wrote: > Hi! > > > No, classes are not loaded for type checks, since it would be > pointless > > - if the class is not loaded, you could not have a value of that > type, > > so if the class is not present, the answer is "no". > > > > > > It's not true anymore, with this proposal. > > This is not good. The base premise of type checks always was if you > don't use them, they are basically free - you don't load the classes, > you don't do any work, until you actually need them, and by then your > class is supposed to be already loaded, so again it's not costly. But if > just declaring a type could trigger loading of code, this may > significantly increase the footprint and loading time for classes that > have many options but only use some of them at the time. > Also, it is kind of weird that arguments require exact match but return > types do not. Not that we care for consistency anymore... > -- > Stanislav Malyshev, Software Architect > SugarCRM: http://www.sugarcrm.com/ > --001a113dc2a6560da90507241239--