Re: Embedded example code

From: Date: Thu, 28 Mar 2002 20:33:12 +0000
Subject: Re: Embedded example code
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-5131@lists.php.net to get a copy of this message
First, shouldn't it be My_Class::__example(); with 2 underscores? This could create problems, and all magic functions for PHP classes currently follow the 2 underscore rule. Second, what would the point be? Usually, I look for actual documentation outside the source code before digging through and finding it. If anything, we simply create a bunch of echo's in the function, and $class->example(). Maybe I am missing the point, but it also leads to other potential problems, like leaving the class in the document root. Rather, I would like to see Oject Overloading in PHP (actually, an installed by default overload() function that is complete and not still in development.) Frankly, its a nice thought, but not practical. Jason Lotito PHP Developer's Network www.devnetwork.net ----- Original Message ----- From: "Richard Heyes" <richard@phpguru.org> To: "Pear-Dev" <pear-dev@lists.php.net> Sent: Thursday, March 28, 2002 2:40 PM Subject: [PEAR-DEV] Embedded example code > Saw Jon Parise post on the engine2 list regarding example/test code embedded > in class files. Thought this could be useful here. > > For example: > > class My_Class { > > ... > > function example(){ > // ...example code > } > } > > if(basename($HTTP_SERVER_VARS['PHP_SELF']) === basename(__FILE__)){ > My_Class::example(); > } > > Any thoughts regarding it? Possible problems I see are: > > o Unnecessary code loaded > o Issues when pear directory is inside document root > > -- > Richard Heyes > "If you have any trouble sounding condescending, > find a Unix user to show you how it's done." - Scott Adams > > > -- > PEAR Development Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.pear.dev (#5131) next »