Re: [PHP-DEV] Feedback for nullc Idea

2025-04-05 Thread Kamil Tekiela
On Sun, 23 Mar 2025 at 12:52, Robert Chapin wrote: > > Hi PHP folks, > > I submitted a proposal on Monday that received no replies. The idea was > about adding a functional construct nullc() that could act as an inline > null coalesce for a variable. That task is currently not possible in a > nu

Re: [PHP-DEV] Feedback for nullc Idea

2025-03-25 Thread Robert Chapin
On 3/25/2025 4:11 PM, Rowan Tommins [IMSoP] wrote: Writing coalesce($foo, 0) or ($foo ?? 0) is a small cost when writing the code to save cost every time anyone reads it. I see, part of the concern is just avoiding implicit type coercion.  Yes, that would be an understandable reason to requir

Re: [PHP-DEV] Feedback for nullc Idea

2025-03-25 Thread Rowan Tommins [IMSoP]
On 25 March 2025 16:42:45 GMT, Robert Chapin wrote: >On 3/25/2025 4:45 AM, Rowan Tommins [IMSoP] wrote: >> The implied default in the first is 'off', but in the second it's 'on'. >I thought the implied default was null. By "implied", I'm talking about the observed behaviour: if you give it n

Re: [PHP-DEV] Feedback for nullc Idea

2025-03-25 Thread Robert Chapin
On 3/25/2025 4:45 AM, Rowan Tommins [IMSoP] wrote: My point is that because null is not going to be coerced by the language to either 'on' nor 'off', there's an implied default depending how you write the expression. That kind of user mistake is hard for me to wrap my mind around.  I don't exp

Re: [PHP-DEV] Feedback for nullc Idea

2025-03-25 Thread Rowan Tommins [IMSoP]
On 25 March 2025 05:53:30 GMT, Robert Chapin wrote: >I may have over-simplified the examples.  Comparing $input === 'yes' will have >the same result whether $input is null or 'none' or an empty string.  So not >implying a result type, just want to compare a literal or other variable to >$in

Re: [PHP-DEV] Feedback for nullc Idea

2025-03-24 Thread Robert Chapin
On 3/23/2025 11:10 AM, Larry Garfield wrote: I'm not sure it justifies a new pseudo-function language construct. Fair enough.  Thank you for the feedback. On 3/23/2025 2:37 PM, Rowan Tommins [IMSoP] wrote: It's telling that all your examples with ?? put a value other than null on the right-ha

Re: [PHP-DEV] Feedback for nullc Idea

2025-03-24 Thread Aimeos | Norbert Sendetzky
On 23.03.25 19:37, Rowan Tommins [IMSoP] wrote: I'm sympathetic to the problem you're trying to solve - the precedence of ?? isn't always helpful - but I'm not sure I like the proposed solution, for 3 reasons. 1) The name "nullc" is over-shortened and cryptic. The "c" looks almost like an acc

Re: [PHP-DEV] Feedback for nullc Idea

2025-03-23 Thread Rowan Tommins [IMSoP]
On 23/03/2025 12:52, Robert Chapin wrote: Hi PHP folks, I submitted a proposal on Monday that received no replies.  The idea was about adding a functional construct nullc() that could act as an inline null coalesce for a variable.  That task is currently not possible in a nullc() user functio

Re: [PHP-DEV] Feedback for nullc Idea

2025-03-23 Thread Larry Garfield
On Sun, Mar 23, 2025, at 8:37 AM, Kamil Tekiela wrote: > On Sun, 23 Mar 2025 at 12:52, Robert Chapin wrote: >> >> Hi PHP folks, >> >> I submitted a proposal on Monday that received no replies. The idea was >> about adding a functional construct nullc() that could act as an inline >> null coalesce

[PHP-DEV] Feedback for nullc Idea

2025-03-23 Thread Robert Chapin
Hi PHP folks, I submitted a proposal on Monday that received no replies.  The idea was about adding a functional construct nullc() that could act as an inline null coalesce for a variable.  That task is currently not possible in a nullc() user function, but instead requires an expression like