Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:50987 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 59138 invoked from network); 10 Dec 2010 01:25:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Dec 2010 01:25:08 -0000 Authentication-Results: pb1.pair.com header.from=dmgx.michael@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=dmgx.michael@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: dmgx.michael@gmail.com X-Host-Fingerprint: 74.125.82.170 mail-wy0-f170.google.com Received: from [74.125.82.170] ([74.125.82.170:63631] helo=mail-wy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C9/C2-39391-171810D4 for ; Thu, 09 Dec 2010 20:25:06 -0500 Received: by wyb39 with SMTP id 39so2971955wyb.29 for ; Thu, 09 Dec 2010 17:25:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=F96gjt+/EjjvQL5Zc1IJtICO5mV0HVV/8hJclgqVtiM=; b=s1X1m5n6e4RrsL/Q8/3IZlrmbEjjhtHdqHlLGRqw5Ot40rSjMrNecPVyYc3TyxAtnq 0ogp/LS4/AG669/AzL3VoZb4hH5P49IxEFb9VS1418elnzHnkijErqrPEqOJU6NwbVBL JtmIku8N8rKX5uhK4Y0ZJKPgd/d7nVlT8bS2w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=DbG9bIdNHsJmb54761YbdKV4TRyczLoUWoHz8XvvVvY0J8KX/ST8LRbFeATntPwvIg i6TGvz4YAcX0APiJsJV9p7N8welra3LdlWF36U9TIeUw8Wef29qgbAoc5HyKUT9SnXH/ J/d894S41WuNVfil2gpXF3+SMOUFLwNlxY92E= MIME-Version: 1.0 Received: by 10.216.163.15 with SMTP id z15mr166439wek.85.1291944302485; Thu, 09 Dec 2010 17:25:02 -0800 (PST) Received: by 10.216.45.148 with HTTP; Thu, 9 Dec 2010 17:25:02 -0800 (PST) Date: Thu, 9 Dec 2010 20:25:02 -0500 Message-ID: To: PHP Internals List Content-Type: multipart/alternative; boundary=0016e65b65a838218d049704397f Subject: [PHP-DEV] RFC: Selecting Namespaces and Tag styles at include time. ( was Re: PHP Dev RFC Selecting Namespaces and Tag styles at include time.) From: dmgx.michael@gmail.com (Michael Morris) --0016e65b65a838218d049704397f Content-Type: text/plain; charset=ISO-8859-1 Forgive me - it's been a *long* time since I've used a listserv, and I'm still getting the hang of getting the message tags exat. Reposting for those who may have missed this because I got the exact format of the tags wrong the first time around. On Thu, Dec 9, 2010 at 3:53 PM, Michael Morris wrote: > Been pointed this way by some folks that this is the place to set > suggestions on changes to the functions or language. I have two at the > moment, and that is to the including functions (include, require, > include_once, require_once). They need to be considered separately as they > address two different problems. > > Tag Selection at include. > First is the problem of short tags and they aren't being widely used > because of the problems they cause for XML files. > > Why not allow the tag type to be chosen at file include? This should bypass > the objections seen in http://wiki.php.net/rfc/shortags > > The parameter would be set by a constant. > > Val Constant Effect > 0 PHP_TAGS_INI Use the ini setting. Default. > 1 PHP_TAGS_STANDARD Use standard PHP tags. > 2 PHP_TAGS_SHORT Use PHP short tags. > 3 PHP_TAGS_NONE No tags allowed in file, parse as PHP. > 4 PHP_TAGS_SCRIPT Script tags > 5 PHP_TAGS_ASP ASP style tags <% %> > > PHP_TAGS_NONE is suggested as a possible bonus mode this approach allows > that wouldn't be feasible otherwise. In this mode the engine treats the > whole file as PHP and doesn't allow mode switching. This might allow the > engine to parse the file faster. Importantly it would allow framework > designers to enforce that certain files not have HTML in them - such as a > database class, or a custom child class. Admittedly it doesn't stop > echo'ing the html, but it drives home the point to all but the densest that > perhaps this isn't the place to be printing/echoing. It's use would > encounter the problem of current IDE tools assuming that a PHP file will > always have a starting > The tag method selected affects the file being included only, so tag modes > that are undesirable in some circumstances - short tags - can be segregated > from those circumstance. > > > Namespace Defined At Include. > This addresses a separate problem from the above, but involves the same > functions - though it might be better to have another rather than a new > parameter on the include statements. The problem is that files always > include to the global namespace, then need to defined their namespace. This > behavior is undesirable with PHP template files and putting a namespace tag > at their start is clumsy at best. Two solutions are proposed - they aren't > exclusive to each other. > > Solution 1. Allow Namespace to be declared as file is included. > Hence > > include('file.php', __NAMESPACE__); > > Would include the code in file.php into the current namespace. If file.php > declares a namespace, then that namespace becomes a sub namespace. > > Solution 2. New function to set target namespace. > > setIncludeNamespace( __NAMESPACE__ ); // will set current namespace as the > default files include into. > > Both could be adopted. > > Ok, that's all. > --0016e65b65a838218d049704397f--