Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56210 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12279 invoked from network); 10 Nov 2011 02:23:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Nov 2011 02:23:47 -0000 Authentication-Results: pb1.pair.com smtp.mail=guilhermeblanco@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=guilhermeblanco@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.177 as permitted sender) X-PHP-List-Original-Sender: guilhermeblanco@gmail.com X-Host-Fingerprint: 209.85.216.177 mail-qy0-f177.google.com Received: from [209.85.216.177] ([209.85.216.177:38228] helo=mail-qy0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4A/31-04608-1B53BBE4 for ; Wed, 09 Nov 2011 21:23:46 -0500 Received: by qyk10 with SMTP id 10so44201qyk.8 for ; Wed, 09 Nov 2011 18:23:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=ogDXN/emRSuVX48VYgmhEhQCBKhDuQ0f/g0GZtOZv8A=; b=tUPTvsfYzvlWoB1AASROZ3FS3DKA0bJdeE84RV3DzXqCsjUY+jHjWGX54IgTXaePKs +z+j0VLhuPS6Cx4BnhVCOSB2Vy61VNtgzqD1980vfcUONnFsbKPVG2dXZbD6agrTtHVY aQFRUzngIWv6+MRJQMN/DZjl7ixEB1v2lGJMY= Received: by 10.182.2.225 with SMTP id 1mr1447280obx.30.1320891822093; Wed, 09 Nov 2011 18:23:42 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.221.71 with HTTP; Wed, 9 Nov 2011 18:23:21 -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: Thu, 10 Nov 2011 00:23:21 -0200 Message-ID: To: Rafael Dohms Cc: Anthony Ferrara , Will Fitch , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] SplClassLoader RFC Voting phase From: guilhermeblanco@gmail.com ("guilhermeblanco@gmail.com") Hi, @RDohms What you said is pretty valid. If you're not going to use it, you vote against it? You may not use it, but many others can. It's a true state. @Anthony I already heard your points many times. I know you're against it. I also know the voting should be reset, but before the reset, I wonder if we can at least keep some good conversation abut possible improvements instead of keep your opinion of being against it. Your vote is only one, like mine, but if it gets approved, are you satisfied with I purposed? If not, what are the improvement points? That's what I want to hear. @Internals I see many people supporting my idea, even after telling everyone after my RFC update to re-validate their votes. Some people have changed, like Peter Cowburn and I don't blame him. He is right. We should make it stable and then vote for it. My wish is that we should really reset and re-open the voting stage, but I want to make the RFC as consistent as possible. It looks like it's getting impossible to have an average talk on this mailing list due to the fact that people want to question about the minimum usage instead of helping me out to consolidate it to then allow people to give their opinions. This attitude only makes me lose a lot of time answering questions instead of focusing on actual RFC stability. I want to propose something stable, I do not want to be pressured about should the RFC exist or not. It only delays the real voting results. What I can do to address this? Thanks, On Wed, Nov 9, 2011 at 11:07 PM, Rafael Dohms w= rote: > On Wed, Nov 9, 2011 at 8:49 PM, Anthony Ferrara wro= te: >> On Wed, Nov 9, 2011 at 5:16 PM, Rafael Dohms = wrote: >>> On Wed, Nov 9, 2011 at 2:03 PM, Anthony Ferrara w= rote: >> >> I am not PSR compliant in either autoloader implementation or class >> implementation. =C2=A0The reason is that over time I have needed (and >> removed the need, but may in the future) need to use a class name as a >> reserved word. =C2=A0Something like XOR (which is a real example). =C2= =A0My way >> of solving that was to name the class X_OR to avoid the fatal syntax >> error. =C2=A0But I don't want it stored in /foo/bar/x/or.php. Which woul= d >> make absolutely no semantic sense. =C2=A0So I went with the alternative = of >> /foo/bar/x_or.php (which to me makes perfect sense). >> > > That is a problem in itself, as far as I know the final class name > does not do this kind of conversion on "_" but this is a naming issue > and i personally disgree with the solution, which is beside the point > and I will not comment. > >> And the autoloader I built is trivial. =C2=A0In fact, I don't use it >> everywhere (out of need). =C2=A0In fact, I can replicate it in 10 pretty >> lines of code (+1 for the comment): >> https://github.com/ircmaxell/PHP-CryptLib/blob/master/test/bootstrap.php= #L33 >> >> spl_autoload_register(function ($class) { >> =C2=A0 =C2=A0$nslen =3D strlen(__NAMESPACE__); >> =C2=A0 =C2=A0if (substr($class, 0, $nslen) =3D=3D __NAMESPACE__) { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0$path =3D substr(str_replace('\\', '/', $clas= s), $nslen); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0$path =3D __DIR__ . $path . '.php'; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0if (file_exists($path)) { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0require $path; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0} >> =C2=A0 =C2=A0} >> }); >> > > 10 lines, 1 or 30 is still duplicated code which could be left out and > lessen the onus on the developer. > >> The point is not that it's not possible, the point is that I have to >> worry about it. =C2=A0I need to look for it in docs, or when reading abo= ut >> it. =C2=A0The onus is put on the user to figure that out. =C2=A0Whereas = if I >> provide a bootstrap file, all I need to communicate is "just require >> that bootstrap file, and today and for all time forward you'll be >> fine". =C2=A0If you don't, and your needs change over time (due to featu= re >> additions, etc), the way you include libraries can change. =C2=A0Remembe= r, >> including a library isn't just about defining an autoloader for it... >> > > If i program by PSR (which is nothing out of the ordinary) i do not > need to worry about autoloading. If i need to worry about > bootstrapping, i'm worried with initializing, not finding and > including files. > >> But your comment is only applicable to class-only libraries. >> Otherwise defining an autoloader is quite simply not enough. =C2=A0You >> would then need to include the base functions/definition files. >> Whereas if you used a bootstrap file, it's abstracted away from you. >> > Its enough to load the class, what you put in bootstrapping is > initializing and i prefer libraries that don't initialize on include, > rather that initialize when initialized, that's what factories and > contruct methods or init methods are for.. not files that initialize > as soon as they are included. > >> I agree that bootstrapping and autoloading are distinct parts. =C2=A0But >> you're (by you, I mean most of the proponents of this RFC on this >> list) playing it off like they are the same. =C2=A0A big rationale behin= d >> including this is so that you can just distribute libraries and not >> have to worry about bootstraping or setting up. =C2=A0But you do need to >> worry about it. =C2=A0I'd MUCH rather see every single library include t= hat >> 10 line closure than the maintainability nightmare of upgrading a >> library to have mysterious things break because they changed the >> initialization process on me. =C2=A0And that doesn't even consider the f= act >> that including this in core will 100% solidify the behavior for the >> foreseeable future. =C2=A0So if a limitation or shortcoming is found (sa= y >> with the introduction of traits, or with a 5.5 or 6.0 feature), the >> implementation is still stuck here for BC reasons. =C2=A0Leave it in >> userland. =C2=A0Pear has done that for 12 years. =C2=A0Provide a common >> implementation that gets installed with PEAR (or pyrus) and then just >> require that as a dependency. =C2=A0It's worked this far, so why such a >> push to change it...? >> >> >> Additionally, take a look at Python. =C2=A0Python makes including a libr= ary >> *dirt* simple. =C2=A0Why? =C2=A0Is it because it provides you with an >> autoloader? =C2=A0Not at all (It's import method is used instead of an >> autoloader, but it's distinctly different in both concept and >> function). =C2=A0But it's also because it provides a transparent bootstr= ap >> (the weird __init__.py file). =C2=A0Loading classes is only half the >> battle. =C2=A0Others have solved this problem, don't ignore what they ha= ve >> done... >> > > So initializing has nothing to do with autoloading, furthermore, > autoloading should neither do nor trigger anything else other then > making the namespace available. > > I'm not a PSR proposer, nor a framework leader, i'm a simple user who > has seen the benefit of the PSR and an autoloader, and what this > suggestion could do to library and class developers out there. Its a > standard, not everyone has to use it, like so many things in PHP which > are not used, but its common ground for most to be able to follow, and > that makes my life easier. > > So we should agree to disagree on this one, cause bootstrapping to me > a whole separate thing which does not have to do with autoloading. To > your example, does import in python initialize or simply make > available? > > Now if you want to add another layer of bootstrapping with a > __init__.php file.. that is something to talk about (i don't like it > though), but again.. it does not invalidade the presence of a Standard > Loader that would simplify the life of some large % of users and > developers. > > -- > Rafael Dohms > PHP Evangelist and Community Leader > http://www.rafaeldohms.com.br > http://www.phpsp.org.br > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 Guilherme Blanco Mobile: +55 (11) 8118-4422 MSN: guilhermeblanco@hotmail.com S=C3=A3o Paulo - SP/Brazil