Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87124 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75756 invoked from network); 12 Jul 2015 22:51:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Jul 2015 22:51:27 -0000 Authentication-Results: pb1.pair.com header.from=dyulax@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dyulax@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.176 as permitted sender) X-PHP-List-Original-Sender: dyulax@gmail.com X-Host-Fingerprint: 209.85.214.176 mail-ob0-f176.google.com Received: from [209.85.214.176] ([209.85.214.176:36625] helo=mail-ob0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 10/01-17022-96FE2A55 for ; Sun, 12 Jul 2015 18:51:22 -0400 Received: by obcsb2 with SMTP id sb2so58630obc.3 for ; Sun, 12 Jul 2015 15:51:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=XYEYq4BmJVJHfkT1YSkonr6II8BC8zfB4aiDrek9Qzk=; b=SOpV0qJgpWAnhRw6h/NFWOYWy2iTsAVvyoKYJvjK75D8gfY2bbuQPDNOJfRE6h54kO DP7oi/qhU/2f7kctGLjEcRTpT6D+xAPSadfgtlmsuDKUBATRmBPsChsJKZB04PylItYb SzVfP3sP9IfiNSoZ+jbA+L/BGcliVRXHrZqweBVh2QMVZ9fp2K6aa1421ETivsx8pZF5 P8K88bNB5kQ1gGkmz6/pkYyk219xDIgbzHhlKbF30KDyHW4l6ztYdP602nDoMc2tffHZ maxDleaVILP7dFlhLvJ495opsXj8otzrpsdqhuU54VotV7tjOHgVTuuf3l3JsmOS7T4o hkFg== X-Received: by 10.182.199.103 with SMTP id jj7mr12650465obc.49.1436741479358; Sun, 12 Jul 2015 15:51:19 -0700 (PDT) MIME-Version: 1.0 Sender: dyulax@gmail.com Received: by 10.60.13.10 with HTTP; Sun, 12 Jul 2015 15:51:00 -0700 (PDT) In-Reply-To: <55A2C1F2.8000301@garfieldtech.com> References: <55A16375.4000707@php.net> <55A220D8.3090004@gmail.com> <55A2C1F2.8000301@garfieldtech.com> Date: Sun, 12 Jul 2015 19:51:00 -0300 X-Google-Sender-Auth: 0ssJxtXkej3s6zHRPEZ5_AYikmw Message-ID: To: Larry Garfield Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=e89a8ff1c9ec82ea71051ab5719a Subject: Re: [PHP-DEV] PHP7 and types From: alanwillms@gmail.com (Alan Willms) --e89a8ff1c9ec82ea71051ab5719a Content-Type: text/plain; charset=UTF-8 What about arrays? How do I declare Foo[] ? http://ocramius.github.io/extremely-defensive-php/#/69 2015-07-12 16:37 GMT-03:00 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 > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --e89a8ff1c9ec82ea71051ab5719a--