Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87129 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71398 invoked from network); 13 Jul 2015 07:07:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Jul 2015 07:07:28 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.43 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.220.43 mail-pa0-f43.google.com Received: from [209.85.220.43] ([209.85.220.43:34733] helo=mail-pa0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E8/90-43998-DA363A55 for ; Mon, 13 Jul 2015 03:07:25 -0400 Received: by pacan13 with SMTP id an13so10951038pac.1 for ; Mon, 13 Jul 2015 00:07:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=2r0KOJpgvCKLK8ddgGAHdH6okOanwZ0MnfgPrSTx058=; b=wICX797FnPW6YK4S2ElU80AOki/HMxF9gt4EHYe14A8/RS0VGlkn+PQXFyWFoZs9a/ OmsV+81Ne8p/daOYfldzQy3bvwLOPHuk45OEaj2l31D9AVt8q9TsDw1AD6NqU+Cf829y NkX15MSmZTKj3pIkBTukkSbm9pi1pa8lF9DuJSDIfgvzRn8n+q1gOi0lBHs/twYlGHfO KXISh6uJDpxS7455NeTONbKnU5zghe4EpUWgnd+lD4+04mrGQfHW6aH6MjH/YqhuYLl9 t9Ug9Gh+tS7YR+W++ieExqvJlVwdPDpH3lT9BG2GFVe4S7NG9JCKo3RftxbE8kNE3i+E JiXQ== X-Received: by 10.68.244.197 with SMTP id xi5mr65582475pbc.45.1436771241960; Mon, 13 Jul 2015 00:07:21 -0700 (PDT) Received: from Stas-Air.local (108-66-6-48.lightspeed.sntcca.sbcglobal.net. [108.66.6.48]) by smtp.gmail.com with ESMTPSA id qc5sm17696432pab.14.2015.07.13.00.07.20 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Jul 2015 00:07:20 -0700 (PDT) Message-ID: <55A363A0.5060307@gmail.com> Date: Mon, 13 Jul 2015 00:07:12 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Marcio Almada CC: Sebastian Bergmann , PHP internals References: <55A16375.4000707@php.net> <55A220D8.3090004@gmail.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] PHP7 and types From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > Of course it's a win. Or do you like to write docblocks for every > single class property or method (even when the member is obvious) just Yes. What is obvious to you today may not be at all obvious to your coworker two years later. > to have a "@var" so your IDE can work? No, not "just" my IDE can work. IDE is just the side effect. Proper documentation does much more than that. > Not to mention you won't get any runtime/compile time check or > optimization from docblock tags, that's the main point of having typed > properties. I don't see how "compile time check" is even possible, given that PHP has no "compile time". As for runtime check, it'd be mostly useless for me - I very rarely have seen bugs that would be caught by such checks. > If you are using the term "proper documentation" to justify docblocks > everywhere even if they contain just a "/** @var string */", it's a > sign we've been using comments against us all this time (even if we > called it "doc comments"). I'm not sure what "using comments against us" even means. I also do not share a superstition that comments are somehow evil or that making comments machine-readable and benefiting from it is somehow wrong. > But thankfully we are moving PHP to another direction. Do you remember If you refer to inserting static typing into random places in service of a cargo cult notion that "more type definitions is always better, because types fix bugs" - no, I do not think it is a correct direction. > https://wiki.php.net/rfc/return_types#vote. That's because "function() > : type" is self documented and much more maintainable than than a > possibly sloppy "/** @return type */" on top of every method on a > codebase. It's not more maintainable and it is much less flexible or useful. PHP has very nice and flexible capabilities that allow write very nice code which can return different values in different circumstances. By trying to shove it into a single type you are ignoring these capabilities - again because of a superstition that somehow there are myriads of bugs caused by accidentally returning values of wrong types that are being fixed by that. > But with the benefits already cited above. Docblocks should not be a > place for type information anymore, this was a workaround and we've Why? There's no reason why they can't be except for a unsupported statement "it is bad because it is bad". -- Stas Malyshev smalyshev@gmail.com