Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » PHP
  • » [PHP-DEV] Re: namespace separator ideas [RSS Feed]

#1 Nov. 26, 2005 21:07:03

Jessie H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Re: namespace separator ideas


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 anacceptable 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--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#2 Nov. 26, 2005 21:19:58

Matt F.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Re: namespace separator ideas


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.

On 11/26/05, Jessie Hernandez <> wrote:
> 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
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit:http://www.php.net/unsub.php>
>


--
-- Matt Friedman

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#3 Nov. 26, 2005 21:40:04

Jessie H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Re: namespace separator ideas


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 tosee what most prefer (it would be great if we could add polls onphp.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

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#4 Nov. 26, 2005 21:49:59

David Z.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Re: namespace separator ideas


::: is best. :> and <: look like my favorite smilies. No way I couldever 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 apoll to see what most prefer (it would be great if we could addpolls 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 ::: seemsawkward somehow.Matt.Yeah, I feel the same way for "\". ":::" seems OK to me, but ofcourse, I want to put what the majority prefer.Regards,

Jessie

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#5 Nov. 26, 2005 22:07:04

Stanislav M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Re: namespace separator ideas


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
http://www.zend.com/+972-3-6139665 ext.115

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#6 Nov. 26, 2005 22:17:09

Matthew C.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Re: namespace separator ideas


On Sun, 2005-11-27 at 00:06 +0200, Stanislav Malyshev wrote:
> 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.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#7 Nov. 26, 2005 22:23:50

David Z.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Re: namespace separator ideas


-> is crap because it is used for accessing object methods andproperties. Come on, guys. It is not that difficult. Think before youwrite.- David


Am 26.11.2005 um 23:16 schrieb Matthew C. Kavanagh:On Sun, 2005-11-27 at 00:06 +0200, Stanislav Malyshev wrote:I wonder what "PHP feel" is in bunch of special symbols with meaningentirely obscure to non-initiated... Why not {@ or <* then? Theyare niceASCII art too. And there are so many combinations of two specialsymbols,let's find a meaning for all of them. Or at least for as many aswe 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.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#8 Nov. 26, 2005 22:25:47

Marcus B.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Re: namespace separator ideas


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.

> On 11/26/05, Jessie Hernandez <> wrote:
>> 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
>>
>> --
>> PHP Internals - PHP Runtime Development Mailing List
>> To unsubscribe, visit:http://www.php.net/unsub.php>>
>>


> --
> -- Matt Friedman

> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit:http://www.php.net/unsub.phpBest regards,
Marcus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#9 Nov. 26, 2005 22:29:18

Jessie H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Re: namespace separator ideas


Marcus Boerger wrote:Hello Matt,

bla!LOL!


--
Jessie

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#10 Nov. 26, 2005 22:31:05

Matthew C.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Re: namespace separator ideas


Don't let the identifiers collide, then.

On Sat, 2005-11-26 at 23:23 +0100, David Zülke wrote:
> -> is crap because it is used for accessing object methods and
> properties. Come on, guys. It is not that difficult. Think before you
> write.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

  • Root
  • » PHP
  • » [PHP-DEV] Re: namespace separator ideas [RSS Feed]

Board footer

Moderator control

Enjoy the 27th of April
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support