Hi all,
I have only one caveat with the \ separator, which is that it is a
little bit too similar to division with /, and can result in some
confusing code like:
<?php
namespace name1 {
class name2{}
}
define('name1', 1);
define('name2', 2);
$a = new name1\name2;
$b = name1/name2;
?>
The same issue exists with all colon based separators (that sounds bad
when read the wrong way...) because of the ternary operator, and :: with
static classes/methods.
<?php
namespace name1 {
class name2{}
}
define('name1', 1);
define('name2', 2);
// this may be a parse error with the current namespace patch,
// but need not be if we use ->
class name1
{
const name2 = 1;
}
$a = new name1:::name2;
$b = name1::name2; // do you see the difference? I get confused
?>
What about using the T_OBJECT_OPERATOR? This is a parse error in
existing versions, and also implies some separation.
<?php
namespace name1 {
class name2{}
}
define('name1', 1);
define('name2', 2);
// this may be a parse error with the current namespace patch,
// but need not be if we use ->
class name1
{
const name2 = 1;
}
$a = new name1->name2;
$b = name1::name2;
?>
I also proposed on IRC using \ as this is similar to netware driver
separators:
<?php
define('name1', 1);
define('name2', 2);
$a = new name1\name2;
$b = name1/name2;
?>
However, I know Andrei hated this :). I very much prefer the use of ->,
as this has the same advantage as :: of "rhyming" with current syntax.
Greg
I personally don't like any of these, but I just thought of this one:
"%%". Don't think it'll cause any problems at all, and look at the code:
<?php
$a = new name1%%name2;
$b = name1::name2; // I see the difference clearly
?>
What do you think? ":::" is more intuitive for me, but "%%" is an
acceptable alternative...
Regards,
Jessie
Greg Beaver wrote:
Hi all,
I have only one caveat with the \ separator, which is that it is a
little bit too similar to division with /, and can result in some
confusing code like:<?php
namespace name1 {
class name2{}
}
define('name1', 1);
define('name2', 2);$a = new name1\name2;
$b = name1/name2;
?>The same issue exists with all colon based separators (that sounds bad
when read the wrong way...) because of the ternary operator, and :: with
static classes/methods.<?php
namespace name1 {
class name2{}
}
define('name1', 1);
define('name2', 2);
// this may be a parse error with the current namespace patch,
// but need not be if we use ->
class name1
{
const name2 = 1;
}$a = new name1:::name2;
$b = name1::name2; // do you see the difference? I get confused
?>What about using the T_OBJECT_OPERATOR? This is a parse error in
existing versions, and also implies some separation.<?php
namespace name1 {
class name2{}
}
define('name1', 1);
define('name2', 2);
// this may be a parse error with the current namespace patch,
// but need not be if we use ->
class name1
{
const name2 = 1;
}$a = new name1->name2;
$b = name1::name2;
?>I also proposed on IRC using \ as this is similar to netware driver
separators:<?php
define('name1', 1);
define('name2', 2);$a = new name1\name2;
$b = name1/name2;
?>However, I know Andrei hated this :). I very much prefer the use of ->,
as this has the same advantage as :: of "rhyming" with current syntax.Greg
Hi, I've been following your conversations all day and think I might
have a nice idea for the namespace separator idea. Sorry to barge in
on your conversation but I think the following has value.
What about something like <- or <:: or even just <:
It makes sense to me because a namespace is akin to a parent of the
class and in a diagram I would use an arrow to point to the parent
from the child. At least there is some type of parent <- child
relation.
examples:
Namespace <:: ClassName
or
Namespace <- ClassName
or
Namespace <: ClassName
Unless I'm missing something these symbols should not conflict with
other ones. They also have more a PHP "feel".
This is the most semantically pleasing for me and it mirrors a common
convention and represents the actual relationship. In the language it
is nice when the symbols have an appearance representative of the
actual relationship.
When I see \ I think of ugly Windoze file paths. Also ::: seems awkward somehow.
Matt.
I personally don't like any of these, but I just thought of this one:
"%%". Don't think it'll cause any problems at all, and look at the code:<?php
$a = new name1%%name2;
$b = name1::name2; // I see the difference clearly
?>What do you think? ":::" is more intuitive for me, but "%%" is an
acceptable alternative...Regards,
Jessie
Greg Beaver wrote:
Hi all,
I have only one caveat with the \ separator, which is that it is a
little bit too similar to division with /, and can result in some
confusing code like:<?php
namespace name1 {
class name2{}
}
define('name1', 1);
define('name2', 2);$a = new name1\name2;
$b = name1/name2;
?>The same issue exists with all colon based separators (that sounds bad
when read the wrong way...) because of the ternary operator, and :: with
static classes/methods.<?php
namespace name1 {
class name2{}
}
define('name1', 1);
define('name2', 2);
// this may be a parse error with the current namespace patch,
// but need not be if we use ->
class name1
{
const name2 = 1;
}$a = new name1:::name2;
$b = name1::name2; // do you see the difference? I get confused
?>What about using the T_OBJECT_OPERATOR? This is a parse error in
existing versions, and also implies some separation.<?php
namespace name1 {
class name2{}
}
define('name1', 1);
define('name2', 2);
// this may be a parse error with the current namespace patch,
// but need not be if we use ->
class name1
{
const name2 = 1;
}$a = new name1->name2;
$b = name1::name2;
?>I also proposed on IRC using \ as this is similar to netware driver
separators:<?php
define('name1', 1);
define('name2', 2);$a = new name1\name2;
$b = name1/name2;
?>However, I know Andrei hated this :). I very much prefer the use of ->,
as this has the same advantage as :: of "rhyming" with current syntax.Greg
--
--
-- Matt Friedman
Hi Mat,
Matt Friedman wrote:
Hi, I've been following your conversations all day and think I might
have a nice idea for the namespace separator idea. Sorry to barge in
on your conversation but I think the following has value.What about something like <- or <:: or even just <:
It makes sense to me because a namespace is akin to a parent of the
class and in a diagram I would use an arrow to point to the parent
from the child. At least there is some type of parent <- child
relation.examples:
Namespace <:: ClassName
or
Namespace <- ClassName
or
Namespace <: ClassNameUnless I'm missing something these symbols should not conflict with
other ones. They also have more a PHP "feel".
Hmm, "<:" doesn't look bad to me. I'd like to somehow conduct a poll to
see what most prefer (it would be great if we could add polls on
php.net). So far, I have these possibilites:
:::
:>
<::
<-
<:
This is the most semantically pleasing for me and it mirrors a common
convention and represents the actual relationship. In the language it
is nice when the symbols have an appearance representative of the
actual relationship.When I see \ I think of ugly Windoze file paths. Also ::: seems awkward somehow.
Matt.
Yeah, I feel the same way for "". ":::" seems OK to me, but of course,
I want to put what the majority prefer.
Regards,
Jessie
::: is best. :> and <: look like my favorite smilies. No way I could
ever use them in code ;)
- David
Am 26.11.2005 um 22:39 schrieb Jessie Hernandez:
Hi Mat,
Matt Friedman wrote:
Hi, I've been following your conversations all day and think I might
have a nice idea for the namespace separator idea. Sorry to barge in
on your conversation but I think the following has value.
What about something like <- or <:: or even just <:
It makes sense to me because a namespace is akin to a parent of the
class and in a diagram I would use an arrow to point to the parent
from the child. At least there is some type of parent <- child
relation.
examples:
Namespace <:: ClassName
or
Namespace <- ClassName
or
Namespace <: ClassName
Unless I'm missing something these symbols should not conflict with
other ones. They also have more a PHP "feel".Hmm, "<:" doesn't look bad to me. I'd like to somehow conduct a
poll to see what most prefer (it would be great if we could add
polls on php.net). So far, I have these possibilites::::
:>
<::
<-
<:This is the most semantically pleasing for me and it mirrors a common
convention and represents the actual relationship. In the language it
is nice when the symbols have an appearance representative of the
actual relationship.
When I see \ I think of ugly Windoze file paths. Also ::: seems
awkward somehow.
Matt.Yeah, I feel the same way for "". ":::" seems OK to me, but of
course, I want to put what the majority prefer.Regards,
Jessie
Jessie Hernandez schrieb:
So far, I have these possibilites:
:::
:>
<::
<-
<:
OK, now that Marcus threw a PostToLongException('bla'), I'd love to get
back to this.
Other suggestions were
: :: -> .. \
Now some requirements:
- needs to work without collisions in the parser
(seems to kill ":","::","->") - should be easily distinguishable from other, similar operators
(seems to kill ":::") - at least one person on earth should like it
(seems to kill "")
This leaves us with:
:> <:: <- <: ..
I personally do not like ".." but that's just one voice.
What about combinations with | (like ":|") ?
For a laugh I should ass this link:
The periodic table of Perl operators!
http://www.ozonehouse.com/mark/blog/code/PeriodicTable.pdf
OLLi
MF>>Unless I'm missing something these symbols should not conflict with
MF>>other ones. They also have more a PHP "feel".
I wonder what "PHP feel" is in bunch of special symbols with meaning
entirely obscure to non-initiated... Why not {@ or <* then? They are nice
ASCII art too. And there are so many combinations of two special symbols,
let's find a meaning for all of them. Or at least for as many as we can.
Stanislav Malyshev, Zend Products Engineer
stas@zend.com http://www.zend.com/ +972-3-6139665 ext.115
I wonder what "PHP feel" is in bunch of special symbols with meaning
entirely obscure to non-initiated... Why not {@ or <* then? They are nice
ASCII art too. And there are so many combinations of two special symbols,
let's find a meaning for all of them. Or at least for as many as we can.
Great, everyone loves sarcasm, but you're describing exactly the
opposite of what's going on in this thread. There is a perceived need
for this functionality and you could argue for or against the
functionality instead. There's plenty of two character tokens in PHP
already and people aren't calling it "PerlHP" yet.
The -> suggestion if practicable seems the most intuitively correct to
me.
-> is crap because it is used for accessing object methods and
properties. Come on, guys. It is not that difficult. Think before you
write.
- David
Am 26.11.2005 um 23:16 schrieb Matthew C. Kavanagh:
I wonder what "PHP feel" is in bunch of special symbols with meaning
entirely obscure to non-initiated... Why not {@ or <* then? They
are nice
ASCII art too. And there are so many combinations of two special
symbols,
let's find a meaning for all of them. Or at least for as many as
we can.Great, everyone loves sarcasm, but you're describing exactly the
opposite of what's going on in this thread. There is a perceived need
for this functionality and you could argue for or against the
functionality instead. There's plenty of two character tokens in PHP
already and people aren't calling it "PerlHP" yet.The -> suggestion if practicable seems the most intuitively correct to
me.
Don't let the identifiers collide, then.
-> is crap because it is used for accessing object methods and
properties. Come on, guys. It is not that difficult. Think before you
write.
The proposal is just stupid. It cannot get any more confusing and
inconsistent.
Am 26.11.2005 um 23:29 schrieb Matthew C. Kavanagh:
Don't let the identifiers collide, then.
-> is crap because it is used for accessing object methods and
properties. Come on, guys. It is not that difficult. Think before you
write.
MCK>>The -> suggestion if practicable seems the most intuitively correct
MCK>>to me.
Yes, with one exception that this already has a meaning and it has nothing
to do with namespaces.
Stanislav Malyshev, Zend Products Engineer
stas@zend.com http://www.zend.com/ +972-3-6139665 ext.115
Hello Stanislav,
i know that language it is call ed PerlHyPer :-)
marcus
Saturday, November 26, 2005, 11:06:17 PM, you wrote:
MF>>>Unless I'm missing something these symbols should not conflict with
MF>>>other ones. They also have more a PHP "feel".
I wonder what "PHP feel" is in bunch of special symbols with meaning
entirely obscure to non-initiated... Why not {@ or <* then? They are nice
ASCII art too. And there are so many combinations of two special symbols,
let's find a meaning for all of them. Or at least for as many as we can.Stanislav Malyshev, Zend Products Engineer
stas@zend.com http://www.zend.com/ +972-3-6139665 ext.115
Best regards,
Marcus
Hello Matt,
bla!
Saturday, November 26, 2005, 10:19:18 PM, you wrote:
Hi, I've been following your conversations all day and think I might
have a nice idea for the namespace separator idea. Sorry to barge in
on your conversation but I think the following has value.
What about something like <- or <:: or even just <:
It makes sense to me because a namespace is akin to a parent of the
class and in a diagram I would use an arrow to point to the parent
from the child. At least there is some type of parent <- child
relation.
examples:
Namespace <:: ClassName
or
Namespace <- ClassName
or
Namespace <: ClassName
Unless I'm missing something these symbols should not conflict with
other ones. They also have more a PHP "feel".
This is the most semantically pleasing for me and it mirrors a common
convention and represents the actual relationship. In the language it
is nice when the symbols have an appearance representative of the
actual relationship.
When I see \ I think of ugly Windoze file paths. Also ::: seems awkward somehow.
Matt.
I personally don't like any of these, but I just thought of this one:
"%%". Don't think it'll cause any problems at all, and look at the code:<?php
$a = new name1%%name2;
$b = name1::name2; // I see the difference clearly
?>What do you think? ":::" is more intuitive for me, but "%%" is an
acceptable alternative...Regards,
Jessie
Greg Beaver wrote:
Hi all,
I have only one caveat with the \ separator, which is that it is a
little bit too similar to division with /, and can result in some
confusing code like:<?php
namespace name1 {
class name2{}
}
define('name1', 1);
define('name2', 2);$a = new name1\name2;
$b = name1/name2;
?>The same issue exists with all colon based separators (that sounds bad
when read the wrong way...) because of the ternary operator, and :: with
static classes/methods.<?php
namespace name1 {
class name2{}
}
define('name1', 1);
define('name2', 2);
// this may be a parse error with the current namespace patch,
// but need not be if we use ->
class name1
{
const name2 = 1;
}$a = new name1:::name2;
$b = name1::name2; // do you see the difference? I get confused
?>What about using the T_OBJECT_OPERATOR? This is a parse error in
existing versions, and also implies some separation.<?php
namespace name1 {
class name2{}
}
define('name1', 1);
define('name2', 2);
// this may be a parse error with the current namespace patch,
// but need not be if we use ->
class name1
{
const name2 = 1;
}$a = new name1->name2;
$b = name1::name2;
?>I also proposed on IRC using \ as this is similar to netware driver
separators:<?php
define('name1', 1);
define('name2', 2);$a = new name1\name2;
$b = name1/name2;
?>However, I know Andrei hated this :). I very much prefer the use of ->,
as this has the same advantage as :: of "rhyming" with current syntax.Greg
--
--
-- Matt Friedman
--
Best regards,
Marcus
Marcus Boerger wrote:
Hello Matt,
bla!
LOL!
--
Jessie
Matt Friedman wrote:
Namespace <:: ClassName
or
Namespace <- ClassName
or
Namespace <: ClassNameUnless I'm missing something these symbols should not conflict with
other ones.
I'm not sure if someone already mentioned it,
but "<-" is not acceptable, since it means
"less than the opposite of"
==============================
<?php
define ('a', 1);
define ('b', 0);
$c = (b<-a);
//i.e. $c = (b < -a)
?>
Regards,
Lorenzo Alberton
http://pear.php.net/user/quipo
Hadn't thought about that one... Thank you for the comment.
I now think '' is the best choice.
Matt Friedman wrote:
Namespace <:: ClassName
or
Namespace <- ClassName
or
Namespace <: ClassNameUnless I'm missing something these symbols should not conflict with
other ones.I'm not sure if someone already mentioned it,
but "<-" is not acceptable, since it means
"less than the opposite of"==============================
<?php
define ('a', 1);
define ('b', 0);$c = (b<-a);
//i.e. $c = (b < -a)
?>Regards,
Lorenzo Alberton
http://pear.php.net/user/quipo--
--
Nicolas Bérard Nault (nicobn@gmail.com)
"Maybe nature is fundamentally ugly, chaotic and complicated. But if it's
like that, then I want out." -- Steven Weinberg (prix Nobel de physique,
1979).
Hi all,
I have only one caveat with the \ separator, which is that it
is a little bit too similar to division with /, and can
result in some confusing code like:<?php
namespace name1 {
class name2{}
}
define('name1', 1);
define('name2', 2);$a = new name1\name2;
$b = name1/name2;
?>The same issue exists with all colon based separators (that
sounds bad when read the wrong way...) because of the ternary
operator, and :: with static classes/methods.<?php
namespace name1 {
class name2{}
}
define('name1', 1);
define('name2', 2);
// this may be a parse error with the current namespace
patch, // but need not be if we use -> class name1 {
const name2 = 1;
}$a = new name1:::name2;
$b = name1::name2; // do you see the difference? I get confused ?>What about using the T_OBJECT_OPERATOR? This is a parse
error in existing versions, and also implies some separation.<?php
namespace name1 {
class name2{}
}
define('name1', 1);
define('name2', 2);
// this may be a parse error with the current namespace
patch, // but need not be if we use -> class name1 {
const name2 = 1;
}$a = new name1->name2;
$b = name1::name2;
?>I also proposed on IRC using \ as this is similar to netware driver
separators:<?php
define('name1', 1);
define('name2', 2);$a = new name1\name2;
$b = name1/name2;
?>However, I know Andrei hated this :). I very much prefer the
use of ->, as this has the same advantage as :: of "rhyming"
with current syntax.
Hi,
I was thinking -> too.. Had ideas of namespaces being object instances in their own right..
namespace foo { const ACONST = '1'; class bar {} }
echo $foo->bar; // some mangled internal class name (foo_bar_123 or something) to make it unique
$a = new $foo->bar();
$ref = new ReflectionClass($foo->bar);
Jared
Hello,
I as a userland library author, would appreciate namespaces quite a
bit. Here is an idea:
namespace1..class()
$x = new MyApp..MemberOrder();
--
Best regards,
Jason mailto:jason@ionzoft.com
Saturday, November 26, 2005, 3:52:35 PM, you wrote:
GB> Hi all,
GB> I have only one caveat with the \ separator, which is that it is a
GB> little bit too similar to division with /, and can result in some
GB> confusing code like:
GB> <?php
GB> namespace name1 {
GB> class name2{}
GB> }
GB> define('name1', 1);
GB> define('name2', 2);
GB> $a = new name1\name2;
GB> $b = name1/name2;
?>>
GB> The same issue exists with all colon based separators (that sounds bad
GB> when read the wrong way...) because of the ternary operator, and :: with
GB> static classes/methods.
GB> <?php
GB> namespace name1 {
GB> class name2{}
GB> }
GB> define('name1', 1);
GB> define('name2', 2);
GB> // this may be a parse error with the current namespace patch,
GB> // but need not be if we use ->
GB> class name1
GB> {
GB> const name2 = 1;
GB> }
GB> $a = new name1:::name2;
GB> $b = name1::name2; // do you see the difference? I get confused
?>>
GB> What about using the T_OBJECT_OPERATOR? This is a parse error in
GB> existing versions, and also implies some separation.
GB> <?php
GB> namespace name1 {
GB> class name2{}
GB> }
GB> define('name1', 1);
GB> define('name2', 2);
GB> // this may be a parse error with the current namespace patch,
GB> // but need not be if we use ->
GB> class name1
GB> {
GB> const name2 = 1;
GB> }
$a = new name1->>name2;
GB> $b = name1::name2;
?>>
GB> I also proposed on IRC using \ as this is similar to netware driver
GB> separators:
GB> <?php
GB> define('name1', 1);
GB> define('name2', 2);
GB> $a = new name1\name2;
GB> $b = name1/name2;
?>>
GB> However, I know Andrei hated this :). I very much prefer the use of ->,
GB> as this has the same advantage as :: of "rhyming" with current syntax.
GB> Greg
I hate the idea of voting for features, but since it might have some
affect on the language, I will add my opinion to the heap.
::: - Bad, because it's three characters.
: - Good, because it's one character, and it does not look like
something else.
\ - It's one character, but it looks like division/escape sequence.
Plus, it will raise syntactic hell in some editors.
Radical idea:
- Use :.
- Make : to work like ::.
- Make : to work like ->.
- But no one will agree to it anyway, so I stop here.
Roman Ivanov schrieb:
Radical idea:
- Use :.
- Make : to work like ::.
- Make : to work like ->.
- But no one will agree to it anyway, so I stop here.
Nope. I agree ;-)
But that train has already left.
(although I still think : could be made to work for the namespaces)
OLLi