Re: [PHP-DEV] Local constants

2024-09-06 Thread Mike Schinkel
> On Sep 6, 2024, at 4:47 AM, Rowan Tommins [IMSoP] > wrote: > > On Fri, 6 Sep 2024, at 03:01, Mike Schinkel wrote: >>> Block-scoping doesn't have to allow shadowing of names, >> >> How exactly would that work? Are you suggesting to restrict the use of >> variable names to one per function b

Re: [PHP-DEV] Local constants

2024-09-06 Thread Rowan Tommins [IMSoP]
On Fri, 6 Sep 2024, at 03:01, Mike Schinkel wrote: >> Block-scoping doesn't have to allow shadowing of names, > > How exactly would that work? Are you suggesting to restrict the use of > variable names to one per function but still allow for block scoping? Yes. That's how C# works, for example

Re: [PHP-DEV] Local constants

2024-09-05 Thread Mike Schinkel
On Sep 5, 2024 at 5:46 PM, wrote: > Block-scoping doesn't have to allow shadowing of names, How exactly would that work? Are you suggesting to restrict the use of variable names to one per function but still allow for block scoping? Or if not, how would an inner block variable $x not shadow

Re: [PHP-DEV] Local constants

2024-09-05 Thread Rowan Tommins [IMSoP]
On 5 September 2024 16:53:32 BST, Mike Schinkel wrote: > >Not convinced? At least one other person has my same view of the dark despair >of block-scoping: > >https://forum.golangbridge.org/t/warning-for-accidental-variable-shadowing-with-block-scope/4715 > >Of all the Go code I have written, I

Re: [PHP-DEV] Local constants

2024-09-05 Thread Mike Schinkel
> On Sep 4, 2024, at 5:41 PM, Rob Landers wrote: >> > On Sep 4, 2024, at 16:45, Rob Landers > > > wrote: >> > >> > I think, conceptually, this makes sense, but maybe I'm the only one who >> > writes >> > >> > $arr = doSomething(); >> > $arr = array_map(fn($x) => $x->

Re: [PHP-DEV] Local constants

2024-09-04 Thread Rob Landers
On Wed, Sep 4, 2024, at 23:11, John Bafford wrote: > > > On Sep 4, 2024, at 16:45, Rob Landers wrote: > > > > I think, conceptually, this makes sense, but maybe I'm the only one who > > writes > > > > $arr = doSomething(); > > $arr = array_map(fn($x) => $x->prop, $arr); > > $arr = array_filt

Re: [PHP-DEV] Local constants

2024-09-04 Thread John Bafford
> On Sep 4, 2024, at 16:45, Rob Landers wrote: > > I think, conceptually, this makes sense, but maybe I'm the only one who writes > > $arr = doSomething(); > $arr = array_map(fn($x) => $x->prop, $arr); > $arr = array_filter($arr, $filterFunc); > > instead of > > $arr = array_filter(array_map

Re: [PHP-DEV] Local constants

2024-09-04 Thread Rob Landers
On Wed, Sep 4, 2024, at 22:17, John Bafford wrote: > On Sep 4, 2024, at 15:23, Rob Landers wrote: > > > > On Tue, Sep 3, 2024, at 05:20, HwapX wrote: > >> Hello internals! > >> > >> I was wondering, has there been any discussion about supporting local > >> constants (variables that cannot be re

Re: [PHP-DEV] Local constants

2024-09-04 Thread John Bafford
On Sep 4, 2024, at 15:23, Rob Landers wrote: > > On Tue, Sep 3, 2024, at 05:20, HwapX wrote: >> Hello internals! >> >> I was wondering, has there been any discussion about supporting local >> constants (variables that cannot be reassigned, perhaps even function >> parameters)? > > Out of curi

Re: [PHP-DEV] Local constants

2024-09-04 Thread Kamil Tekiela
Having constant parameters would be a tremendous help in refactoring old code. I would love having local constants.

Re: [PHP-DEV] Local constants

2024-09-04 Thread Rob Landers
On Tue, Sep 3, 2024, at 05:20, HwapX wrote: > Hello internals! > > I was wondering, has there been any discussion about supporting local > constants (variables that cannot be reassigned, perhaps even function > parameters)? Out of curiosity, what value would this bring to PHP? In my experience,

Re: [PHP-DEV] Local constants

2024-09-04 Thread Eugene Sidelnyk
> Hello internals! > > I was wondering, has there been any discussion about supporting local > constants (variables that cannot be reassigned, perhaps even function > parameters)? > As for me, I would've hoped that there were local constants in PHP and I'd want to provide some thoughts on this reg

Re: [PHP-DEV] Local constants

2024-09-04 Thread Mike Schinkel
> On Sep 2, 2024, at 11:20 PM, HwapX wrote: > Hello internals! > > I was wondering, has there been any discussion about supporting local > constants (variables that cannot be reassigned, perhaps even function > parameters)? +1 from me. -Mike