Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:44363 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85782 invoked from network); 18 Jun 2009 18:35:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jun 2009 18:35:27 -0000 Authentication-Results: pb1.pair.com header.from=jani.taskinen@sci.fi; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=jani.taskinen@sci.fi; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain sci.fi from 204.13.248.71 cause and error) X-PHP-List-Original-Sender: jani.taskinen@sci.fi X-Host-Fingerprint: 204.13.248.71 mho-01-ewr.mailhop.org Received: from [204.13.248.71] ([204.13.248.71:62106] helo=mho-01-ewr.mailhop.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2F/78-08167-EE88A3A4 for ; Thu, 18 Jun 2009 14:35:27 -0400 Received: from cs181029147.pp.htv.fi ([82.181.29.147] helo=[127.0.0.1]) by mho-01-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1MHMSI-000CtH-S0; Thu, 18 Jun 2009 18:35:23 +0000 X-Mail-Handler: MailHop Outbound by DynDNS X-Originating-IP: 82.181.29.147 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/mailhop/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX18c6yiMtiIHtep3lY5NK/hVxigPvNVLBXw= Message-ID: <4A3A88E7.300@sci.fi> Date: Thu, 18 Jun 2009 21:35:19 +0300 Reply-To: jani.taskinen@iki.fi User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Guilherme Blanco CC: Kalle Sommer Nielsen , PHP internals References: <2dedb8a0906180857x28c851c8j9b334c3721da561d@mail.gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [PATCH] Inclusion of new constant: NS_SEPARATOR From: jani.taskinen@sci.fi (Jani Taskinen) On a PC (finnish layout) it's 2. AltGr + ? :) And it's not a big deal, people like me are quite used to doing that. People with Macs should be used to weird key combinations anyway. :D --Jani Guilherme Blanco kirjoitti: > Actually... on finnish keyboard on mac... 3 (Shift + Alt + 7). =P > > I don't know if there's another constant to it... that's my first patch ever! > Anyway... let's see other's opinions. > > Cheers, > > On Thu, Jun 18, 2009 at 12:57 PM, Kalle Sommer Nielsen wrote: >> Hi Guilherme >> >> 2009/6/18 Guilherme Blanco : >>> Hi guys, >>> >>> >>> First of all, don't laugh! =D >>> >>> The idea and patch are extremely simple. >>> Based on recent experiments with Namespaces and FQCN thing I spoke >>> with Johannes a couple of days ago, I decided to dive into source and >>> try a possible patch. >>> That's my first attempt to contribution to internals. Mainly I try to >>> help on PHP side. >> I don't think we should introduce a new special constant for this, >> seems sort of useless to me, I know theres issues with FQCN, but I'll >> rather write: >> >> $ns = '\\' . $dynamic_class_name . '\\' . $blah; >> >> than: >> $ns = NS_SEPARATOR . $dynamic_class_name . NS_SEPARATOR . $blah; >> >> so im a -1 for introducing this in PHP, even though im using a danish >> keyboard that doesn't have \, but thats not a reason not to press 2 >> buttons at once, that you're already used to if you code. >> >>> The idea is to create a new global constant NS_SEPARATOR to be used. I >>> know constants are used to represent internal values or values that >>> differ between different OS's, but the main idea here is to prevent >>> possible issues from user land and also to help people that do not >>> have "\" key in their keyboard (like finnish keyboards). >>> Here is a clear usage of this new constant: >>> http://www.php.net/manual/en/language.namespaces.dynamic.php#91552 >>> >>> I don't really know if the file is the right one to have this >>> constant, but it works for me perfectly. >>> >>> >>> Index: Zend/zend_constants.c >>> =================================================================== >>> RCS file: /repository/ZendEngine2/zend_constants.c,v >>> retrieving revision 1.71.2.5.2.7.2.17 >>> diff -u -r1.71.2.5.2.7.2.17 zend_constants.c >>> --- Zend/zend_constants.c 12 Jan 2009 21:54:37 -0000 >>> 1.71.2.5.2.7.2.17 >>> +++ Zend/zend_constants.c 18 Jun 2009 15:29:52 -0000 >>> -151,6 +151,13 @@ >>> c.value.type = IS_BOOL; >>> zend_register_constant(&c TSRMLS_CC); >>> } >>> + >>> + /* Namespace separator constant */ >>> + static char nssep_str[2]; >>> + nssep_str[0] = '\\'; >>> + nssep_str[1] = '\0'; >>> + >>> + REGISTER_MAIN_STRING_CONSTANT("NS_SEPARATOR", nssep_str, >>> CONST_PERSISTENT | CONST_CS); >>> } >> This is most likely to break the Windows build without looking at the >> code any closer because of the declaring, just use: >> REGISTER_MAIN_STRING_CONSTANT("NS_SEPARATOR", ZEND_NS_NAME, >> CONST_PERSISTENT | CONST_CS); >> >> (I think it was ZEND_NS_NAME for the seperator) >> >>> >>> >>> Cheers, >>> >>> -- >>> Guilherme Blanco - Web Developer >>> CBC - Certified Bindows Consultant >>> Cell Phone: +55 (16) 9215-8480 >>> MSN: guilhermeblanco@hotmail.com >>> URL: http://blog.bisna.com >>> São Paulo - SP/Brazil >>> >>> -- >>> PHP Internals - PHP Runtime Development Mailing List >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >>> >> >> >> -- >> regrads, >> >> Kalle Sommer Nielsen >> kalle@php.net >> > > >