Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58199 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67839 invoked from network); 27 Feb 2012 21:32:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Feb 2012 21:32:04 -0000 Authentication-Results: pb1.pair.com header.from=kris.craig@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=kris.craig@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.54 as permitted sender) X-PHP-List-Original-Sender: kris.craig@gmail.com X-Host-Fingerprint: 74.125.82.54 mail-ww0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:46239] helo=mail-ww0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 00/38-29394-256FB4F4 for ; Mon, 27 Feb 2012 16:32:03 -0500 Received: by wgbdq13 with SMTP id dq13so625373wgb.11 for ; Mon, 27 Feb 2012 13:31:59 -0800 (PST) Received-SPF: pass (google.com: domain of kris.craig@gmail.com designates 10.216.132.32 as permitted sender) client-ip=10.216.132.32; Authentication-Results: mr.google.com; spf=pass (google.com: domain of kris.craig@gmail.com designates 10.216.132.32 as permitted sender) smtp.mail=kris.craig@gmail.com; dkim=pass header.i=kris.craig@gmail.com Received: from mr.google.com ([10.216.132.32]) by 10.216.132.32 with SMTP id n32mr8133668wei.12.1330378319780 (num_hops = 1); Mon, 27 Feb 2012 13:31:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=/KfHGceOL2GaDCTP311BXYckiODl4vEQfZ9xNp6en3M=; b=ZwHzi2MJCTspoBRBlQ/2muPhJ5H6w2OzIqBAf53JhVyUlTzpwNFb3q7A98TmnJbzOZ Fi099mmWdAS6zbYKRU/tMUT891F0z0HNTIu0sDqKcy78UZ1AgzGWranyBgV0EdmR8u/l mA6TN6MPPrT49ja2eYGFcKOfMUtkbvFFlFAWA= MIME-Version: 1.0 Received: by 10.216.132.32 with SMTP id n32mr6453208wei.12.1330378319651; Mon, 27 Feb 2012 13:31:59 -0800 (PST) Received: by 10.223.75.146 with HTTP; Mon, 27 Feb 2012 13:31:59 -0800 (PST) In-Reply-To: References: <1330357150.2159.30.camel@guybrush> Date: Mon, 27 Feb 2012 13:31:59 -0800 Message-ID: To: Ferenc Kovacs Cc: Anthony Ferrara , Michael Morris , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=0016e6d7ef2928e3a604b9f8d7fd Subject: Re: [PHP-DEV] Scalar type hinting From: kris.craig@gmail.com (Kris Craig) --0016e6d7ef2928e3a604b9f8d7fd Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Yeah again sorry about the 1. Another dyslexic moment on this end lol. I don't care about the specific terminology we use, just so long as it makes sense and people aren't confusing it with something else. I differentiated between strong and weak in order to accommodate the looser functionality that Arvids had suggested. I'm fine with just going with the stronger approach and calling that weak if that's what everyone wants. --Kris On Mon, Feb 27, 2012 at 1:24 PM, Ferenc Kovacs wrote: > > > On Mon, Feb 27, 2012 at 8:15 PM, Kris Craig wrote: > >> Now, to rewind a bit past the latest chunk of "I hate this idea" posts..= .. >> >> I'd like to suggest a new term: "strong". >> > > I think it would be better if we could not introduce terms for new > definition if that term is already used in the vocabulary for type system= s: > http://en.wikipedia.org/wiki/Strong_typing > > >> >> This term would be similar to "weak", except with a few key differences: >> >> - Weak would behave very much like Arvids suggested in his earlier >> post; i.e. if the variable is an integer but you pass a string (like = "aaa") >> to it, a warning would be thrown and PHP would attempt to convert it = (i.e. >> it would become 1). >> >> why would "aaa" turn to 1? it would be 0 by the php type juggling rules. > > >> >> - Strong, on the other hand, would throw a fatal error if you >> attempted to pass an incompatible value to an array. Or, to put it a= nother >> way, if the "converted" value does not match the original value. For >> example, if we're assigning "aaa" to an integer, that would convert t= o 1; >> and, since "1" !=3D "aaa", a fatal error would be thrown. On the oth= er hand, >> if you were to pass the string "1" to that integer variable, it would >> convert to 1; and, since "1" =3D=3D 1, there wouldn't be a problem. >> >> same error here, it seems that it isn't the typo. putting that aside: so > you say that the type checking would behave the same was as does currentl= y > the =3D=3D and =3D=3D=3D operator. > >> >> - In both instances, if the converted value matches the original >> (i.e. "1" =3D=3D 1), no warning error would be displayed. Should it = perhaps >> display a notice though? Or no error at all? I can think of reasona= ble >> arguments on both sides of that question. >> >> > I remember seeing that suggestion before, I think that it was proposed > more than once, see > http://marc.info/?l=3Dphp-internals&m=3D128159992610321&w=3D3 > did you read that thread? > > -- > Ferenc Kov=E1cs > @Tyr43l - http://tyrael.hu > --0016e6d7ef2928e3a604b9f8d7fd--