Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:50669 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76085 invoked from network); 28 Nov 2010 17:24:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Nov 2010 17:24:06 -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.42 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.42 mail-qw0-f42.google.com Received: from [209.85.216.42] ([209.85.216.42:44151] helo=mail-qw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 73/A0-07352-53092FC4 for ; Sun, 28 Nov 2010 12:24:05 -0500 Received: by qwh6 with SMTP id 6so1329603qwh.29 for ; Sun, 28 Nov 2010 09:24:03 -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=tAjbCFmBcbeJrU8UJOtk7MJSKUGwOWySKZaYNKocw7U=; b=F66HGBfiXZIf+8cfoceuIhrtmbaI6x2yRvV61SYLyN9ezHMbh8RYbQtOGbIZ109OP8 w+fb7IegLNsRgthD2pZVeJdodoxMhU+VcpGdTSanU1w8ilyrq5T25X2qKtcAYX9jduPB oX6thxbT2ToLXmhkiiVrDNAAwcKZxVVRR/S98= 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=t2Ajr+SDcsynbpsCnakyDscnda8fpWk9bprB3V90VmjONICYqFpbSLdoZ4Xq5BtEey WaiEi1LmBCqKvrMzPRy//ja92DvKQldfDFw4Bz5WhqTIl21mwjdHC3Mw1H/l06C7yrqi pyz+tmXxzqAThlWsucV0xw/ZecusAU2QKic8I= MIME-Version: 1.0 Received: by 10.229.95.193 with SMTP id e1mr3997722qcn.277.1290965042761; Sun, 28 Nov 2010 09:24:02 -0800 (PST) Sender: dallasg@gmail.com Received: by 10.220.178.67 with HTTP; Sun, 28 Nov 2010 09:24:02 -0800 (PST) In-Reply-To: <4CF28CFC.2060204@gmail.com> References: <1290879624.7033.826.camel@guybrush> <4CF27AAC.9010704@divbyzero.net> <4CF28CFC.2060204@gmail.com> Date: Sun, 28 Nov 2010 12:24:02 -0500 X-Google-Sender-Auth: mtdZzjQbbqeslNplJaeznI2R8fk Message-ID: To: =?ISO-8859-1?Q?=C1ngel_Gonz=E1lez?= Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=0016368325acca933f049620385c Subject: Re: [PHP-DEV] RFC: Making T_FUNCTION optional in method declarations From: dallas@gutauckis.com (Dallas Gutauckis) --0016368325acca933f049620385c Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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 function= s, > > 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 tells 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 majorit= y of code is (or should be) poorly maintained/documented. Below is simply bad programming practice in many ways. No validation of typ= e (neither through type-hinting nor an instanceof check) is done, which is wh= y the code is so difficult to trace back. Presumably, you'd also have some form of documentation (PHPDoc, anyone?) that would facilitate the search fo= r the declaration of that function. Again, that assumes a better programming practice than is being provided as the example below. One would hope that someone excluding their function keyword would also be "up to date" enough to be validating objects. > function baz( $param ) { > $param->morlocks(); > } > > --0016368325acca933f049620385c--