Re: [PHP-DEV] Expansion of PHP Symbols?

2023-04-21 Thread Ilija Tovilo
Hi Deleu > From Rob's email (https://externals.io/message/120094#120097), the argument > against a simple "use" statement seems quite natural. I certainly don't > want to redefine "use int|float as Number" in every PHP file I work with, > so naturally we would go back to type alias definition, sym

Re: [PHP-DEV] Expansion of PHP Symbols?

2023-04-21 Thread Larry Garfield
On Fri, Apr 21, 2023, at 3:12 PM, Deleu wrote: > Hey thanks for the reply. I just want to go an extra mile to make my points > clearer. Please take no negative connotation from what I posted towards > Composer, PSR-0, PSR-4 or such. I was merely describing things from an > end-user perspective to

Re: [PHP-DEV] Expansion of PHP Symbols?

2023-04-21 Thread Deleu
On Fri, Apr 21, 2023 at 11:18 AM Larry Garfield wrote: > To piggyback on this point and go deeper into the "Composer/PSR-4" part: > > PSR-4 (and PSR-0 before it) are just standard rule for mapping a class > name to a file. The intent is that an arbitrary autoloader written by > anyone can then "

Re: [PHP-DEV] Expansion of PHP Symbols?

2023-04-21 Thread Tim Düsterhus
Hi On 4/21/23 12:49, Deleu wrote: What is fundamentally different about Type Alias as opposed to something like Enums that was recently introduced? Type aliases might include an unbounded number of types and are … aliases, which based on [1] is a major issue. To my understanding, PHP curren

Re: [PHP-DEV] Expansion of PHP Symbols?

2023-04-21 Thread Larry Garfield
On Fri, Apr 21, 2023, at 9:02 AM, Rowan Tommins wrote: > Hi Marco! > > First of all, please do stick around, and keep learning and being > curious. Sometimes out of the box thinking does get somewhere. > > That said, a lot of what you've written here is actually what already > happens, and the pr

Re: [PHP-DEV] Expansion of PHP Symbols?

2023-04-21 Thread Rowan Tommins
On 21/04/2023 12:11, Deleu wrote: - PHP looks up \Foo\strlen. It's not on the Symbols table. Trigger autoload for it. - Autoload does NOT find a definition, register in the Symbols table that \Foo\strlen is undefined. - PHP looks up \strlen. It's not on the Symbols table, trigger autoload for i

Re: [PHP-DEV] Expansion of PHP Symbols?

2023-04-21 Thread Deleu
On Fri, Apr 21, 2023 at 6:02 AM Rowan Tommins wrote: > Hi Marco! > > I'll come back to type aliases in a second, but first: > > > can `function bar() {}` be a symbol? > > It already is. When you run foo('bar'), PHP has to look up what the > definition of "foo" is in a table of functions. In princ

Re: [PHP-DEV] Expansion of PHP Symbols?

2023-04-21 Thread Deleu
On Fri, Apr 21, 2023 at 4:10 AM Robert Landers wrote: > Hey Deleu, > > I ended up on this list in the first place because I wanted to figure > out how to implement type aliases. I can confidently say why no one > wants to touch it with a ten-foot pole: implementing this will require > refactoring

Re: [PHP-DEV] [Discussion] Callable types via Interfaces

2023-04-21 Thread Ilija Tovilo
Hi Larry and Nicolas! > https://wiki.php.net/rfc/allow_casting_closures_into_single-method_interface_implementations > https://wiki.php.net/rfc/allow-closures-to-declare-interfaces-they-implement > https://wiki.php.net/rfc/structural-typing-for-closures > > What we propose is to instead lean into

Re: [PHP-DEV] Expansion of PHP Symbols?

2023-04-21 Thread Rowan Tommins
Hi Marco! First of all, please do stick around, and keep learning and being curious. Sometimes out of the box thinking does get somewhere. That said, a lot of what you've written here is actually what already happens, and the problems are elsewhere. On 21/04/2023 04:54, Deleu wrote: 1- U

Re: [PHP-DEV] Expansion of PHP Symbols?

2023-04-21 Thread Robert Landers
Hey Deleu, I ended up on this list in the first place because I wanted to figure out how to implement type aliases. I can confidently say why no one wants to touch it with a ten-foot pole: implementing this will require refactoring the entire type system. There currently isn't a 'type table'; supp