namespace separator poll, update

php.internals

Oliver Grätz

20 years ago
Hi *! I updated the table with the comments in the thread. First of all: YES, these won't work as operator: - "<-" means "less than the negative value of" - ":" collides with the ternary BUT the discussion is not only about possibility but also about what you would like. The ":" for example would work if mandatory whitespace would be introduced for the ternary BUT this is very very bad. Regarding the other suggestions, ":::" seems to be something almost everybody could at least live with. OLLi Updated table follows:

Sara Golemon

20 years ago
> Sara Golemon |-| | | +1 | | | | | | > | | | | | | | | >
To flesh-out my overall vote: %% -2 ( : ) {whitespace}":"{whitespace} -2 ::: Shalosh Nekudotayim +2 ::< Paamayim Nekudotayim-LessThan -1 :< Sad-Smiley -2 (<- ) "<-"{whitespace} -2 :> Goofy-Smiley -2 \ Backslash -2*10^100 -> T_OBJECT_OPERATOR -2 \\ Double Backslash -2*10^100 <:: LessThan-Paamayim Nekudotayim +0 <: Back-Goofy-Smiley -2 .. Short Elipsis -1 Other possibilities: ** Double-Star +2 ;; Double-Semicolon +2
>>> Reverse Heredoc Operator -1
?? Double Question -1 -Sara

Ian P. Christian

20 years ago
%% -2 ( : ) {whitespace}":"{whitespace} +2 ::: Shalosh Nekudotayim +1 \ Backslash -2*10^100 \\ Double Backslash -2*10^100 ** Double-Star -2 ;; Double-Semicolon -2
-- Ian P. Christian ~ http://pookey.co.uk

Marcus Börger

20 years ago
Hello Sara, Monday, November 28, 2005, 12:02:43 AM, you wrote:
>> Sara Golemon |-| | | +1 | | | | | | >> | | | | | | | | >> > To flesh-out my overall vote:
> %% -2 > ( : ) {whitespace}":"{whitespace} -2 > ::: Shalosh Nekudotayim +2 > ::< Paamayim Nekudotayim-LessThan -1 > :< Sad-Smiley -2 > (<- ) "<-"{whitespace} -2
:>> Goofy-Smiley -2
> \ Backslash -2*10^100
->> T_OBJECT_OPERATOR -2
> \\ Double Backslash -2*10^100 > <:: LessThan-Paamayim Nekudotayim +0 > <: Back-Goofy-Smiley -2 > .. Short Elipsis -1
> Other possibilities: > ** Double-Star +2 > ;; Double-Semicolon +2 >>>> Reverse Heredoc Operator -1 > ?? Double Question -1
Are you drunk? :-) i honestly wouldn't have execpted things like ';;' or '**' from you. But it made me laugh. Anyway this whole thread is completley nonsense as long as noone that is participating has not the tinies clue - sorry. Best regards, Marcus

Oliver Grätz

20 years ago
Marcus Boerger schrieb:
> i honestly wouldn't have execpted things like ';;' or '**' from you.
First of all: Read the first thread! Anything is accepted as wish. It doesn't matter if it can be realized since we want to get to know what people like. My thoughts (disregarding technical possibilities): ** Shouldn't this be a power operator like "^"? And by the way: How could PHP get ten years old without having a power operator? ;; Comments are comments are comments are comments.
> But it made me laugh. Anyway this whole thread is completley nonsense > as long as noone that is participating has not the tinies clue - sorry.
Is this recursive? Don't YOU have the tiniest clue? I don't think so. But then again, you aren't really participating. Some real answers would help. For my part, I'd really like an answer to my question about the possibility of changing operator precedence in the ternary. Is this impossible to do? Doesn't the "?" already send the tokenizer into a "now I'm reading a ternary mode"? Wouldn't this open a possibility to force the usage of whitespace only when using namespaces without breaking existing code? OLLi

Jason Sweat

20 years ago
On 11/27/05, Sara Golemon <pollita@php.net> wrote:
> > Other possibilities: > ** Double-Star +2 > ;; Double-Semicolon +2 > >>> Reverse Heredoc Operator -1 > ?? Double Question -1 > > -Sara
I think we should use a non breaking space ( \xA0 ) as the separator, after all namespace class->method() looks great in an email, why not in code? ;) Regards, Jason http://blog.casey-sweat.us/

Jared Williams

20 years ago
> > On 11/27/05, Sara Golemon <pollita@php.net> wrote: > > > > Other possibilities: > > ** Double-Star +2 > > ;; Double-Semicolon +2 > > >>> Reverse Heredoc Operator -1 > > ?? Double Question -1 > > > > -Sara > > I think we should use a non breaking space ( \xA0 ) as the > separator, after all namespace class->method() looks great in > an email, why not in code? > > ;) >
I say it should be an ini setting, and then everyone can have whatever they want.. ;) Jared

Andrei Zmievski

20 years ago
Gah! I have to squint and count the colons in something like System:::Socket:::Pair::open(). Yikes. My vote is for \. -Andrei On Nov 27, 2005, at 2:47 PM, Oliver Grätz wrote:

Jani Taskinen

20 years ago
Oh, I didn't know you could nest these things.. -1000 for whole namespace idea: PREFIX! --Jani On Sun, 27 Nov 2005, Andrei Zmievski wrote:
> > Gah! I have to squint and count the colons in something like > System:::Socket:::Pair::open(). Yikes. > > My vote is for \. > > -Andrei > > > On Nov 27, 2005, at 2:47 PM, Oliver Grätz wrote: > >> Hi *! >> >> I updated the table with the comments in the thread. >> First of all: YES, these won't work as operator: >> >> - "<-" means "less than the negative value of" >> - ":" collides with the ternary >> >> BUT the discussion is not only about possibility but also about what you >> would like. The ":" for example would work if mandatory whitespace would >> be introduced for the ternary BUT this is very very bad. >> >> Regarding the other suggestions, ":::" seems to be something almost >> everybody could at least live with. >> >> OLLi >> >> >> Updated table follows: >> Second update: >> >> Namespace Operators >> ====================================================================== >> ================================================== >> Name |s| %% |( : )| ::: | ::< | :< |(<- )| :> | \ | -> >> | \\ | <:: | <: | .. | | | | >> ---------------------+-+-----+-----+-----+-----+-----+-----+----- >> +-----+-----+-----+-----+-----+-----+-----+-----+-----+ >> Robert Deaton |-| +0 | | -1 | | | -2 | +1 | | >> | | | | | | | | >> Alan Knowles |-| | +1 | | | | | | | >> | | | | | | | | >> Greg Beaver |-| | +0 | +0 | +0 | +0 | | +0 | +0 | +1 >> | +1 | +0 | +0 | | | | | >> Jessie Hernandez |-| +1 | +1 | +2 | | | | | | >> | | | | | | | | >> Matt Friedman |-| | | -1 | | | +1 | | -1 | >> | | +1 | +1 | | | | | >> David Zülke |-| | | +2 | | | +1 | -1 | | >> | | | -1 | | | | | >> Oliver Grätz |*| +2 | +2 | +1 | -1 | +0 | -2 | +0 | -2 | -2 >> | -2 | +0 | +0 | -2 | | | | >> Matthew C. Kavanagh |-| -1 | | | | | | | | >> | | | | | | | | >> Jasper Bryant-Greene |-| | | | | -1 | +1 | -1 | | >> | | | -1 | | | | | >> Eric Coleman |-| -1 | +2 | | | | +1 | +1 | -1 | >> | | | | | | | | >> Christian Stocker |-| | | | | -1 | | -1 | +1 | >> | | | -1 | | | | | >> Stanislav Malyshev |-| | | | | | | | | >> | | | | | | | | >> Jared Williams |-| | | | | | | | | +1 >> | | | | | | | | >> Jason Garber |-| | | | | | | | | >> | | | | +1 | | | | >> Nicolas Bérard Nault |-| -2 | | | | | +2 | | +1 | >> | | | | | | | | >> Sara Golemon |-| | | +1 | | | | | | >> | | | | | | | | >> Jacques Marneweck |*| -1 | -1 | +2 | -1 | -1 | -1 | -1 | -1 | -1 >> | +0 | -1 | -1 | +0 | | | | >> Sean Coates |-| | | +1 | | | | | | >> | | | | | | | | >> |-| | | | | | | | | >> | | | | | | | | >> |-| | | | | | | | | >> | | | | | | | | >> |-| | | | | | | | | >> | | | | | | | | >> |-| | | | | | | | | >> | | | | | | | | >> ---------------------+-+-----+-----+-----+-----+-----+-----+----- >> +-----+-----+-----+-----+-----+-----+-----+-----+-----+ >> sum (2 counts 2) | | -2 | +5 | +7 | -2 | -3 | +1 | -2 | -3 | -1 >> | -1 | 0 | -3 | -1 | | | | >> sum (2 counts 1) | | -2 | +3 | +4 | -2 | -3 | +2 | -2 | -2 | 0 >> | 0 | 0 | -3 | 0 | | | | >> sum (counting +/-) | | -1 | +4 | +5 | -1 | -1 | +2 | 0 | -1 | 0 >> | +1 | +2 | -1 | +1 | | | | >> ====================================================================== >> ================================================== >> >> Notes: >> - I took >> +2 as "likes" >> +1 as "is fine with" >> +0 as "can live with" >> -1 as "dislikes" >> -2 as "hates" >> empty for "no comment, no opinion, don't care" >> - Please don't enter anything other than these values! >> - The "s" column stands for "self-filled". I compiled the current >> table from the comments in this newsgroup, so perhaps I didn't >> get their comments right. >> - The operators : <- -> could make big problems with the parser. >> More complaints to follow. *g* >> - Feel free to add new suggestions to the right. >> - If you add your name at the bottom, please copy the free line >> so the next one also has a free one. >> - Do only edit the votes in *your* line! >> - Correct the sums if you post. >> - Please post as attachment! >> >> If some of the operators are definitely impossible to implement, >> please put the headline of column in parentheses (as in "(<-)") >> ans add a note why this operator can't be done (Hi Marcus *g*). >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php > >
-- Give me your money at @ <http://pecl.php.net/wishlist.php/sniper> Donating money may make me happier and friendlier for a limited period! Death to all 4 letter abbreviations starting with P!

David Zülke

20 years ago
Why would you have to do that. You only have to look at the last :: / ::: sequence. It's not that hard. - David Am 28.11.2005 um 07:27 schrieb Andrei Zmievski:

André Luis Ferreira da Silva Bacci

20 years ago
Andrei Zmievski wrote:
> Gah! I have to squint and count the colons in something like > System:::Socket:::Pair::open(). Yikes. > > My vote is for \.
And for ... System!Socket!Pair::open(); $x = $y?nsx!const:nxy!const; // $x = $y ? nsx!const : nxy!const; []s André AE

Stanislav Malyshev

20 years ago
OG>>BUT the discussion is not only about possibility but also about what you OG>>would like. The ":" for example would work if mandatory whitespace would OG>>be introduced for the ternary BUT this is very very bad. If my vote is counted (not that I asked for it :) then I vote against all funky syntax, present and future. :: is only thing that is obvious and somehow connected to the world of PHP as we know it now.
-- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/ +972-3-6139665 ext.115

Oliver Grätz

20 years ago
Stanislav Malyshev schrieb:
> OG>>BUT the discussion is not only about possibility but also about what you > OG>>would like. The ":" for example would work if mandatory whitespace would > OG>>be introduced for the ternary BUT this is very very bad. > > If my vote is counted (not that I asked for it :) then I vote against all > funky syntax, present and future. :: is only thing that is obvious and > somehow connected to the world of PHP as we know it now.
Well, some people always keep throwing that already used symbols cannot be used for other purposes. :: is used for resolving class scope. Well, the tokenizer COULD be so smart as to look ahead but I still haven't heard from any developer if the tokenizer is able to do that or if its context only consists of "before the currently found symbol". And the of course, multicontext symbols mean less performance (I guess). For the proposed : and its conflict with the middle symbol of the ternary operator the problem is somehow similar: If the tokenizer reads the ? it's already clear that a ternary is "happening". Examples: $b=$a?c:d; Currently this means "$b gets the value of constant c or d depending on the value of $a". If : becomes the namespace operator and then this symbol would ordinarily have a higher operator precedence and the tokenizer would read "constant d in namespace c" and then not find the middle : of the ternary hence throwing a parse error. This is obviously very bad since such scripts might already exist. BUT if the tokenizer would have a higher precedence for the middle ternary then this would run as before. To use namespaces in the ternary one would the simply force to put them in parentheses which is no big problem since such cases might be EXTREMELY rare. This would work: $b=$a?(c:d):(e:f); but this would not: $b=$a?c:d:e:f; with an error of "; expected at the position of the second :" (if ignoring namespaces there completely) or "; expected at the position of the third;" (if namespaces kick in AFTER the middle ternary operator) or something like that which would both be tolerable. The only question that nobody answered until now: Is such a behaviour of the tokenizer possible or do such contextual decisions not even happen until AFTER the tokenizing process? If it could be done this way then this would be the way to go since everybody seems to like : and the only thing in the way is one extremely rare case. OLLi

Stanislav Malyshev

20 years ago
OG>>Well, some people always keep throwing that already used symbols cannot OG>>be used for other purposes. :: is used for resolving class scope. Well, Well, namespace scope and class scope are close enough so that this mixing up would be bearable (and regarding class resolution and namespace resolution as the same operation is not an alien concept in OO world). OG>>the tokenizer COULD be so smart as to look ahead but I still haven't yacc can look one token ahead, AFAIR.
-- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/ +972-3-6139665 ext.115

Oliver Grätz

20 years ago
Stanislav Malyshev schrieb:
> yacc can look one token ahead, AFAIR.
This could help for "::" (reading a name and seeing "Oh, one more ::, so this is one more namespace"), but not for ":" (there the change of operator precedence would still be needed). OK, now this would have to be sorted out by some T_* guru ;-) OLLi

Marcus Börger

20 years ago
Hello Oliver, just once again for the record: :: is *not* working. marcus Monday, November 28, 2005, 2:52:50 PM, you wrote:
> Stanislav Malyshev schrieb: >> OG>>BUT the discussion is not only about possibility but also about what you >> OG>>would like. The ":" for example would work if mandatory whitespace would >> OG>>be introduced for the ternary BUT this is very very bad. >> >> If my vote is counted (not that I asked for it :) then I vote against all >> funky syntax, present and future. :: is only thing that is obvious and >> somehow connected to the world of PHP as we know it now.
> Well, some people always keep throwing that already used symbols cannot > be used for other purposes. :: is used for resolving class scope. Well, > the tokenizer COULD be so smart as to look ahead but I still haven't > heard from any developer if the tokenizer is able to do that or if its > context only consists of "before the currently found symbol". And the of > course, multicontext symbols mean less performance (I guess). For the > proposed : and its conflict with the middle symbol of the ternary > operator the problem is somehow similar: If the tokenizer reads the ? > it's already clear that a ternary is "happening".
> Examples:
> $b=$a?c:d;
> Currently this means "$b gets the value of constant c or d depending on > the value of $a". If : becomes the namespace operator and then this > symbol would ordinarily have a higher operator precedence and the > tokenizer would read "constant d in namespace c" and then not find the > middle : of the ternary hence throwing a parse error. This is obviously > very bad since such scripts might already exist. BUT if the tokenizer > would have a higher precedence for the middle ternary then this would > run as before. To use namespaces in the ternary one would the simply > force to put them in parentheses which is no big problem since such > cases might be EXTREMELY rare. This would work:
> $b=$a?(c:d):(e:f);
> but this would not:
> $b=$a?c:d:e:f;
> with an error of "; expected at the position of the second :" (if > ignoring namespaces there completely) or "; expected at the position of > the third;" (if namespaces kick in AFTER the middle ternary operator) or > something like that which would both be tolerable. The only question > that nobody answered until now: Is such a behaviour of the tokenizer > possible or do such contextual decisions not even happen until AFTER the > tokenizing process?
> If it could be done this way then this would be the way to go since > everybody seems to like : and the only thing in the way is one extremely > rare case.
> OLLi
Best regards, Marcus

Greg Beaver

20 years ago
Stanislav Malyshev wrote:
> OG>>BUT the discussion is not only about possibility but also about what you > OG>>would like. The ":" for example would work if mandatory whitespace would > OG>>be introduced for the ternary BUT this is very very bad. > > If my vote is counted (not that I asked for it :) then I vote against all > funky syntax, present and future. :: is only thing that is obvious and > somehow connected to the world of PHP as we know it now.
Agreed, I am only in favor of :: if it is technically possible. Greg

Bart de Boer

20 years ago
I'm sorry if I say stupid stuff. My previous post actually was the first post I've ever made to a newsgroup! Please bare with me while I adjust to the etiquettes. :) Anyway. Somebody has probably already suggested this. But how about: namespace1}{Date::myfunction(); namespace2}{Date::Otherfunction(); Greg Beaver wrote:

sebastian

20 years ago
ew On 11/28/05, Bart de Boer <bart@mediawave.nl> wrote:

Sara Golemon

20 years ago
> namespace1}{Date::myfunction(); > namespace2}{Date::Otherfunction(); >
For the same reason that ;; isn't doable (and worse actually). echo "The Baz constant in the Bar class of the Foo namespace is: {Foo}{Bar::Baz}, or is it? Don'tcha hate tokens with multiple meanings?";