Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:50670 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77771 invoked from network); 28 Nov 2010 17:29:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Nov 2010 17:29:05 -0000 Authentication-Results: pb1.pair.com header.from=dallasg@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=dallasg@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: dallasg@gmail.com X-Host-Fingerprint: 209.85.216.170 mail-qy0-f170.google.com Received: from [209.85.216.170] ([209.85.216.170:41390] helo=mail-qy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E0/F0-07352-16192FC4 for ; Sun, 28 Nov 2010 12:29:05 -0500 Received: by qyk10 with SMTP id 10so6784973qyk.8 for ; Sun, 28 Nov 2010 09:29:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=FnbNw/ZvfevFnzlUNTqdgnkF1uiFP4y17XT6Y42LpS0=; b=Yc+0pSvr5Vz7ROM+3NVG0CcQ9hZgE7KxutSwSWJhrg+snEwnf7gJ1KTAxk2pSvlpv0 Amh8b7ZGzG4mqhQ4K7TXtAP+V+m3qgFPXclSPocfnae6+tZSqSvpLhL0JzSP53Is1dmc L8FnLsitF88PK08fjgOuU0B9HSgJJDy6HRZV4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=We2nNfBeXxBta/i9MBo0Rh7+Zh0AesdbrWysiUEaKngz7Ws0vLlkvHJ7DhUwtpfIwe El8Vv1d78PL49PSnB8p8iiiZudrtKyaJfd0i9wfq2O8L0dwM62GoXwvu/IJVeZH+DIue v8qtj9DO1j/37smKqvGX8XHhXkq/UzZ1wHob4= MIME-Version: 1.0 Received: by 10.229.181.74 with SMTP id bx10mr4063857qcb.163.1290965342417; Sun, 28 Nov 2010 09:29:02 -0800 (PST) Sender: dallasg@gmail.com Received: by 10.220.178.67 with HTTP; Sun, 28 Nov 2010 09:29:02 -0800 (PST) In-Reply-To: References: <1290879624.7033.826.camel@guybrush> <4CF27AAC.9010704@divbyzero.net> <4CF28CFC.2060204@gmail.com> Date: Sun, 28 Nov 2010 12:29:02 -0500 X-Google-Sender-Auth: 7SjwlRtGNsJI5kchGBfoGO-Ok5w Message-ID: To: =?ISO-8859-1?Q?=C1ngel_Gonz=E1lez?= Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=00163630e869a6f42b0496204acd Subject: Re: [PHP-DEV] RFC: Making T_FUNCTION optional in method declarations From: dallas@gutauckis.com (Dallas Gutauckis) --00163630e869a6f42b0496204acd Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Oh, and I haven't +1 or -1'd. I write in many languages, some of which don't have method keywords (like Java: public void doSomething()) and some of which do (like PHP: public function doSomething()). I trip up whenever I switch between languages, and it's in both directions. Ultimately, I feel the keyword is rather useless from a readability standpoint. The only advantage is for searching (again, moreso on functions than methods) but still, the argument is there. 2010/11/28 Dallas Gutauckis > > > 2010/11/28 =C1ngel Gonz=E1lez > > Dallas Gutauckis wrote: >> > Just to be clear, this works on the assumption that we don't know the >> class >> > name that the function resides in? >> > >> > I understand the search argument, but to me it only applies to >> functions, >> > not methods. Is anyone arguing for removing the T_FUNCTION requirement >> on >> > functions? >> >> Even knowing the class you are calling, and assuming the common >> convention of >> one file per class, you may not know in which file is it implemented. >> It's annoying >> to go into the class, find out it's not there, grep the parent class, >> and having to >> repeat the process three or four levels up. >> Whereas with a unique enough name, grepping the functions get all the >> possible >> implementations. >> >> Plus, it's not always easy to know in which class to look something :-) >> >> > I understand the concern from above, but I don't agree with it > fundamentally. The kind of practice suggested by this search mechanic tel= ls > me that either there is lack of or little documentation, and lack of or > little understanding of the codebase in which the code resides thereby > making this argument flawed based solely on the assumption that the major= ity > of code is (or should be) poorly maintained/documented. > > Below is simply bad programming practice in many ways. No validation of > type (neither through type-hinting nor an instanceof check) is done, whic= h > is why the code is so difficult to trace back. Presumably, you'd also hav= e > some form of documentation (PHPDoc, anyone?) that would facilitate the > search for the declaration of that function. Again, that assumes a better > programming practice than is being provided as the example below. One wou= ld > hope that someone excluding their function keyword would also be "up to > date" enough to be validating objects. > > >> function baz( $param ) { >> $param->morlocks(); >> } >> >> > --00163630e869a6f42b0496204acd--