Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:44359 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98939 invoked from network); 18 Jun 2009 15:57:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jun 2009 15:57:09 -0000 Authentication-Results: pb1.pair.com header.from=kalle.php@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=kalle.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.220 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: kalle.php@gmail.com X-Host-Fingerprint: 209.85.220.220 mail-fx0-f220.google.com Received: from [209.85.220.220] ([209.85.220.220:59113] helo=mail-fx0-f220.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BE/25-08167-3D36A3A4 for ; Thu, 18 Jun 2009 11:57:08 -0400 Received: by fxm20 with SMTP id 20so1395605fxm.23 for ; Thu, 18 Jun 2009 08:57:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=4SYpU6vt/R90vo+mHR4MZGjlD0PaUiautdQ55Cxh0fg=; b=KaZ96KdoJ95ibtJw7re9kZK42Pz/Nd+qe/lO38qsNzRDIYKim3vPds8C1GiYVK73cb rsF46uA/jx0ZO9S51yXTh2Ppc6uxUR5C48LGiZzmsb5tJKRnoVhLTlcVVEQhhIxCdnoM /U8T7H7Hu2JPhto3ACtAuS/SPwEhX9OzEXEu0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=sSbkpfUtlMVaP+NC7lrNbPnURm4eGLzq2FuXuULH7sihAb/dPZ0EKL1CxM7fPUupMY FTZSLx/j6UZmiluS8b2aoJ7Ve64Qw8Eyep73DVsk6wq02KadzAKAqXFrec/3D3u5945u lzYnXvqIBNZzzYsDpo8IGRfmkVpZqsSppB1cY= MIME-Version: 1.0 Sender: kalle.php@gmail.com Received: by 10.86.36.11 with SMTP id j11mr2146039fgj.56.1245340621063; Thu, 18 Jun 2009 08:57:01 -0700 (PDT) In-Reply-To: References: Date: Thu, 18 Jun 2009 17:57:01 +0200 X-Google-Sender-Auth: 2ee387cb8404b5ab Message-ID: <2dedb8a0906180857x28c851c8j9b334c3721da561d@mail.gmail.com> To: Guilherme Blanco Cc: PHP internals Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [PATCH] Inclusion of new constant: NS_SEPARATOR From: kalle@php.net (Kalle Sommer Nielsen) Hi Guilherme 2009/6/18 Guilherme Blanco : > Hi guys, > > > First of all, don't laugh! =3DD > > 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 =3D '\\' . $dynamic_class_name . '\\' . $blah; than: $ns =3D 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 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > 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 =A0 =A0 =A0 12 Jan 2009 21:54:37 -0000 > 1.71.2.5.2.7.2.17 > +++ Zend/zend_constants.c =A0 =A0 =A0 18 Jun 2009 15:29:52 -0000 > =A0-151,6 +151,13 @@ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0c.value.type =3D IS_BOOL; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0zend_register_constant(&c TSRMLS_CC); > =A0 =A0 =A0 =A0} > + > + =A0 =A0 =A0 /* Namespace separator constant */ > + =A0 =A0 =A0 static char nssep_str[2]; > + =A0 =A0 =A0 nssep_str[0] =3D '\\'; > + =A0 =A0 =A0 nssep_str[1] =3D '\0'; > + > + =A0 =A0 =A0 REGISTER_MAIN_STRING_CONSTANT("NS_SEPARATOR", nssep_str, > CONST_PERSISTENT | CONST_CS); > =A0} 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=E3o Paulo - SP/Brazil > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 regrads, Kalle Sommer Nielsen kalle@php.net