Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82130 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44579 invoked from network); 8 Feb 2015 09:49:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Feb 2015 09:49:58 -0000 Authentication-Results: pb1.pair.com header.from=pajousek@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pajousek@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.176 as permitted sender) X-PHP-List-Original-Sender: pajousek@gmail.com X-Host-Fingerprint: 209.85.216.176 mail-qc0-f176.google.com Received: from [209.85.216.176] ([209.85.216.176:49208] helo=mail-qc0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 70/03-24707-44137D45 for ; Sun, 08 Feb 2015 04:49:58 -0500 Received: by mail-qc0-f176.google.com with SMTP id c9so18547268qcz.7 for ; Sun, 08 Feb 2015 01:49:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=7ahk10Pe1GwyGxuhCcpxTMYa7KYLd/b130Eyziw7EFE=; b=ECsUx1Ra+rvgvNZ6rmP9RZmtNPdS+GSI95iIA8a8Z0tCnD5AmY8I2n81RD97/NHDM+ iCIS28d6fXEKK1tR0rhwaBv641Y7JtoPoG/y2gAvENkSl7eOU8XHPLQxWAl4CzAtW1eM eaKTXjPUbfd1ju2gYHCLJq/HuDLt7VG2MEMYCqA9b3gxC7pRJ+xUjNA81tZr+uqs+M2H 2mlxo1tpp+1VJezSjg+/Obu5xyY4TY2UPQb/GLcS/SHwO4X6Lr3k7gtfvf1Vsp7fx8Xa i4xplJq+GXDKecMU9f4pZHmHCwEB6WMxsW72mQhTkH/VhoF2jau14jG0ZqDQj3zFWQz5 ltGw== MIME-Version: 1.0 X-Received: by 10.229.172.67 with SMTP id k3mr215427qcz.7.1423388993580; Sun, 08 Feb 2015 01:49:53 -0800 (PST) Received: by 10.96.66.201 with HTTP; Sun, 8 Feb 2015 01:49:53 -0800 (PST) In-Reply-To: <2C5FA029-7AA6-4707-ADF1-129194C2B53A@ajf.me> References: <8703B53E-2C4A-4AC6-95C4-D4F19C6D5221@ajf.me> <9E1C2427-0295-4F3E-BD29-04DA84321067@ajf.me> <2C5FA029-7AA6-4707-ADF1-129194C2B53A@ajf.me> Date: Sun, 8 Feb 2015 10:49:53 +0100 Message-ID: To: Andrea Faulds Cc: PHP Internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [VOTE] Scalar Type Hints From: pajousek@gmail.com (=?UTF-8?Q?Pavel_Kou=C5=99il?=) On Sat, Feb 7, 2015 at 11:11 PM, Andrea Faulds wrote: > Hi, > >> On 7 Feb 2015, at 22:03, Pavel Kou=C5=99il wrote: >> >> >> Yeah, but you say in the RFC that "With this approach, an argument is >> only accepted if its type is exactly the same as the parameter." when >> speaking about C# and Java - which is NOT true. > > C# and Java aren=E2=80=99t really considered weakly-typed. Technically th= ey=E2=80=99re not =E2=80=9Cfully strict=E2=80=9D I guess, but if you were t= o give example of strictly-typed languages, you=E2=80=99d probably include = C# and Java in that list - so I did. C# and Java definitely aren't weakly typed. I never said they are though? Also, is there a real difference between strict and strong? Because C# refers to itself as a strongly typed, but you use "strict typing" everytime you speak about strong typing? > > It might be somewhat misleading. Really, what=E2=80=99s =E2=80=9Cweak=E2= =80=9D and what=E2=80=99s =E2=80=9Cstrict=E2=80=9D is rather subjective: C = is sometimes considered weak, sometimes strict. I=E2=80=99d say it=E2=80=99= s more =E2=80=9Cweak=E2=80=9D because all sorts of definitely wrong convers= ions are allowed implicitly and merely generate warnings. C# and Java are m= ore careful here, so I=E2=80=99d say they=E2=80=99re =E2=80=9Cstrict=E2=80= =9D even though I suppose they do have a degree of weak typing. > >> Also, there's no need to mention >> float -> int, because that one is definitely wrong. But for the int >> (and long, etc) -> float (and double) - how do the languages you >> mentioned in the RFC handle that conversion? > > From Microsoft=E2=80=99s documentation that you linked, it sounds like th= ey just always convert and never error, so you=E2=80=99d get data loss in s= ome cases (just like you do in PHP with an explicit cast). > > I am familiar with other languages, I just disagree with their approach. > It's not somewhat misleading, it's 100% misleading - because you state that it acts like in Java and C#, but it doesn't. Also, are there any strongly typed language that implement strong/strict typing the way you want to do it in PHP? >> And as I said myself >> multiple times in the past, the declare syntax IS just ugly (and >> changing how code works by writing one line is an ugly principle as >> well, IMHO). :( > > I prefer this approach to the inconsistency the other approaches suggeste= d thus far lead to. > The thing is, you cannot please everyone. When you try to please anyone, you usally end up with something that has flaws for everyone to some degree. :(