Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83007 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60391 invoked from network); 17 Feb 2015 21:28:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Feb 2015 21:28:19 -0000 Authentication-Results: pb1.pair.com smtp.mail=francois@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=francois@php.net; 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:39082] helo=smtp2-g21.free.fr) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E7/B2-34644-272B3E45 for ; Tue, 17 Feb 2015 16:28:19 -0500 Received: from moorea (unknown [82.240.16.115]) by smtp2-g21.free.fr (Postfix) with ESMTP id 44CFE4B0163; Tue, 17 Feb 2015 22:27:58 +0100 (CET) Reply-To: To: "'Lester Caine'" , References: <011801d04a07$83ab1c00$8b015400$@php.net> <016f01d04a3a$e9183220$bb489660$@php.net> <022801d04ab1$4a0c47d0$de24d770$@php.net> <1913e09d7f52541901d8574d2080a63f@mail.gmail.com> <54E35855.4060906@lsces.co.uk> <025a01d04ac6$b3cd7170$1b685450$@php.net> <54E364AE.8090907@lsces.co.uk> <027401d04ae0$28b64cf0$7a22e6d0$@php.net> <54E399F6.9080609@lsces.co.uk> In-Reply-To: <54E399F6.9080609@lsces.co.uk> Date: Tue, 17 Feb 2015 22:28:13 +0100 Message-ID: <02a001d04af8$a2ec62d0$e8c52870$@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+gBDwGZjwJNu28fAWzN038BTcdE4wK3JE5jAZIhIykCDBQfTgJuBwbVnM9/GFA= 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?=) > De : Lester Caine [mailto:lester@lsces.co.uk] > > On 17/02/15 18:33, Fran=C3=A7ois Laupretre wrote: > > What does this mean in your case ? Just that, as long as the feature = is not > available, your function won't have an explicit return type. Period. = And, > please, don't change false to 0 ;). >=20 > I simply can't see the case for limited function type hints at all! I If you can't see it after so much was written on the subject, what can = we do ? Do you imply that, if *you* cannot understand the need, it does = not exist ? > either already have clean defined data from the database, or I need to > validate the data from users before using it. If that's your only data source, that's OK. I confirm you probably don't = need type hinting. You probably even don't need functions, classes and = the rest. A 50-line script should fit. > While validating I need to > confirm constraints of data type so adding some extra wrapper that = only > does half the job just seems a pointless exercise. The point of type hinting is not validating user input. > Annotating the > correct data type would be of more use and I already have that in the > docblock and my IDE produces those hints while I am writing the code - > which it has done for many years. That's different. There is overlapping there but the purpose is not the = same. IDEs only can do a limited set of static analysis. As soon as you = have indirect calls, IDE-based static analysis is down, let alone = comment-stripped libraries and others. If you want more constraints on = input and output, look at DbC (design by contract), as it can handle = tests too slow to run in production. To my mind it IS in the IDE that much > of this stuff which people keep saying is not 'runtime' should be > managed, and anything that is not needed at 'runtime' should be > removable but what is being added across several areas all seem to > beadding the same things - partially - using different methods - = without > any obvious gain. Additionally I'm now passing data as an array as = that > was the 'best practice' a few years back so it is rare to be passing a > single value anyway. IDEs are worthwile but not mandatory and runtime features have nothing = to do with IDEs. Now, you were (aggressively) complaining about returning int or false. = You were sure you had found the case that would prove all of this was = ready for the bin. I took the time to explain. Then, you're complaining = it's no use because you don't understand its purpose and because you = chose to bundle your arguments in arrays... Unfortunately, I'm afraid I can't do more for you but what I generally = hate : 'If we don't like it, don't use it'. I try to be kind with constructive posts but, here, I have better to do. Fran=C3=A7ois