Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58388 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64527 invoked from network); 1 Mar 2012 04:53:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Mar 2012 04:53:09 -0000 Authentication-Results: pb1.pair.com header.from=adamjonr@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=adamjonr@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.170 as permitted sender) X-PHP-List-Original-Sender: adamjonr@gmail.com X-Host-Fingerprint: 209.85.214.170 mail-tul01m020-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:33496] helo=mail-tul01m020-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9B/E7-46815-4B00F4F4 for ; Wed, 29 Feb 2012 23:53:09 -0500 Received: by obbwd1 with SMTP id wd1so264269obb.29 for ; Wed, 29 Feb 2012 20:53:06 -0800 (PST) Received-SPF: pass (google.com: domain of adamjonr@gmail.com designates 10.60.30.70 as permitted sender) client-ip=10.60.30.70; Authentication-Results: mr.google.com; spf=pass (google.com: domain of adamjonr@gmail.com designates 10.60.30.70 as permitted sender) smtp.mail=adamjonr@gmail.com; dkim=pass header.i=adamjonr@gmail.com Received: from mr.google.com ([10.60.30.70]) by 10.60.30.70 with SMTP id q6mr1454970oeh.56.1330577586240 (num_hops = 1); Wed, 29 Feb 2012 20:53:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=UY0JaNdlebCDUW82CHkv+2oyKoKHf39xcp656kSOlqs=; b=V3PatePddRGtJPVy4HWIUuSVzMutnwcNVciwnzSo0vUmWW36A5WuZN35zmnSQu/tNM y+r4y9D40Ja0ET0nOVJxUlUN2L3wRb8IWQzwHxN7dQeREH2sfKugBVsabn+u0eZYqlos fFp/8RHgcZrxkm47xJc8lpdc/Q2KTlq0KBPS4= MIME-Version: 1.0 Received: by 10.60.30.70 with SMTP id q6mr1249452oeh.56.1330577586174; Wed, 29 Feb 2012 20:53:06 -0800 (PST) Received: by 10.182.19.104 with HTTP; Wed, 29 Feb 2012 20:53:06 -0800 (PST) In-Reply-To: <4F4EE0C0.1050302@php.net> References: <4F4EE0C0.1050302@php.net> Date: Wed, 29 Feb 2012 23:53:06 -0500 Message-ID: To: Sebastian Bergmann Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=e89a8ff1c6385eb92804ba273c48 Subject: Re: [PHP-DEV] Scalar Type Intentions From: adamjonr@gmail.com (Adam Jon Richardson) --e89a8ff1c6385eb92804ba273c48 Content-Type: text/plain; charset=ISO-8859-1 First, phpunit is a fantastic tool! I'm thankful for your contributions to all of the PHP community (especially with the code coverage capabilities.) I speak to your 2 points inline below: On Wed, Feb 29, 2012 at 9:36 PM, Sebastian Bergmann wrote: > On 02/29/2012 09:01 PM, Adam Jon Richardson wrote: > >> However, the aliases would allow developers to better communicate >> intentions AND provide more information for IDE's and static analyses >> tools. >> > > 1) You are trying to solve a social problem through technology. That > usually does not work. > I believe technology can provide effective tools for social problems, although I won't go so far as to say that it usually does work. More importantly, I believe programming is riddled with social problems: "Let us change our traditional attitude to the construction of programs. Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do." D. Knuth 2) What you want to achieve is already possible through docblocks. The greater part of the proposal rests on the general scalar hint. That said, I still believe the aliases for the scalars hold value. Sure, the communicative aspect of the aliases can be achieved through use of docblocks. However, in cognitive psychology and human factors research, proximity of relevant information plays a role in perception and processing, and I would posit that code with the type intentions displayed closer to the actual body of the function would hold benefits (this would be very testable, though, and research could prove me wrong.) When available, the scalar aliases could then be used to help auto-generate the docblocks. I would appreciate the scalar hinting, along with the aliases I outlined very much in my code. I believe that this form of hinting stays true to the PHP principles outlined in Richard's PHP Philosophy thread (a great read), and I believe it helps developers who want to better enforce (scalar hinting) and communicate (scalar aliases) the intentions of their code. Thank you for the feedback, Adam --e89a8ff1c6385eb92804ba273c48--