>On Sep 18, 2014 9:36 AM, "Johannes Schlüter"
wrote:
>
> On Thu, 2014-09-18 at 12:41 +0100, Andrea Faulds wrote:
> > We could use a function *syntax*, though, but I don’t like this idea.
> > coalesce() and ifsetor() are both ugly to me, and it’s not super
> > obvious what they do:
> >
> > var_
On 18 September 2014 14:34, Johannes Schlüter wrote:
> On Thu, 2014-09-18 at 12:41 +0100, Andrea Faulds wrote:
>> We could use a function *syntax*, though, but I don’t like this idea.
>> coalesce() and ifsetor() are both ugly to me, and it’s not super
>> obvious what they do:
>>
>> var_dump(co
On Thu, 2014-09-18 at 12:41 +0100, Andrea Faulds wrote:
> We could use a function *syntax*, though, but I don’t like this idea.
> coalesce() and ifsetor() are both ugly to me, and it’s not super
> obvious what they do:
>
> var_dump(coalesce($_GET[‘foobar’], 3));
>
> vs.
>
> var_dump($_GE
Pete Boere wrote (on 18/09/2014):
I'm seeing '??' as analogous to the way JS developers use '||', and I use
that all the time when writing JS.
Actually, JS's || is more analogous to the existing ?: operator, because
it checks for truthiness, not definedness (!empty() rather than isset(),
in P
On 18 Sep 2014, at 12:32, Pete Boere wrote:
> I'm seeing '??' as analogous to the way JS developers use '||', and I use
> that all the time when writing JS.
PHP already has a direct equivalent to ||, namely the ?: operator. However,
unfortunately PHP always spits out a notice on non-existent i
I'm seeing '??' as analogous to the way JS developers use '||', and I use
that all the time when writing JS.
Personally I wouldn't be interested in a function version because the
short-circuiting of '??' is an important distinction; not something you can
replicate with a function. Therefore having
On Sep 17, 2014, at 11:40, Matthew Fonda wrote:
> Hi Andrea,
>
> This is great -- thanks to you and Nikita for the work here.
>
> Syntax wise, I would prefer a function-like syntax, e.g. coalesce($a, $b,
> 'c') or ifsetor() instead of $a ?? $b ?? 'c'. I find this more readable,
> and it avoids a
Matthew Fonda wrote (on 17/09/2014):
Hi Andrea,
This is great -- thanks to you and Nikita for the work here.
Syntax wise, I would prefer a function-like syntax, e.g. coalesce($a, $b,
'c') or ifsetor() instead of $a ?? $b ?? 'c'. I find this more readable,
and it avoids any possible confusion ab
Hi Andrea,
This is great -- thanks to you and Nikita for the work here.
Syntax wise, I would prefer a function-like syntax, e.g. coalesce($a, $b,
'c') or ifsetor() instead of $a ?? $b ?? 'c'. I find this more readable,
and it avoids any possible confusion about precedence within the
expressions.
2014-09-17 10:58 GMT+02:00 Sara Golemon :
>
>> On Sep 16, 2014, at 13:46, "Kingsquare.nl - Robin Speekenbrink"
>> wrote:
>>
>> As a userland point of view on this: will this have a shorthand? i.e.
>> what will happen if i leave out the second part?
>>
>> ie.
>> $var = $_GET['test'] ?? ;
>>
>> wou
> On Sep 16, 2014, at 13:46, "Kingsquare.nl - Robin Speekenbrink"
> wrote:
>
> As a userland point of view on this: will this have a shorthand? i.e.
> what will happen if i leave out the second part?
>
> ie.
> $var = $_GET['test'] ?? ;
>
> would that be the same as
> $var = @$_GET['test'];
>
On 16 Sep 2014, at 21:46, Kingsquare.nl - Robin Speekenbrink
wrote:
> As a userland point of view on this: will this have a shorthand?
No.
> i.e.
> what will happen if i leave out the second part?
>
> ie.
> $var = $_GET['test'] ?? ;
>
> would that be the same as
> $var = @$_GET['test’];
No
2014-09-16 22:00 GMT+02:00 Christoph Becker :
> Andrea Faulds wrote:
>
>> On 16 Sep 2014, at 19:38, Adam Harvey wrote:
>>
>>> On 16 September 2014 11:34, Andrea Faulds wrote:
By popular demand, I’ve changed the RFC to instead propose a ?? operator,
after Nikita Popov generously donated
Andrea Faulds wrote:
> On 16 Sep 2014, at 19:38, Adam Harvey wrote:
>
>> On 16 September 2014 11:34, Andrea Faulds wrote:
>>> By popular demand, I’ve changed the RFC to instead propose a ?? operator,
>>> after Nikita Popov generously donated a working ?? patch. In doing so, the
>>> RFC is ren
Sorry, I mean to implement coalesce() as a token like isset() ?
Regards,
Thomas
Andrea Faulds wrote on 16.09.2014 21:30:
>
> On 16 Sep 2014, at 20:28, Thomas Bley wrote:
>
>> What are the pros and cons of a new operator vs. a new function? For example,
>> MySQL has a coalesce() function:
>>
On 16 Sep 2014, at 20:28, Thomas Bley wrote:
> What are the pros and cons of a new operator vs. a new function? For example,
> MySQL has a coalesce() function:
> http://dev.mysql.com/doc/refman/5.6/en/comparison-operators.html#function_coalesce
A function is useless as it wouldn’t stop you get
Andrea Faulds wrote on 16.09.2014 20:34:
>
> On 10 Sep 2014, at 10:31, Pierre Joye wrote:
>
>> On Tue, Sep 9, 2014 at 12:58 AM, Adam Harvey wrote:
>>> On 8 September 2014 07:56, Christoph Becker wrote:
>>> +1 on ?? — there's precedent for it, and it means we don't have to
>>> explain why the
> Really, you should thank Nikita, not me. He wrote the patch. ^^
He gets my bag of thanks for many things.
> Well, the patch is written for master. It could be back ported, but I
don’t know how.
> Also, even if there is a 5.7, it sounds like it will consist purely of
bug fixes and E_DEPRECATED w
On 16 Sep 2014, at 19:55, Shashank Kumar wrote:
> This will be a nice addition. Kudos to you!
Really, you should thank Nikita, not me. He wrote the patch. ^^
> Is there an issue targeting next minor for this? (assuming there is one)
Well, the patch is written for master. It could be back port
This will be a nice addition. Kudos to you!
Is there an issue targeting next minor for this? (assuming there is one)
On 16 Sep 2014, at 19:38, Adam Harvey wrote:
> On 16 September 2014 11:34, Andrea Faulds wrote:
>> By popular demand, I’ve changed the RFC to instead propose a ?? operator,
>> after Nikita Popov generously donated a working ?? patch. In doing so, the
>> RFC is renamed “Null Coalesce Operator”
On 16 September 2014 11:34, Andrea Faulds wrote:
> By popular demand, I’ve changed the RFC to instead propose a ?? operator,
> after Nikita Popov generously donated a working ?? patch. In doing so, the
> RFC is renamed “Null Coalesce Operator”.
>
> Please read it: https://wiki.php.net/rfc/isset_
On 10 Sep 2014, at 10:31, Pierre Joye wrote:
> On Tue, Sep 9, 2014 at 12:58 AM, Adam Harvey wrote:
>> On 8 September 2014 07:56, Christoph Becker wrote:
>> +1 on ?? — there's precedent for it, and it means we don't have to
>> explain why the shorthand form of an operator behaves differently to
On Tue, Sep 9, 2014 at 12:58 AM, Adam Harvey wrote:
> On 8 September 2014 07:56, Christoph Becker wrote:
>> Am 08.09.2014 15:58, schrieb Andrea Faulds:
>>> We could add such an operator, perhaps with the ?? syntax. However, I
>>> don’t really like the idea. It’s too similar to ?: so I don’t think
On 09/09/2014 18:08, rpar...@yamiko.org wrote:
I agree and think we should go with a different operator as others suggested.
If not ?? than we could use ?= like $foo ?= “default string”.
That reads like an assignment, rather than an expression - particularly
given PHP's large number of evalu
From: Andrey Andreev
Sent: Monday, September 8, 2014 5:16 PM
To: Andrea Faulds
Cc: Adam Harvey, Christoph Becker, PHP internals
>On Tue, Sep 9, 2014 at 3:07 AM, Andrea Faulds wrote:
>>
>> On 8 Sep 2014, at 23:58, Adam Harvey wrote:
>>
>>> +1 on ?? — there's precedent for it, and
On Tue, Sep 9, 2014 at 3:07 AM, Andrea Faulds wrote:
>
> On 8 Sep 2014, at 23:58, Adam Harvey wrote:
>
>> +1 on ?? — there's precedent for it, and it means we don't have to
>> explain why the shorthand form of an operator behaves differently to
>> the long form, which is just going to confuse use
On 8 September 2014 17:07, Andrea Faulds wrote:
>
> On 8 Sep 2014, at 23:58, Adam Harvey wrote:
>
>> +1 on ?? — there's precedent for it, and it means we don't have to
>> explain why the shorthand form of an operator behaves differently to
>> the long form, which is just going to confuse users.
>
On 8 Sep 2014, at 23:58, Adam Harvey wrote:
> +1 on ?? — there's precedent for it, and it means we don't have to
> explain why the shorthand form of an operator behaves differently to
> the long form, which is just going to confuse users.
FWIW, it already behaves differently:
oa-res-27-90:
On 8 September 2014 07:56, Christoph Becker wrote:
> Am 08.09.2014 15:58, schrieb Andrea Faulds:
>> We could add such an operator, perhaps with the ?? syntax. However, I
>> don’t really like the idea. It’s too similar to ?: so I don’t think
>> it’d be accepted, and even if it was, I’m not sure we
Am 08.09.2014 15:58, schrieb Andrea Faulds:
> On 8 Sep 2014, at 13:04, Shashank Kumar
> wrote:
>
>> Rather than giving a new meaning to an old operator why not have a
>> different operator for this? .NET has a 'null coalescing' operator
>> for the same purpose which works out quite well in the g
On 8 Sep 2014, at 09:06, Michael Wallner wrote:
> On 07/09/14 14:25, Andrea Faulds wrote:
>>
>> On 7 Sep 2014, at 13:22, Sherif Ramadan
>> wrote:
>>
>>> I've played around with this branch for a bit and seems reasonable,
>>> passes the tests, and doesn't seem to have any serious
>>> issues/me
Hi Andrea
Rather than giving a new meaning to an old operator why not have a
different operator for this?
.NET has a 'null coalescing' operator for the same purpose which works out
quite well in the given situation
and is non-ambiguous as well.
http://msdn.microsoft.com/en-us/library/ms173224.aspx
On Mon, Sep 8, 2014 at 4:06 AM, Michael Wallner wrote:
> On 07/09/14 14:25, Andrea Faulds wrote:
>
> >
> > There’s actually a quite serious issue just now, which is that it
> > evaluates the first operand twice if it’s not empty. This is because
> > $a ?: $b is expanded to empty($a) ? $b : $a, su
On 07/09/14 14:25, Andrea Faulds wrote:
>
> On 7 Sep 2014, at 13:22, Sherif Ramadan
> wrote:
>
>> I've played around with this branch for a bit and seems reasonable,
>> passes the tests, and doesn't seem to have any serious
>> issues/memories leaks AFAICT.
>
> There’s actually a quite serious i
Hi, Andrea
I feel more like Sherif Ramadan. Even so I've quite often been in the same
situation, I don't think it's a good solution to change something like
that, just for the shorthand-operator.
I think, the notice is really valuable when accessing the value and doing
something with it - like my
On 7 Sep 2014, at 13:22, Sherif Ramadan wrote:
> I've played around with this branch for a bit and seems reasonable, passes
> the tests, and doesn't seem to have any serious issues/memories leaks
> AFAICT.
There’s actually a quite serious issue just now, which is that it evaluates the
first op
I've played around with this branch for a bit and seems reasonable, passes
the tests, and doesn't seem to have any serious issues/memories leaks
AFAICT.
I can't stress enough, however, how important it is for us to avoid
inconsistencies in behavior between various forms of syntax. This is often
so
Hi Andrea,
On Sep 6, 2014 2:03 AM, "Andrea Faulds" wrote:
>
> Good evening,
>
> I’ve written an RFC and working patch which attempt to add this feature
which has been often requested: https://wiki.php.net/rfc/isset_ternary
I did not look at the patch yet but I like it from a feature point of vie
Good evening,
I’ve written an RFC and working patch which attempt to add this feature which
has been often requested: https://wiki.php.net/rfc/isset_ternary
Thanks!
--
Andrea Faulds
http://ajf.me/
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.
40 matches
Mail list logo