Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:44362 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84418 invoked from network); 18 Jun 2009 18:31:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jun 2009 18:31:55 -0000 Authentication-Results: pb1.pair.com smtp.mail=guilhermeblanco@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=guilhermeblanco@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.210.189 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: guilhermeblanco@gmail.com X-Host-Fingerprint: 209.85.210.189 mail-yx0-f189.google.com Received: from [209.85.210.189] ([209.85.210.189:52309] helo=mail-yx0-f189.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A1/38-08167-9188A3A4 for ; Thu, 18 Jun 2009 14:31:54 -0400 Received: by yxe27 with SMTP id 27so103586yxe.29 for ; Thu, 18 Jun 2009 11:31:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=4kzeW+cSsKkv+kulGcsiBL3sa94+8pPGiEFpGFW4grg=; b=xrErX3stygJRdvECInxo6bzgNu5D8L5k6JPkicogk327z+zKjC2/GcEsUO81XBabNA oGB+PKtWv55WnykhlUzESeJUSBMHC79O+dHHHgUfb2ZoJN+m0LA6bNnmPgpD+x9METSs lkv0BOzTazL9kjZOBQYcN457omd9eoWYGr2Og= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=L2SrvdothpkynPYKYknpbr6c/OIARldKivhfP/SL1NxYx37lRZ1upGfR/+OB5HeU6M t9nJKqsM1ti3gFpjdjiPKtpo5BnGrBQfMbxsy/6x9FQu4xooskAiiyuhWH6nvyEZsu23 mtZmDa1jUqzL7nHxpwGd2dqs0ZN0ZCP8svcMA= MIME-Version: 1.0 Received: by 10.231.37.68 with SMTP id w4mr596357ibd.33.1245349910354; Thu, 18 Jun 2009 11:31:50 -0700 (PDT) In-Reply-To: <2dedb8a0906180857x28c851c8j9b334c3721da561d@mail.gmail.com> References: <2dedb8a0906180857x28c851c8j9b334c3721da561d@mail.gmail.com> Date: Thu, 18 Jun 2009 15:31:50 -0300 Message-ID: To: Kalle Sommer Nielsen Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [PATCH] Inclusion of new constant: NS_SEPARATOR From: guilhermeblanco@gmail.com (Guilherme Blanco) Actually... on finnish keyboard on mac... 3 (Shift + Alt + 7). =3DP I don't know if there's another constant to it... that's my first patch eve= r! 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! =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 =C2=A0 =C2=A0 =C2=A0 12 Jan 2009 21:54:37 -000= 0 >> 1.71.2.5.2.7.2.17 >> +++ Zend/zend_constants.c =C2=A0 =C2=A0 =C2=A0 18 Jun 2009 15:29:52 -000= 0 >> =C2=A0-151,6 +151,13 @@ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0c.value.type =3D = IS_BOOL; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0zend_register_con= stant(&c TSRMLS_CC); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0} >> + >> + =C2=A0 =C2=A0 =C2=A0 /* Namespace separator constant */ >> + =C2=A0 =C2=A0 =C2=A0 static char nssep_str[2]; >> + =C2=A0 =C2=A0 =C2=A0 nssep_str[0] =3D '\\'; >> + =C2=A0 =C2=A0 =C2=A0 nssep_str[1] =3D '\0'; >> + >> + =C2=A0 =C2=A0 =C2=A0 REGISTER_MAIN_STRING_CONSTANT("NS_SEPARATOR", nss= ep_str, >> CONST_PERSISTENT | CONST_CS); >> =C2=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=C3=A3o 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 > --=20 Guilherme Blanco - Web Developer CBC - Certified Bindows Consultant Cell Phone: +55 (16) 9215-8480 MSN: guilhermeblanco@hotmail.com URL: http://blog.bisna.com S=C3=A3o Paulo - SP/Brazil