Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82998 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26583 invoked from network); 17 Feb 2015 18:50:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Feb 2015 18:50:37 -0000 Authentication-Results: pb1.pair.com header.from=francois@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=francois@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 212.27.42.2 as permitted sender) X-PHP-List-Original-Sender: francois@php.net X-Host-Fingerprint: 212.27.42.2 smtp2-g21.free.fr Received: from [212.27.42.2] ([212.27.42.2:15980] helo=smtp2-g21.free.fr) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5F/0B-19463-B7D83E45 for ; Tue, 17 Feb 2015 13:50:36 -0500 Received: from moorea (unknown [82.240.16.115]) by smtp2-g21.free.fr (Postfix) with ESMTP id B10FD4B01DD; Tue, 17 Feb 2015 19:50:15 +0100 (CET) Reply-To: To: "'Jordi Boggiano'" , References: <011801d04a07$83ab1c00$8b015400$@php.net> <016f01d04a3a$e9183220$bb489660$@php.net> <022801d04ab1$4a0c47d0$de24d770$@php.net> <1913e09d7f52541901d8574d2080a63f@mail.gmail.com> <54E36B7D.9070502@seld.be> In-Reply-To: <54E36B7D.9070502@seld.be> Date: Tue, 17 Feb 2015 19:50:30 +0100 Message-ID: <027501d04ae2$9a92f150$cfb8d3f0$@php.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQGD0sLDaA+/0NIeBlQhQC5OtPA/xwHih9+6AanvcsEBj7eMCwEU0CpMAs0H7+gBDwGZjwJNu28fAX8sxVQCaZ9tkZ0L/xFQ Content-Language: fr X-Antivirus: avast! (VPS 150217-1, 17/02/2015), Outbound message X-Antivirus-Status: Clean Subject: RE: [PHP-DEV] Reviving scalar type hints From: francois@php.net (=?utf-8?Q?Fran=C3=A7ois_Laupretre?=) Hi, Starting making the strict mode weaker is nonsense. It is not just = Rasmus' example. Which exception do you authorize then ? Would you = define a third 'pseudo-strict' mode ? And about static analyzers, will = they be 'pseudo-strict' too ? No, if you want strict, it can only remain purely strict. I can = understand the 'strict' position, but not the desire to make it weaker. = Do you understand that, starting from the purely-strict position, I can = give you use cases which will cause you to define additional exceptions, = until you get the same conversion rules as I am currently defining ! The = only difference is that I don't claim it being 'strict'. And 'numeric' is either a new ZPP type, or an alias for a future union = type. Nothing to do with pure strict mode. These are all hacks trying to solve specific use cases. Regards Fran=C3=A7ois > -----Message d'origine----- > De : Jordi Boggiano [mailto:j.boggiano@seld.be] > Envoy=C3=A9 : mardi 17 f=C3=A9vrier 2015 17:26 > =C3=80 : internals@lists.php.net > Objet : Re: [PHP-DEV] Reviving scalar type hints >=20 > On 17/02/2015 15:47, Anthony Ferrara wrote: > > If we want to add a "numeric" type as a virtual union of int and > > float, that's one way to solve the concern. If we don't, we could = also > > allow widening primitive conversion (int -> float). That wouldn't = work > > well with bigints, but would be fine in other cases. But there are > > plenty of languages that always require explicit type conversion. So > > even if we choose that, we're in good company. >=20 > As far as I understand, allowing int -> float would help fix a few of > Rasmus' (or was it Benjamin?) concerns about things like sin() = requiring > floats in strict mode. It would make strict mode a lot more usable = with > C code as well. +1 on keeping the strictness benefits and remove some = of > the drawbacks. >=20 > Having numeric in addition might be nice mostly for return values I > guess, but it seems a bit redundant to me if int -> float is allowed. >=20 > As for the straw poll, I also think declare() is the clearest syntax, > especially if it's enforced to appear at most once and on top of the > file to remove any potential misuses. >=20 > Cheers >=20 > -- > Jordi Boggiano > @seldaek - http://nelm.io/jordi >=20 > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php