Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:41763 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47952 invoked from network); 7 Nov 2008 19:41:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Nov 2008 19:41:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=indeyets@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=indeyets@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.198.230 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: indeyets@gmail.com X-Host-Fingerprint: 209.85.198.230 rv-out-0506.google.com Received: from [209.85.198.230] ([209.85.198.230:42437] helo=rv-out-0506.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4B/6C-02726-BD994194 for ; Fri, 07 Nov 2008 14:41:15 -0500 Received: by rv-out-0506.google.com with SMTP id g37so1322855rvb.23 for ; Fri, 07 Nov 2008 11:41:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=VexkVniRVmyUAWNgvEaPc4ljR/OFspTH8P55Mjk0lLs=; b=K98eMMWUcK4eHjCwcXnDWtyQj8cq1gQgR6ksIkHh6V5yZO7l4gJ+2jpdOQ0gY+UIc3 EPNB8dDNrGeVApz0uQXycRf8MyJqOD8KqIUiCjoqv3deW5h/iq+VDENaxsMReZZaS5N8 CdSUyQajuU1uIL0PMlfUfZAXNHWxZrG7hJixg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=bg+BEAhHRC5BMKiUHouLAJHW4U2dJzcWBr1Aux1SoM7q2eCIMIrd/ocjwlfFAz2c+s HO0SYULKh3eI4YE0GGWJb9BhbKfC2Br6Ap/FD0Dddw1C33+1xwivsP4pA46qhB9U9SO6 F9PyI2Y1bt4rhEjzfdjwWpKRNaZmfk+hupXPI= Received: by 10.141.146.4 with SMTP id y4mr1971598rvn.88.1226086872511; Fri, 07 Nov 2008 11:41:12 -0800 (PST) Received: by 10.140.133.15 with HTTP; Fri, 7 Nov 2008 11:41:12 -0800 (PST) Message-ID: Date: Fri, 7 Nov 2008 22:41:12 +0300 To: "Stan Vassilev | FM" Cc: internals@lists.php.net In-Reply-To: <8958389FB3694464893373C7263C2EBC@pc> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4EA88C3A8A2747989925A5D21448FCE7@pc> <491333F2.5070105@zend.com> <91597FF883CD4BA3861A5C72134BCA56@pc> <4913C1CF.3070305@gmail.com> <1226042871.4679.23.camel@goldfinger.johannes.nop> <4913F642.6090703@invisihosting.com> <8958389FB3694464893373C7263C2EBC@pc> Subject: Re: [PHP-DEV] Call it: allow reserved words in a class or not? From: indeyets@gmail.com ("Alexey Zakhlestin") On Fri, Nov 7, 2008 at 7:24 PM, Stan Vassilev | FM wrote: >> What about adding a function that behaves like __autoload, but with >> respect to namespace wildcards? Something like: > > Hi, > > Ok so first: > > 1) We can't implement wildcards since a wildcard needs to be expanded to a > set of concrete classes at runtime for it to make sense, and we don't know > what those classes are (due to autoloads and "conditional" require/include > constructs). > > 2) There can't be a method to resolve wildcards, since namespaces currently > work 90% at the parse level, before any PHP code has executed. This is > required for good performance and simplicity. > > 3) I have emailed Greg a simple idea for solving this with a INI-like "meta" > namespace file, a simple file we can put in our include path, which > describes the resources of a namespace and optionally their location. > > For example let's say you have namespace My\Name\Space, and inside you have > classes "Foo", "Bar", functions "baz" and constants ONE, TWO. In one of your > include paths, you'll create a file called "My.Name.Space.nsmeta" and put > the following inside: > > class Foo = "path\to\Foo.class.php" > class Bar = "path\to\Bar.class.php" > function baz = "path\to\baz.func.php" > const ONE = "\path\to\constants.php" > const TWO = "\path\to\constants.php" > > This file you can generate from your framework, or even write by hand, as > you see it's very simple to write/read, and tokenizes with the existing PHP > tokenizer. Sounds like an idea for custom extension, but I doubt this would work as a general approach. It limits dynamic nature of php, so won't be suitable for all cases Did you see this extension? http://pecl.php.net/package/automap > Since this file will be read at parse time, it has the ability to solve the > following problems: > > 1) zero-performance-impact namespace wildcards (especially with an opcode > cache like APC, XCache etc.) > 2) faster resource loading (PHP can autoload resources from the location map > above without you writing a slow __autoload runtime procedure) > 3) you can load on demand now any namespace resources: class, functions, > constant, not just classes. > > Naturally this is not for 5.3 as we all want 5.3 stable and out as soon as > possible. But it has the potential to simplify drastically some workflows, > especially in large complex frameworks, so if it picks up, maybe 5.4, or 6 > or who knows. > > Regards, > Stan Vassilev > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Alexey Zakhlestin http://blog.milkfarmsoft.com/