Re: [PHP-DEV] Migrating PHP classes to built in namespace

2015-06-16 Thread Dominic Grostate
I've missed out on most of this discussion via email, bit I've watching the
threads anyway.  It seems to me the main debate is about backwards
compatibility, and where the classes belong.

My reason for starting this thread was not really out of necessity, but
merely to argue semantics. So if it is not worth it then it is not worth it.

However, given that some people here appear receptive to the idea I'd like
to support my original suggestion of aliasing by comparing the concept to
JavaScript, where by the root namespace is an alias of the window object
(or vice versa). It could be used as a permanent alias, or only as a
solution for phasing out the global namespace in preparation for PHP8 in X
number of years.
On 4 Jun 2015 9:02 am, Yasuo Ohgaki yohg...@ohgaki.net wrote:

 Hi all,

 On Thu, Jun 4, 2015 at 12:07 AM, Sara Golemon poll...@php.net wrote:

 On Wed, Jun 3, 2015 at 1:33 AM, Dominic Grostate
 codekest...@googlemail.com wrote:
  Has there been any discussion or consideration towards migrating or at
  least aliasing all built in classes to a Php vendor namespace?
 
 Not any that's led to a consensus.

 Personally, I like the idea of moving EVERYTHING to PHP\ at once and
 building in an automatic fallback, so an app could do:

 ?php
 $dt = new DateTime(...); // uses builtin DataTime via fallback to PHP
 namespace

 Or:

 ?php
 class DateTime { ... }
 $mydt = new DateTime(...); // Uses user supplied DateTime
 $pdt = new PHP\DateTime(...); // Uses builtin DateTime


 It's acceptable option, but I prefer explicit declaration for clean root
 namespace.



 Possibly paired with the ability to import a NS to root:

 ?php
 use PHP as \;
 $pdt = new DateTime(...); // Uses builtin DateTime from root namespace


 +1 for as \
 It achieves both clean namespace and compatibility at the same time.
 It opens door for easier API version up also. Automatic fallback disturbs
 this.

 Regards,

 --
 Yasuo Ohgaki
 yohg...@ohgaki.net




Re: [PHP-DEV] Migrating PHP classes to built in namespace

2015-06-15 Thread Jakub Kubíček
2015-06-12 10:10 GMT+02:00 Tony Marston tonymars...@hotmail.com:
 And what is the benefit in userland?

That is the question.

I think clean global namespace isn't enough argument, we can exist in
the current situation and considering the fact that most of the new
PHP applications have their own namespaces, it could probably make
more sense to reserve global namespace as *the PHP namespace*.


Regards,
Kubo2

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



Re: [PHP-DEV] Migrating PHP classes to built in namespace

2015-06-15 Thread Sebastian B.-Hagensen
Hi,

2015-06-15 16:09 GMT+02:00 Jakub Kubíček kelerest...@gmail.com:
 I think clean global namespace isn't enough argument, we can exist in
 the current situation and considering the fact that most of the new
 PHP applications have their own namespaces, it could probably make
 more sense to reserve global namespace as *the PHP namespace*.

I don't know how well known that page is, but the manual already hints
towards php ruling the root-namespace:

 PHP owns the top-level namespace but tries to find decent descriptive names 
 and avoid any obvious clashes.
http://php.net/manual/en/userlandnaming.rules.php

On an unrelated note:
http://php.net/manual/en/userlandnaming.tips.php should hint towards
real namespaces.

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



Re: [PHP-DEV] Migrating PHP classes to built in namespace

2015-06-15 Thread Christoph Becker
Sebastian B.-Hagensen wrote:

 On an unrelated note:
 http://php.net/manual/en/userlandnaming.tips.php should hint towards
 real namespaces.

There is already a respective ticket:
https://bugs.php.net/bug.php?id=69369. :)

-- 
Christoph M. Becker


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



Re: [PHP-DEV] Migrating PHP classes to built in namespace

2015-06-12 Thread Tony Marston
Yasuo Ohgaki  wrote in message 
news:CAGa2bXaMoHDVoZRNNPEEM--km-in4tSyux=tub0paes4tww...@mail.gmail.com...


Hi Tony,

On Thu, Jun 11, 2015 at 4:37 PM, Tony Marston tonymars...@hotmail.com
wrote:


Yasuo Ohgaki  wrote in message
news:CAGa2bXZvuqV4Kwru+wUL-bfTb9_tnv=l16reu-+w+uajx4h...@mail.gmail.com...



Hi Jakub,

On Thu, Jun 11, 2015 at 7:43 AM, Jakub Kubícek kelerest...@gmail.com

wrote:

 This is weird and ugly what you're fabricating here. The PHP classes

should be all in global namespace. I am really against some
namespacing of them.



It may seems weird if you aren't familiar with languages support
this kind of feature. However, you'll find many languages support
this or similar.

JavaScript is one of them. JavaScript allows to override any functions,
for example. It's works like importing other namespace function into
root. i.e. Provide different feature with the same name.

For long term PHP evolution, having ability to import some namespace
into root namespace is great feature. i.e. API/Module version up. We
can provide both old and new during migration. Use of namespace is
better approach because it may give us super clean global namespace 
also.


Regards,

--
Yasuo Ohgaki
yohg...@ohgaki.net



The fact that other languages have this feature should not be a reason to
add it to PHP, especially as it would provide a huge BC break with
absolutely no practical, only theoretical, benefits.



It does not create huge BC.
It's matter of adding a line for namespace or having a default namespace
setting.



Huge or not, it is still a BC break. And what is the benefit in userland?

--
Tony Marston



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



Re: [PHP-DEV] Migrating PHP classes to built in namespace

2015-06-11 Thread Tony Marston
Yasuo Ohgaki  wrote in message 
news:CAGa2bXZvuqV4Kwru+wUL-bfTb9_tnv=l16reu-+w+uajx4h...@mail.gmail.com...


Hi Jakub,

On Thu, Jun 11, 2015 at 7:43 AM, Jakub Kubícek kelerest...@gmail.com
wrote:


This is weird and ugly what you're fabricating here. The PHP classes
should be all in global namespace. I am really against some
namespacing of them.



It may seems weird if you aren't familiar with languages support
this kind of feature. However, you'll find many languages support
this or similar.

JavaScript is one of them. JavaScript allows to override any functions,
for example. It's works like importing other namespace function into
root. i.e. Provide different feature with the same name.

For long term PHP evolution, having ability to import some namespace
into root namespace is great feature. i.e. API/Module version up. We
can provide both old and new during migration. Use of namespace is
better approach because it may give us super clean global namespace also.

Regards,

--
Yasuo Ohgaki
yohg...@ohgaki.net


The fact that other languages have this feature should not be a reason to 
add it to PHP, especially as it would provide a huge BC break with 
absolutely no practical, only theoretical, benefits.


--
Tony Marston



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



Re: [PHP-DEV] Migrating PHP classes to built in namespace

2015-06-11 Thread Yasuo Ohgaki
Hi Tony,

On Thu, Jun 11, 2015 at 4:37 PM, Tony Marston tonymars...@hotmail.com
wrote:

 Yasuo Ohgaki  wrote in message
 news:CAGa2bXZvuqV4Kwru+wUL-bfTb9_tnv=l16reu-+w+uajx4h...@mail.gmail.com...


 Hi Jakub,

 On Thu, Jun 11, 2015 at 7:43 AM, Jakub Kubícek kelerest...@gmail.com

 wrote:

  This is weird and ugly what you're fabricating here. The PHP classes
 should be all in global namespace. I am really against some
 namespacing of them.


 It may seems weird if you aren't familiar with languages support
 this kind of feature. However, you'll find many languages support
 this or similar.

 JavaScript is one of them. JavaScript allows to override any functions,
 for example. It's works like importing other namespace function into
 root. i.e. Provide different feature with the same name.

 For long term PHP evolution, having ability to import some namespace
 into root namespace is great feature. i.e. API/Module version up. We
 can provide both old and new during migration. Use of namespace is
 better approach because it may give us super clean global namespace also.

 Regards,

 --
 Yasuo Ohgaki
 yohg...@ohgaki.net


 The fact that other languages have this feature should not be a reason to
 add it to PHP, especially as it would provide a huge BC break with
 absolutely no practical, only theoretical, benefits.


It does not create huge BC.
It's matter of adding a line for namespace or having a default namespace
setting.

Regards,

--
Yasuo Ohgaki
yohg...@ohgaki.net


Fwd: [PHP-DEV] Migrating PHP classes to built in namespace

2015-06-10 Thread Jakub Kubíček
/cc-ing internals, as I sent the message privately to Yasuo by mistake.

-- Forwarded message --
From: Jakub Kubíček kelerest...@gmail.com
Date: 2015-06-11 0:40 GMT+02:00
Subject: Re: [PHP-DEV] Migrating PHP classes to built in namespace
To: Yasuo Ohgaki yohg...@ohgaki.net


Hi.

This is weird and ugly what you're fabricating here. The PHP classes
should be all in global namespace. I am really against some
namespacing of them.

My € 0.02


Regards
Kubo2


2015-06-04 23:17 GMT+02:00 Yasuo Ohgaki yohg...@ohgaki.net:
 Hi Marc,

 On Thu, Jun 4, 2015 at 6:04 PM, Marc Bennewitz dev@mabe.berlin wrote:

 This one is not compatible with current code as you have to alias the PHP
 namespace to the root one before using full classes like \DateTime.


 Right.
 We are better to have PHP namespace for internal classes/functions first,
 then
 introduce as \ few years later. i.e. PHP classes/functions exist in both
 \ and \php
 namespace during migration period or we may user INI switch for migration.

 PS: I like a lower case php much more than upper case PHP ;)


 I'm neutral on this :)

 Regards,

 --
 Yasuo Ohgaki
 yohg...@ohgaki.net

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



Re: [PHP-DEV] Migrating PHP classes to built in namespace

2015-06-10 Thread Yasuo Ohgaki
Hi Jakub,

On Thu, Jun 11, 2015 at 7:43 AM, Jakub Kubíček kelerest...@gmail.com
wrote:

 This is weird and ugly what you're fabricating here. The PHP classes
 should be all in global namespace. I am really against some
 namespacing of them.


It may seems weird if you aren't familiar with languages support
this kind of feature. However, you'll find many languages support
this or similar.

JavaScript is one of them. JavaScript allows to override any functions,
for example. It's works like importing other namespace function into
root. i.e. Provide different feature with the same name.

For long term PHP evolution, having ability to import some namespace
into root namespace is great feature. i.e. API/Module version up. We
can provide both old and new during migration. Use of namespace is
better approach because it may give us super clean global namespace also.

Regards,

--
Yasuo Ohgaki
yohg...@ohgaki.net


Re: [PHP-DEV] Migrating PHP classes to built in namespace

2015-06-04 Thread Yasuo Ohgaki
Hi Marc,

On Thu, Jun 4, 2015 at 6:04 PM, Marc Bennewitz dev@mabe.berlin wrote:

 This one is not compatible with current code as you have to alias the PHP
 namespace to the root one before using full classes like \DateTime.


Right.
We are better to have PHP namespace for internal classes/functions first,
then
introduce as \ few years later. i.e. PHP classes/functions exist in both
\ and \php
namespace during migration period or we may user INI switch for migration.

PS: I like a lower case php much more than upper case PHP ;)


I'm neutral on this :)

Regards,

--
Yasuo Ohgaki
yohg...@ohgaki.net


Re: [PHP-DEV] Migrating PHP classes to built in namespace

2015-06-04 Thread Marc Bennewitz



On 06/04/2015 10:01 AM, Yasuo Ohgaki wrote:

Hi all,

On Thu, Jun 4, 2015 at 12:07 AM, Sara Golemon poll...@php.net wrote:


On Wed, Jun 3, 2015 at 1:33 AM, Dominic Grostate
codekest...@googlemail.com wrote:

Has there been any discussion or consideration towards migrating or at
least aliasing all built in classes to a Php vendor namespace?


Not any that's led to a consensus.

Personally, I like the idea of moving EVERYTHING to PHP\ at once and
building in an automatic fallback, so an app could do:

?php
$dt = new DateTime(...); // uses builtin DataTime via fallback to PHP
namespace

Or:

?php
class DateTime { ... }
$mydt = new DateTime(...); // Uses user supplied DateTime
$pdt = new PHP\DateTime(...); // Uses builtin DateTime


It's acceptable option, but I prefer explicit declaration for clean root
namespace.



Possibly paired with the ability to import a NS to root:

?php
use PHP as \;
$pdt = new DateTime(...); // Uses builtin DateTime from root namespace


+1 for as \
It achieves both clean namespace and compatibility at the same time.
It opens door for easier API version up also. Automatic fallback disturbs
this.
This one is not compatible with current code as you have to alias the 
PHP namespace to the root one before using full classes like \DateTime.


PS: I like a lower case php much more than upper case PHP ;)



Regards,

--
Yasuo Ohgaki
yohg...@ohgaki.net




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



Re: [PHP-DEV] Migrating PHP classes to built in namespace

2015-06-04 Thread Yasuo Ohgaki
Hi all,

On Thu, Jun 4, 2015 at 12:07 AM, Sara Golemon poll...@php.net wrote:

 On Wed, Jun 3, 2015 at 1:33 AM, Dominic Grostate
 codekest...@googlemail.com wrote:
  Has there been any discussion or consideration towards migrating or at
  least aliasing all built in classes to a Php vendor namespace?
 
 Not any that's led to a consensus.

 Personally, I like the idea of moving EVERYTHING to PHP\ at once and
 building in an automatic fallback, so an app could do:

 ?php
 $dt = new DateTime(...); // uses builtin DataTime via fallback to PHP
 namespace

 Or:

 ?php
 class DateTime { ... }
 $mydt = new DateTime(...); // Uses user supplied DateTime
 $pdt = new PHP\DateTime(...); // Uses builtin DateTime


It's acceptable option, but I prefer explicit declaration for clean root
namespace.



 Possibly paired with the ability to import a NS to root:

 ?php
 use PHP as \;
 $pdt = new DateTime(...); // Uses builtin DateTime from root namespace


+1 for as \
It achieves both clean namespace and compatibility at the same time.
It opens door for easier API version up also. Automatic fallback disturbs
this.

Regards,

--
Yasuo Ohgaki
yohg...@ohgaki.net


Re: [PHP-DEV] Migrating PHP classes to built in namespace

2015-06-03 Thread Rowan Collins

Dominic Grostate wrote on 03/06/2015 09:33:

Hi,

I couldn't find any information on this elsewhere, or perhaps I didn't look
hard enough.  Its been bugging me a while though so I though I would ask.

Has there been any discussion or consideration towards migrating or at
least aliasing all built in classes to a Php vendor namespace?

For aesthetics if nothing else.



The PHP namespace (and all sub-namespaces thereof) is officially 
reserved for internal language use,  but to date there has been no 
comprehensive plan of how to lay it out...




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



Re: [PHP-DEV] Migrating PHP classes to built in namespace

2015-06-03 Thread Lorenzo Fontana
AFAIK the PHP namespace is the root one.

Lorenzo

2015-06-03 10:33 GMT+02:00 Dominic Grostate codekest...@googlemail.com:

 Hi,

 I couldn't find any information on this elsewhere, or perhaps I didn't look
 hard enough.  Its been bugging me a while though so I though I would ask.

 Has there been any discussion or consideration towards migrating or at
 least aliasing all built in classes to a Php vendor namespace?

 For aesthetics if nothing else.



Re: [PHP-DEV] Migrating PHP classes to built in namespace

2015-06-03 Thread Dominic Grostate
Yes, however for consistency, I personally like the idea of using a longer
namespace over prefixed class names.  The most relevant example being the
SPL data structures.

For instance SplStack might come under Php\Collection\Stack.

As far as I can tell there is a fair amount of fear of adding new native
classes in light of BC issues.  But I have yet to see anyone claim the Php
vendor namespace for themselves, so it might provide for future extensions.

Dominic

On Wed, 3 Jun 2015 09:35 Lorenzo Fontana fontanalor...@gmail.com wrote:

 AFAIK the PHP namespace is the root one.

 Lorenzo

 2015-06-03 10:33 GMT+02:00 Dominic Grostate codekest...@googlemail.com:

 Hi,

 I couldn't find any information on this elsewhere, or perhaps I didn't
 look
 hard enough.  Its been bugging me a while though so I though I would ask.

 Has there been any discussion or consideration towards migrating or at
 least aliasing all built in classes to a Php vendor namespace?

 For aesthetics if nothing else.





[PHP-DEV] Migrating PHP classes to built in namespace

2015-06-03 Thread Dominic Grostate
Hi,

I couldn't find any information on this elsewhere, or perhaps I didn't look
hard enough.  Its been bugging me a while though so I though I would ask.

Has there been any discussion or consideration towards migrating or at
least aliasing all built in classes to a Php vendor namespace?

For aesthetics if nothing else.


Re: [PHP-DEV] Migrating PHP classes to built in namespace

2015-06-03 Thread Sara Golemon
On Wed, Jun 3, 2015 at 1:33 AM, Dominic Grostate
codekest...@googlemail.com wrote:
 Has there been any discussion or consideration towards migrating or at
 least aliasing all built in classes to a Php vendor namespace?

Not any that's led to a consensus.

Personally, I like the idea of moving EVERYTHING to PHP\ at once and
building in an automatic fallback, so an app could do:

?php
$dt = new DateTime(...); // uses builtin DataTime via fallback to PHP namespace

Or:

?php
class DateTime { ... }
$mydt = new DateTime(...); // Uses user supplied DateTime
$pdt = new PHP\DateTime(...); // Uses builtin DateTime

Possibly paired with the ability to import a NS to root:

?php
use PHP as \;
$pdt = new DateTime(...); // Uses builtin DateTime from root namespace

I don't feel strongly about any of this though, so I'm not personally
inclined to push any RFC to make it happen.

-Sara

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