Hi,
as we introduce NOWDOC in 5.3 it would be logical to allow a double
quoted syntax sister of NOWDOC which acts as HEREDOC (same as for $var =
"$var" vs $var = '$var'). Currently we have the following options:
$var = "Hello world";
$str = <<<LABEL
$var
LABEL;
$str = <<<'LABEL'
$var
LABEL;
The first one is HEREDOC and $var would be evaluated. The second one is
NOWDOC and $var would be used literally. The following patch adds a
third version:
$str = <<<"LABEL"
$var
LABEL;
This acts as HEREDOC, therefore $var would be interpreted.
Comments?
cu, Lars
NOWDOC and $var would be used literally. The following patch adds a
third version:$str = <<<"LABEL"
$var
LABEL;
-1, we already have syntax for that.
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Hi Lars, oh wow no <<< again...
==================
as we introduce NOWDOC in 5.3 it would be logical to allow a double
quoted syntax sister of NOWDOC which acts as HEREDOC (same as for $var =
"$var" vs $var = '$var'). Currently we have the following options:
$var = "Hello world";
$str = <<<LABEL
$var
LABEL;
$str = <<<'LABEL'
$var
LABEL;
The first one is HEREDOC and $var would be evaluated. The second one is
NOWDOC and $var would be used literally. The following patch adds a
third version:
$str = <<<"LABEL"
$var
LABEL;
This acts as HEREDOC, therefore $var would be interpreted.
Comments?
Just one. Why?
(-1, in case that wasn't clear)
- Steph
Steph Fox wrote:
Just one. Why?
Probably to be consistent. Let's say a hypothetical user learns to use
NOWDOC before HEREDOC: which syntax are they more likely to use;
'NOWDOC' or "HEREDOC".
However, I too am -1 because this smacks of the Perl philosophy of "more
than one to do things", which, in terms of syntax, is completely
unnecessary.
--
Edward Z. Yang GnuPG: 0x869C48DA
HTML Purifier http://htmlpurifier.org Anti-XSS Filter
[[ 3FA8 E9A9 7385 B691 A6FC B3CB A933 BE7D 869C 48DA ]]
Hi Steph,
Am Sonntag, den 23.03.2008, 01:58 +0000 schrieb Steph Fox:
Just one. Why?
We have double and single quotes for variable assignments. On of the
reasons we use single quotes for NOWDOC was because it is as in variable
assignments. If we follow that argument, there is no reason why
$var = <<<"LABEL"
foo
LABEL;
should no work. That's why :-)
cu, Lars
$str = <<<"LABEL"
$var
LABEL;
-1 no please
-Hannes
Hello Lars,
to me this makes pretty much sense on a second glance as it perfectly
reflects what our string would do. And for someone learning 'NOWDOC',
using "HEREDOC" seems just natural.
So I am all +1
Consistency and satisfying expectations rocks!
marcus
Saturday, March 22, 2008, 9:17:27 PM, you wrote:
Hi,
as we introduce NOWDOC in 5.3 it would be logical to allow a double
quoted syntax sister of NOWDOC which acts as HEREDOC (same as for $var =
"$var" vs $var = '$var'). Currently we have the following options:
$var = "Hello world";
$str = <<<LABEL
$var
LABEL;
$str = <<<'LABEL'
$var
LABEL;
The first one is HEREDOC and $var would be evaluated. The second one is
NOWDOC and $var would be used literally. The following patch adds a
third version:
$str = <<<"LABEL"
$var
LABEL;
This acts as HEREDOC, therefore $var would be interpreted.
Comments?
cu, Lars
Best regards,
Marcus
Hello Lars,
to me this makes pretty much sense on a second glance as it perfectly
reflects what our string would do. And for someone learning 'NOWDOC',
using "HEREDOC" seems just natural.
So I am all +1
Consistency and satisfying expectations rocks!marcus
As the original proposer of nowdocs, I also give it a +1 for
consistency!
-- Gwynne, Daughter of the Code
"This whole world is an asylum for the incurable."
Saturday, March 22, 2008, 9:17:27 PM, you wrote:
Hi,
as we introduce NOWDOC in 5.3 it would be logical to allow a double
quoted syntax sister of NOWDOC which acts as HEREDOC (same as for
$var =
"$var" vs $var = '$var'). Currently we have the following options:
$var = "Hello world";
$str = <<<LABEL
$var
LABEL;
$str = <<<'LABEL'
$var
LABEL;
The first one is HEREDOC and $var would be evaluated. The second
one is
NOWDOC and $var would be used literally. The following patch adds a
third version:
$str = <<<"LABEL"
$var
LABEL;
This acts as HEREDOC, therefore $var would be interpreted.
Comments?
cu, LarsBest regards,
Marcus
Hello Lars,
to me this makes pretty much sense on a second glance as it perfectly
reflects what our string would do. And for someone learning 'NOWDOC',
using "HEREDOC" seems just natural.
So I am all +1
Consistency and satisfying expectations rocks!marcus
As the original proposer of nowdocs, I also give it a +1 for
consistency!
Would the closing tag also require the quotes (none/single/double)
depending upon how the opening tag was quoted (or not)?
And is "double-quoting" going to be in addition to no quoting?
--
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
As the original proposer of nowdocs, I also give it a +1 for consistency!
"Consistency" must be the most over-used word on the list lately :)
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
2008/3/24, Marcus Boerger helly@php.net:
Hello Lars,
to me this makes pretty much sense on a second glance as it perfectly
reflects what our string would do. And for someone learning 'NOWDOC',
using "HEREDOC" seems just natural.
So I am all +1
Consistency and satisfying expectations rocks!marcus
+1 for same reason.
However, the patch is wrong, see below:
$foo = 'foobar';
$test = <<<"a
$foo
a;
var_dump($test);
/*
string(7) "foobar
"
*/
$test = b<<<"a"
$foo
a;
/*
Parse error: syntax error, unexpected $end
*/
Here's a possible fix:
Regards,
Felipe Pena.
Hi Felipe,
Am Freitag, den 28.03.2008, 20:28 -0300 schrieb Felipe Pena:
2008/3/24, Marcus Boerger helly@php.net:
[...]
+1 for same reason.However, the patch is wrong, see below:
$foo = 'foobar';
$test = <<<"a
$foo
a;var_dump($test);
/*
string(7) "foobar
"
*/$test = b<<<"a"
$foo
a;/*
Parse error: syntax error, unexpected $end
*/Here's a possible fix:
Thanks for bringing this up, didn't thought about that. I will create a
number of tests to cover that properly.
cu, Lars
Hi Felipe, ...,
Am Freitag, den 28.03.2008, 20:28 -0300 schrieb Felipe Pena:
2008/3/24, Marcus Boerger helly@php.net:
[...]
Here's a possible fix:
Tested your patch a bit further and it seems to work fine. Created a few
other test cases. Can we close the voting until 00:00h GMT, April, 2nd
2008? If there is a majority for the syntax until then, I will commit
the patch and the test cases.
cu, Lars
2008? If there is a majority for the syntax until then, I will commit
the patch and the test cases.
I think if we want to have a vote it should be explicitly announced as a
vote, shouldn't it?
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Hi,
Am Dienstag, den 01.04.2008, 13:21 -0700 schrieb Stanislav Malyshev:
2008? If there is a majority for the syntax until then, I will commit
the patch and the test cases.I think if we want to have a vote it should be explicitly announced as a
vote, shouldn't it?
OK, fine. From now on this is an official vote. There is no need to vote
again if you did it before, but please raise you voice if you did not.
So let's extend the period until Friday, 4th April 2008, 0:00h CET.
cu, Lars
Lars Strojny wrote:
Hi,
Am Dienstag, den 01.04.2008, 13:21 -0700 schrieb Stanislav Malyshev:
2008? If there is a majority for the syntax until then, I will commit
the patch and the test cases.
I think if we want to have a vote it should be explicitly announced as a
vote, shouldn't it?OK, fine. From now on this is an official vote. There is no need to vote
again if you did it before, but please raise you voice if you did not.
So let's extend the period until Friday, 4th April 2008, 0:00h CET.cu, Lars
+1
--
Christopher Jones, Oracle
Email: christopher.jones@oracle.com Tel: +1 650 506 8630
Blog: http://blogs.oracle.com/opal/ Free PHP Book: http://tinyurl.com/f8jad
Follow me: http://friendfeed.com/ghrd
Hi,
Am Samstag, den 22.03.2008, 21:17 +0100 schrieb Lars Strojny:
[RFC] Double quoted NOWDOC is HEREDOC
I've added this RFC to the Wiki too:
http://wiki.php.net/rfc/heredoc-with-double-quotes
cu, Lars
Hi Lars,
Hi,
as we introduce NOWDOC in 5.3 it would be logical to allow a double
quoted syntax sister of NOWDOC which acts as HEREDOC (same as for $var =
"$var" vs $var = '$var'). Currently we have the following options:
+1 for the record here, I was already in favour of having that in 5.3
in the previous thread.
And to show how great is our new wiki, Lars created a RFC as well:
http://wiki.php.net/rfc/heredoc-with-double-quotes
Thanks for your work!