Re: autoload with namespace



Larry Garfield wrote:
See, I'm working on a different approach for Drupal. We're actually scanning
our own code base and building up an index of all classes (and functions!) in
the system, saving that to the database, and then the autoload implementation
just polls the database for the file that needs to be loaded and loads it.
The class itself can literally live almost anywhere. There's some more code
on top of that for caching and routing optimization and such, but that's the
basic idea and it's actually looking really sweet. :-) It should be landing
in HEAD very soon.

This is actually very similar to another approach I'm taking too with my
projects.

I run "make" on the modules which takes several actions:
* Extracts strings for i18n and merge in to the .po files etc.
* Build up a list of what interfaces classes implement and/or what
classes they extend (because those base classes may implement an
interface(s) too!).

This parsed list of implementations is stored with the module (nothing
is enumerated to a DB at this stage).

In my code, as a module is loaded this list is also loaded and put into
an application wide structure.

This approach makes it incredibly simple to write Observer based design
patterns (e.g. you can ask the system for all classes that implement the
"ArticleSubmitted" interface - then instantiate or statically call as
appropriate). Modules can be turned off/disabled/uninstalled of course
and that means their implementation lists are not loaded and they will
not be called when an observable event occurs.

It's all very nice IMO and I certainly like working with it.

Col


.



Relevant Pages

  • Re: Getting a list of list permissions for WSS
    ... this on a backup copy of the database so you're not hitting the live DB. ... Now when you run the script and refresh the SPS Event List which this ... my departmental Event Lists roll-up flawlessly to a single Portal list. ...
    (microsoft.public.sharepoint.portalserver)
  • Re: The Sorrows of Record Cataloguing
    ... but the database ... needed was a list so that I wouldn't buy records or CDs over again. ... to see on the shelves and were in alpha-order by composer. ... recordings, there is an entirely different set of lists -- five lists, ...
    (rec.music.classical.recordings)
  • Re: Are you one of the EIGHT MILLION who will be arrested when Bush declares martial law in October?
    ... Called "Main Core," the database's origins date back to the 1980s when ... "There exists a database ... of Americans, who, often for the slightest and most trivial reason, ... called someone on those lists, you get added to the master list. ...
    (alt.politics)
  • www.CeBeans.com - new program listings - Dec 17 2007
    ... This program is a database of 24 Christmas/Holdiay tips for a safe season. ... This program is a database of 24 cooking email lists that you can subscribe ... The object of this game is to use your taser gun to shoot down the birds ... Free man every round after five. ...
    (microsoft.public.pocketpc)
  • re: Meta Wow SSHD has a hole and CERT put out a lot of good info in a very timely fashion.
    ... With assitance from the unpaid OpenSSH team CERT rapidly put out a throroughly ... comprehensive advisory to correct a some omissions in other posts on lists such ... You should upgrade to the latest and best codebase if at all possible. ... excellent and innovative code base that I can use to affordably make sure I ...
    (FreeBSD-Security)