Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83808 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95612 invoked from network); 25 Feb 2015 17:12:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Feb 2015 17:12:25 -0000 Authentication-Results: pb1.pair.com header.from=j.boggiano@seld.be; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=j.boggiano@seld.be; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain seld.be designates 74.125.82.182 as permitted sender) X-PHP-List-Original-Sender: j.boggiano@seld.be X-Host-Fingerprint: 74.125.82.182 mail-we0-f182.google.com Received: from [74.125.82.182] ([74.125.82.182:36157] helo=mail-we0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A5/51-20665-6720EE45 for ; Wed, 25 Feb 2015 12:12:24 -0500 Received: by wevk48 with SMTP id k48so4997880wev.3 for ; Wed, 25 Feb 2015 09:12:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=edq9GIBivCgWzyiZATJvwRYNRFXqB8/T586KtRtQeFw=; b=YoEx/3UFyXSds7MicOJHPf5cIduYdH9XYNx5Ibo1dgMBcrCT//hzrEudAGtKvzwUBi 98el5aggx26MyzvyMNqylPVXwyVOfY9esNG9UxhRtUhoMd4u36Xy/Z23S0zG/mO2k5xJ xQd3rDS3YVlRw3sfuvaWKwv3FC1CGwLbP4XNrHI7jejr/u8c8Oxxp8nFyD8sWBgxrvPy rhLDUuqKgKWfsaf1RDkp5CmKTyAMpwMD1W7yhEwq/Zq0A5mV0nu3cUldna3uY0RgL4Dc XKPxzn0qqrPth1SRGkO17yowptMfVdtKezFtdBBVhChZUqRyP5D2Iz1pExp4Pye89Knb eZCA== X-Gm-Message-State: ALoCoQkUVo7/Hy5q5oTPfm4ryWoMm850/TdMXpXtsx7t9WgSKxhTq8O2bJfkR6iYW9BSU9Ht234w X-Received: by 10.180.38.76 with SMTP id e12mr41036477wik.76.1424884339761; Wed, 25 Feb 2015 09:12:19 -0800 (PST) Received: from [87.115.196.39] (39.196.115.87.dyn.plus.net. [87.115.196.39]) by mx.google.com with ESMTPSA id m4sm65676017wjb.25.2015.02.25.09.12.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Feb 2015 09:12:18 -0800 (PST) Message-ID: <54EE0271.3030908@seld.be> Date: Wed, 25 Feb 2015 17:12:17 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: [RFC-Discuss] Scalar Type Declarations v0.5 From: j.boggiano@seld.be (Jordi Boggiano) On 25/02/2015 12:30, Dmitry Stogov wrote: > anyone may tell, what this will print without running :) > > main.php > ======== > declare(strict_types=1) > include "a.php"; > include "b.php"; > var_dump(foo("5")); > ?> > > a.php > ===== > declare(strict_types=0) > function foo(string $a): string { > bar($a); > return $a; > } > ?> > > b.php > ===== > declare(strict_types=1) > function bar(int &$a) { > var_dump($a); > } > ?> I am not sure if we really need to focus the discussion on whether edge cases using references are confusing or not. They already are confusing even without scalar hints (of any kind), and that's why most people know to stay away from refs in PHP. PHP5 would behave the same if you did an explicit $a = (int) $a; in bar() for example, and the same WTF happens with the other RFC, so I am not really sure what you are trying to point out here. Cheers -- Jordi Boggiano @seldaek - http://nelm.io/jordi