Re: Feauture request/proposal: import
| From: | Stig S. Bakken | Date: | Sun, 28 Oct 2001 00:08:00 +0000 |
| Subject: | Re: Feauture request/proposal: import | ||
| References: | 1 | Groups: | php.pear.dev php.pear.general |
| Request: | Send a blank email to pear-dev+get-2419@lists.php.net to get a copy of this message | ||
Hi Andreas,
Check Stanislav's package proposal on php-dev. I think he posted it one
or two weeks ago.
- Stig
Andreas Aderhold wrote:
>
> Hi All,
>
> What do you guys think of a import feauture for php. This allows developers
> to use packages and a package trees for including files. We're using a php
> written import for the binarycloud app framework with grat success. It's
> extremly handy, easy to use, clear and straight forward.
>
> We currently have the following syntax if we want to "include" a file.
>
> import("binarycloud.core.Request");
>
> The import method now does the following:
>
> Look up global import map,
>
> if package already included
>
> return
>
> else
>
> include(PACKAGE_BASE."/binarycloud/core/Request.php");
>
> Set "binarycloud.core.Request" => true in the global
>
> import map.
>
> The benefits are outstanding. You don't have to mess around with path names
> and the package-path's can be logically structured. Ok, you can achive this
> with include too, but import seems more flexibe and abstracted from the
> filesystem. So somehting like "binarycloud.db.Template" could be something
> within a database or ldap or whatever in the future.
>
> I don't know the interna of php but I think a native and basic
> implementation in C will be a matter of some hours because this is based on
> include.
>
> I thought of also having a php.ini setting like:
>
> import_bases=./:/path/to/base1:/path/to/base/2
>
> or something like that. The syntax itself should be the same as with
> include:
>
> import "package.File"; and
>
> import("package.File");
>
> This might also be interesting for PEAR to have a more clear structure:
>
> import php.pear.PEAR
>
> import php.pear.Cache
>
> ...
>
> The only "drawback" I currently see is that you can't use dots in filenames.
> But that's also useful for people who love it clear ;-)
>
> For the binarycloud implementation of import see:
>
> http://binarycloud.tigris.org/source/browse/binarycloud/r2/binarycloud/base/C¯
> G{›ñ$Ühþ«~}u
> init/prepend.php?rev=1.6&content-type=text/x-cvsweb-markup
>
> What do you think?
>
> Andi
>
> --
>
> www.thyrell.com
>
> a.aderhold@thyrell.com
>
> --
> PEAR Development Mailing List (http://pear.php.net/)
> To unsubscribe, e-mail: pear-dev-unsubscribe@lists.php.net
> For additional commands, e-mail: pear-dev-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net