Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81796 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 79438 invoked from network); 4 Feb 2015 09:38:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Feb 2015 09:38:49 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@tutteli.ch; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=php@tutteli.ch; sender-id=pass Received-SPF: pass (pb1.pair.com: domain tutteli.ch designates 80.74.154.78 as permitted sender) X-PHP-List-Original-Sender: php@tutteli.ch X-Host-Fingerprint: 80.74.154.78 ns73.kreativmedia.ch Linux 2.6 Received: from [80.74.154.78] ([80.74.154.78:52211] helo=hyperion.kreativmedia.ch) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 48/35-55046-6A8E1D45 for ; Wed, 04 Feb 2015 04:38:47 -0500 Received: (qmail 6203 invoked from network); 4 Feb 2015 10:38:42 +0100 Received: from cm135-167.liwest.at (HELO RoLaptop) (81.10.135.167) by ns73.kreativmedia.ch with ESMTPSA (AES256-SHA encrypted, authenticated); 4 Feb 2015 10:38:42 +0100 To: "'Dmitry Stogov'" , "'Sebastian Bergmann'" Cc: "'PHP Internals'" References: <00c101d04049$ca411ec0$5ec35c40$@tekwire.net> <54D1CA7C.8060204@php.net> In-Reply-To: Date: Wed, 4 Feb 2015 10:38:41 +0100 Message-ID: <003f01d0405e$5d1bf080$1753d180$@tutteli.ch> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQI+MKsMv6zrm7KCv5jpZIs/BqhffwHJ9dvJAVdrBXgBsC3UswHm0N93AfLB7ygB8dXUSpuvcIJQ Content-Language: de-ch Subject: AW: [PHP-DEV] What do we need strict scalar type hints for? From: php@tutteli.ch ("Robert Stoll") > -----Urspr=C3=BCngliche Nachricht----- > Von: Dmitry Stogov [mailto:dmitry@zend.com] > Gesendet: Mittwoch, 4. Februar 2015 10:26 > An: Sebastian Bergmann > Cc: PHP Internals > Betreff: Re: [PHP-DEV] What do we need strict scalar type hints for? >=20 > hi Sebastian, >=20 > Do you like the proposal with declare() switch? > Don't you afraid of sin(1) break? (it's just an example, telling how = many things may be broken). >=20 > Thanks. Dmitry. >=20 > On Wed, Feb 4, 2015 at 10:30 AM, Sebastian Bergmann = > wrote: >=20 > > Am 04.02.2015 um 08:25 schrieb Dmitry Stogov: > > > The idea of that RFC was an ability to have zero-cost assert(). > > > > But an assert() is still in the body of a function or method and = not > > part of its signature. That is what I want scalar type declarations > > for. > > > > > > -- > > PHP Internals - PHP Runtime Development Mailing List To unsubscribe, > > visit: http://www.php.net/unsub.php > > > > Personally I am not in favour of the declare approach because the user = will need to switch between strict context and non-strict context which = will be quite challenging, anti-efficient (in terms of productivity) and = most probably another source for bugs. Yet, I have to defend Andrea's RFC here since the claims made that it = will break all kind of existing code is just not true (or I got the RFC = completely wrong). sin(1) would only be broken if and only if the user has decided to use = it in a strict mode. Consider the following: User A writes the file index.php and user B writes test_strict.php As far as I can tell user A which want to code in non-strict mode could = do so also in the future - no error is reported, no problem at all. Only = user B would get the error and only because he/she wanted to be informed = when his/her code is not strict. [*] we could actually distinguish between int literals/constants and int = variables. The above case would be fine as well since 1 can be int or = float (pretty much as Haskell is handling it)