Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87123 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 38000 invoked from network); 12 Jul 2015 19:37:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Jul 2015 19:37:30 -0000 Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 66.111.4.26 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 66.111.4.26 out2-smtp.messagingengine.com Received: from [66.111.4.26] ([66.111.4.26:38599] helo=out2-smtp.messagingengine.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FD/20-17022-6F1C2A55 for ; Sun, 12 Jul 2015 15:37:27 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 74D08209F3 for ; Sun, 12 Jul 2015 15:37:23 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Sun, 12 Jul 2015 15:37:23 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=pZGKdi4sguSoSRK IJlp5FJY00jg=; b=Qi0doP32YT42j6OzwlFTq+oLGr/Ub8TsxB7QpioBSev0jMN l9VZqhlwy9Neuw0NhK1HrsFNISG103w4EBiH/fOd0+1JJ3StXjwxNqILG/BLR1Gw /f9r01qvYyTe0rPZelo4RKIPcfBb7xghSen8L/Hmb0BZaHm8m15BsksENSIQ= X-Sasl-enc: uqEqKNH98dU/IlJ2r47PJgMBepiIg83vypIoOS2ouGgX 1436729843 Received: from [192.168.42.5] (c-50-129-175-166.hsd1.il.comcast.net [50.129.175.166]) by mail.messagingengine.com (Postfix) with ESMTPA id 3539768015C for ; Sun, 12 Jul 2015 15:37:23 -0400 (EDT) Message-ID: <55A2C1F2.8000301@garfieldtech.com> Date: Sun, 12 Jul 2015 14:37:22 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: internals@lists.php.net References: <55A16375.4000707@php.net> <55A220D8.3090004@gmail.com> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] PHP7 and types From: larry@garfieldtech.com (Larry Garfield) On 07/12/2015 11:16 AM, Marcio Almada wrote: > Stas, > > 2015-07-12 5:10 GMT-03:00 Stanislav Malyshev : >> Hi! >> >>> Not completely bogus. At least with typed properties you won't need to >>> actually write the docblocks to have the IDE "hints". It's a minor win >>> for IDE users too. >> I don't see "not needing to write docblocks" as a win, quite the >> contrary. > 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 > to have a "@var" so your IDE can work? > > 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. > >> In fact, in a number of projects I worked with, code without >> proper documentation (including docblocks) simply wasn't accepted into >> the repository. >> > 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"). > > But thankfully we are moving PHP to another direction. Do you remember > the "return types" voting results? > 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. > >> While I don't think this needs to be mandatory, I also don't see major >> difference - so you have to write type instead of docblock, you still >> have to write something. >> > But with the benefits already cited above. Docblocks should not be a > place for type information anymore, this was a workaround and we've > been slowly replacing it with a better solution (opt in types). > Property types seems to be the next logical step after adding return > types and scalar types. I don't know why we're even talking about IDEs here. IDE auto-completion isn't the point, anymore than it was the point for scalar type hints or return type hints. It's about the language doing type checking for you and static analysis, so that the language can find bugs for you. Eg: class Foo { public Bar $bar; } $f = new Foo(); $f->bar = new Baz(); // This line is clearly wrong and the compiler can check it for you. That's what the benefit would be. Easier IDE auto-completion is a nice extra, but not the main goal. +1 from me in 7.1. --Larry Garfield