Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56206 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87247 invoked from network); 9 Nov 2011 22:16:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Nov 2011 22:16:18 -0000 Authentication-Results: pb1.pair.com header.from=listas@rafaeldohms.com.br; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=listas@rafaeldohms.com.br; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain rafaeldohms.com.br from 74.125.82.54 cause and error) X-PHP-List-Original-Sender: listas@rafaeldohms.com.br X-Host-Fingerprint: 74.125.82.54 mail-ww0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:49090] helo=mail-ww0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AF/E1-02388-0BBFABE4 for ; Wed, 09 Nov 2011 17:16:16 -0500 Received: by wwi36 with SMTP id 36so1070600wwi.11 for ; Wed, 09 Nov 2011 14:16:12 -0800 (PST) MIME-Version: 1.0 Received: by 10.180.14.129 with SMTP id p1mr5124228wic.8.1320876972074; Wed, 09 Nov 2011 14:16:12 -0800 (PST) Received: by 10.180.94.103 with HTTP; Wed, 9 Nov 2011 14:16:11 -0800 (PST) In-Reply-To: References: <4EB81703.7030605@hoa-project.net> <4EB81C84.8010609@hoa-project.net> <4EB820BB.2030009@lsces.co.uk> <4EB822D4.4060306@hoa-project.net> <4EB89C36.5000503@garfieldtech.com> <4EB8A22B.8000607@lerdorf.com> <-4079824451837834664@unknownmsgid> Date: Wed, 9 Nov 2011 20:16:11 -0200 Message-ID: To: Anthony Ferrara Cc: Will Fitch , "internals@lists.php.net" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] SplClassLoader RFC Voting phase From: listas@rafaeldohms.com.br (Rafael Dohms) On Wed, Nov 9, 2011 at 2:03 PM, Anthony Ferrara wrote= : > Rafael > >> This makes life as a PHP developer much easier and having the standard> = "valued" by PHP by having a SplClassLoader that allows any library to> not = need to implement a autolaoder if no framework is present allows> for much = nicer "plug and play" interaction of libraries, less work for> their develo= pers and even less for the users. > > I would have to disagree here. =A0When I need to use a library or a > framework or whatever, I usually just bootstrap it and done. =A0So > instead of having to care about figuring out how to map the > namespaces, or place them appropriately, I just call the included > bootstrap.php in the library and it does the rest. =A0You can take a > peak at an example of that here: > https://github.com/ircmaxell/PHP-CryptLib/blob/master/lib/CryptLib/bootst= rap.php > You sort of prove my point here, as you actually have your own autoloader, which in case you are PSR compliant, you would not need, you can still use your bootstrap but no longer implement the class. Also bootstrapping is not a solution for smaller libraries that include one or 2 classes, having to code an autoloader for everything is redundant. And frankly having to make sure you do requires to get the loaders is something i would rather get rid of. The day i can code a whole application without a single require in it will be a blast. > If you're going for ease of use and interoperability, providing a > bootstrap file is going to be king to any autoloader/naming scheme. > Some libraries may have specific steps that it needs to do at startup > to work. =A0That's what a bootstrap is for. =A0Some libraries may need to > include and define functions or constants. =A0That's what a bootstrap is > for. This depends on the size of your library, bootstrapping might not be a requirement, and from what i see around its actually used very little. Anything needed is attached to your application or is done in the construct methods. > Remember, libraries are more than collections of classes. =A0They may > contain other things that autoloading just doesn't take care of. Libraries can be more the collections of classes, or they can be just collection of classes. Either way my comment was directed to both cases. > Sure, the thought of just being able to add it to an autoloader to > take care of including the library may suffice for 90% of use cases. > But it won't work (or won't work well) enough times that I'm not sure > if it's even worth trying to reach for that goal. > Thanks, > > Anthony Bootstrapping and autoloading are two parts of a process, having one done better does not exclude having the other in your library. So a see bootstrapping as a form of configuration and preparation, autoloading is merely a step that may or may not be in this. --=20 Rafael Dohms PHP Evangelist and Community Leader http://www.rafaeldohms.com.br http://www.phpsp.org.br