[PHP-DEV] PHP6 new syntax use suggestion

2008-05-23 Thread Astro [GTalk]
Hello,

I have a suggestion for upcoming PHP6 as it's a major version change. I
suggest a possibility to use this (example):

$host = parse_url('http://someurl.com')['host'];

instead of

$host = parse_url('http://someurl.com');
$host = $host['host'];

Now it returns a syntax error.


Have a nice day,
A


Re: [PHP-DEV] PHP6 new syntax use suggestion

2008-05-23 Thread Lokrain
Hello,

You got +1 from me for this idea.

Regards, Dimitar Isusov


Re: [PHP-DEV] PHP6 new syntax use suggestion

2008-05-23 Thread Lars Strojny
Hi Astro,

Am Freitag, den 23.05.2008, 15:35 +0200 schrieb Astro [GTalk]:
[...]
 $host = parse_url('http://someurl.com')['host'];
 
 instead of
 
 $host = parse_url('http://someurl.com');
 $host = $host['host'];
 
 Now it returns a syntax error.

a) write a proposal, b) write a patch for the Zend Engine, c) ask again.

Thanks, Lars


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


Re: [PHP-DEV] PHP6 new syntax use suggestion

2008-05-23 Thread Marco
 I have a suggestion for upcoming PHP6 as it's a major version change. I
 suggest a possibility to use this (example):

 $host = parse_url('http://someurl.com')['host'];

 instead of

 $host = parse_url('http://someurl.com');
 $host = $host['host'];


I can't see any real benefit of this change apart from a WTF factor... its
possible i'm missing something though! Whats the benefit apart from saving a
line of code?

Why not just skip the second line and use $host['host'] instead of copying
it to $host ?

Regards

Marco


Re: [PHP-DEV] PHP6 new syntax use suggestion

2008-05-23 Thread Lars Strojny
Hi Marco,

Am Freitag, den 23.05.2008, 16:51 +0200 schrieb Marco:
 I can't see any real benefit of this change apart from a WTF factor...
 its possible i'm missing something though! Whats the benefit apart
 from saving a line of code?

The fact that this syntactic variant is available *and used* in a lot of
other popular languages (JavaScript, Ruby, Python) might be an
indicator, that it is helpful. The use-case has been illustrated before
and is still valid, except that for the specific function there was a
better alternative. The use-case is, in short: a function/method which
reliably returns an array with fixed keys and you want to use a single
key.

cu, Lars


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


Re: [PHP-DEV] PHP6 new syntax use suggestion

2008-05-23 Thread Antony Dovgal

First of all, this was already discussed, search the archives before posting 
your suggestions.

Second, I still see very little sense in suggestions not supported by patches.
You can add your +/-1 for ever, but it won't be implemented until someone sits 
down and writes the patch.

And finally, this particular syntax would require us to change arrays to some kind 
of resources so that they could be indicated by some unique index 
(that's what was made to objects and now they can be referenced as func()-attr).

This apparently means overall source code rewrite only to enable this syntax of 
doubtful usefulness.

On 23.05.2008 17:35, Astro [GTalk] wrote:

Hello,

I have a suggestion for upcoming PHP6 as it's a major version change. I
suggest a possibility to use this (example):

$host = parse_url('http://someurl.com')['host'];

instead of

$host = parse_url('http://someurl.com');
$host = $host['host'];

Now it returns a syntax error.


--
Wbr, 
Antony Dovgal


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



Re: [PHP-DEV] PHP6 new syntax use suggestion

2008-05-23 Thread Brian Moon

Lars Strojny wrote:

a) write a proposal, b) write a patch for the Zend Engine, c) ask again.


+1 on what Lars said.  Not so much on the syntax.  That just looks like 
a parse error to me.


--

Brian Moon
Senior Developer/Engineer
--
When you care enough to spend the very least.
http://dealnews.com/


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