Re: [PHP-DEV] [Initial Feedback] Typed Arrays

Sent from my iPhone

On 1 Jul 2024, at 09:03, Richard Miles richard@miles.systems wrote:

There even was an RFC in voting which Joe implemented and it addresses nearly what is discussed it this thread https://wiki.php.net/rfc/arrayof

The link above has broken page links to the mailing list. I’ve found the externals.io history and have given it a read:

[

<apple-touch-icon.png>

Typed array properties V2
externals.io

](Typed array properties V2 - Externals)

[

<apple-touch-icon.png>

Introducing “Array Of” RFC
externals.io

](Introducing "Array Of" RFC - Externals)

It seems like everyone always gets really hung up on generics! That or how to syntactically implement this.

Hi

Given other improvements in the language, I don’t really see much need for the ability to specify fixed keys and their types (ie associative arrays) (I assume that’s what the “[‘a’ => string]” syntax is meant to be?)

Is there some fundamental aspect of the original arrayof RFC that prevents it from being revived today? The whole “does it include nulls” part is moot now presumably because we have both ? And |null, and the Type syntax is very common in docblocks.

Cheers

Stephen

Howdy Stephen,

It seems like everyone always gets really hung up on generics! That or how to syntactically implement this.

Hi

Given other improvements in the language, I don’t really see much need for the ability to specify fixed keys and their types (ie associative arrays) (I assume that’s what the “[‘a’ => string]” syntax is meant to be?)

Is there some fundamental aspect of the original arrayof RFC that prevents it from being revived today? The whole “does it include nulls” part is moot now presumably because we have both ? And |null, and the Type syntax is very common in docblocks.

I appreciate your feedback, and I think it’s valid. I try to compare my expectations to what is possible in typescript.
This comparison, while not a perfect match, is a great source of learning and inspiration.

While it’s true that PHP can take arrays and mash them into objects, I have to ask myself if this other language has this
feature, why don’t we? Is it because we don’t care? Is it a bad feature? I don’t think so.
I have a PR for WebSockets that integrates with Apache. Why hasn’t it been done before?
I don’t think this is an oversight on others, but rather, the community is what makes PHP better, challenging norms.

I’m not saying it will outperform what objectiveness currently provides, but I’m also not saying it won’t! I don’t think there’s a negative to
me implementing this syntax, and who knows, maybe it will be awesome for performance. I think what we should consider is that other
languages have this, and I feel the community wants this but is hung up on generics, which may have been an oversight.? I’m pretty new
here, and I’d love to make a meaningful impact, so the fact that this idea has been brought up before is encouraging.

Take, for example:

interface iArrayA [‘a’ => string, ‘b’ => string, ‘c’ => ?string, ‘d’ => SomeClass, ‘e’=> iArrayA, ‘f’ => mixed ]

$a = new Dict<string, iArrayA>;

Maybe the signature for Dict is:

class Dict<R is string | int, S is mixed> {}

Everyone harps on Generics, but no one can say how I’m supposed to model iArrayA if we focus on Generics.
We cannot safely define this now, as iArrayA is not a valid interface. I believe that is what I’m advocating for alone.
Array interfaces.

Best,
Richard Miles

On 1 Jul 2024, at 10:05, Richard Miles richard@miles.systems wrote:

Howdy Stephen,

It seems like everyone always gets really hung up on generics! That or how to syntactically implement this.

Hi

Given other improvements in the language, I don’t really see much need for the ability to specify fixed keys and their types (ie associative arrays) (I assume that’s what the “[‘a’ => string]” syntax is meant to be?)

Is there some fundamental aspect of the original arrayof RFC that prevents it from being revived today? The whole “does it include nulls” part is moot now presumably because we have both ? And |null, and the Type syntax is very common in docblocks.

I appreciate your feedback, and I think it’s valid. I try to compare my expectations to what is possible in typescript.
This comparison, while not a perfect match, is a great source of learning and inspiration.

While it’s true that PHP can take arrays and mash them into objects, I have to ask myself if this other language has this
feature, why don’t we? Is it because we don’t care? Is it a bad feature? I don’t think so.
I have a PR for WebSockets that integrates with Apache. Why hasn’t it been done before?
I don’t think this is an oversight on others, but rather, the community is what makes PHP better, challenging norms.

I’m not saying it will outperform what objectiveness currently provides, but I’m also not saying it won’t! I don’t think there’s a negative to
me implementing this syntax, and who knows, maybe it will be awesome for performance. I think what we should consider is that other
languages have this, and I feel the community wants this but is hung up on generics, which may have been an oversight.? I’m pretty new
here, and I’d love to make a meaningful impact, so the fact that this idea has been brought up before is encouraging.

Take, for example:

interface iArrayA [‘a’ => string, ‘b’ => string, ‘c’ => ?string, ‘d’ => SomeClass, ‘e’=> iArrayA, ‘f’ => mixed ]

$a = new Dict<string, iArrayA>;

Maybe the signature for Dict is:

class Dict<R is string | int, S is mixed> {}

Everyone harps on Generics, but no one can say how I’m supposed to model iArrayA if we focus on Generics.
We cannot safely define this now, as iArrayA is not a valid interface. I believe that is what I’m advocating for alone.
Array interfaces.

Best,
Richard Miles

Hi Richard,

To be clear I’m not really suggesting “mash arrays into objects”. I’m saying that with the advent of constructor property promotion, property types, readonly properties, property hooks, etc, there’s much less reason (and IMO much less developer desire) to use a “hash” (associative array) in PHP in the first place. Classes (and the instances of them) with typed properties seem like a much more common solution to that problem, in my view. That they can be created from an associative array using argument unpacking (aka the splat operator) is a side benefit that facilitates working with legacy code (which is often full of associative arrays) IMO.

What a class with properties and all the modern niceties can’t (ergonomically) do, is provide a list of objects of a given type - which is exactly what the arrayof (aka Type) syntax would give us.

Cheers

Stephen

On Mon, Jul 1, 2024, at 05:05, Richard Miles wrote:

Howdy Stephen,

It seems like everyone always gets really hung up on generics! That or how to syntactically implement this.

Hi

Given other improvements in the language, I don’t really see much need for the ability to specify fixed keys and their types (ie associative arrays) (I assume that’s what the “[‘a’ => string]” syntax is meant to be?)

Is there some fundamental aspect of the original arrayof RFC that prevents it from being revived today? The whole “does it include nulls” part is moot now presumably because we have both ? And |null, and the Type syntax is very common in docblocks.

I appreciate your feedback, and I think it’s valid. I try to compare my expectations to what is possible in typescript.

This comparison, while not a perfect match, is a great source of learning and inspiration.

While it’s true that PHP can take arrays and mash them into objects, I have to ask myself if this other language has this

feature, why don’t we? Is it because we don’t care? Is it a bad feature? I don’t think so.

I have a PR for WebSockets that integrates with Apache. Why hasn’t it been done before?

I don’t think this is an oversight on others, but rather, the community is what makes PHP better, challenging norms.

I’m not saying it will outperform what objectiveness currently provides, but I’m also not saying it won’t! I don’t think there’s a negative to

me implementing this syntax, and who knows, maybe it will be awesome for performance. I think what we should consider is that other

languages have this, and I feel the community wants this but is hung up on generics, which may have been an oversight.? I’m pretty new

here, and I’d love to make a meaningful impact, so the fact that this idea has been brought up before is encouraging.

Take, for example:

interface iArrayA [‘a’ => string, ‘b’ => string, ‘c’ => ?string, ‘d’ => SomeClass, ‘e’=> iArrayA, ‘f’ => mixed ]

$a = new Dict<string, iArrayA>;

Maybe the signature for Dict is:

class Dict<R is string | int, S is mixed> {}

Everyone harps on Generics, but no one can say how I’m supposed to model iArrayA if we focus on Generics.

We cannot safely define this now, as iArrayA is not a valid interface. I believe that is what I’m advocating for alone.

Array interfaces.

Best,

Richard Miles

Hello,

I appreciate your feedback, and I think it’s valid. I try to compare my expectations to what is possible in typescript.

I feel like Typescript is the wrong model to follow. The type system in Typescript is Turing Complete (https://github.com/microsoft/TypeScript/issues/14833) and php barely has a type system. It doesn’t even have consistent type checking, for that matter (properties are checked differently than arguments which are checked differently than constructor arguments — and the fact they agree with each other at all, is interesting, because they don’t arrive at the same conclusions in the same way. I’ve been dealing with subtle bugs here for weeks on an unannounced RFC implementation) and this is why generics is a can of worms: implementing it would essentially force a rewrite of the type system into a proper type system.

In my honest opinion, before we can even have this type of conversation, we need to have an RFC about the syntax (there may already be one, I haven’t checked — and internet is spotty where I currently am). The pattern matching RFC was proposed as though it would be written one way, people have thrown out ideas of different syntax, but I don’t think there is an “official” syntax. A good starting point may be to simply propose an RFC about syntax so future RFCs can be consistent.

— Rob

Howdy Rob,

I appreciate your feedback, and I think it’s valid. I try to compare my expectations to what is possible in typescript.

I feel like Typescript is the wrong model to follow. The type system in Typescript is Turing Complete (https://github.com/microsoft/TypeScript/issues/14833) and php barely has a type system. It doesn’t even have consistent type checking, for that matter (properties are checked differently than arguments which are checked differently than constructor arguments — and the fact they agree with each other at all, is interesting, because they don’t arrive at the same conclusions in the same way. I’ve been dealing with subtle bugs here for weeks on an unannounced RFC implementation) and this is why generics is a can of worms: implementing it would essentially force a rewrite of the type system into a proper type system.

In my honest opinion, before we can even have this type of conversation, we need to have an RFC about the syntax (there may already be one, I haven’t checked — and internet is spotty where I currently am). The pattern matching RFC was proposed as though it would be written one way, people have thrown out ideas of different syntax, but I don’t think there is an “official” syntax. A good starting point may be to simply propose an RFC about syntax so future RFCs can be consistent.

— Rob

I actually did not know it was turning complete, very interesting! While it is easy for anyone to say, ‘we’re not even close to typescript,’
that’s precisely what brings me to the table. I would be happy with us just voting on syntax. It seems like past RFC’s only
ever got hung up on generics (wrongfully?). I want to work on implementing generics, too, after this. I feel this is probably a good
stepping stone.

A vote would solidify the following:

interface iArrayA [‘a’ => string ]
interface iArrayB extends iArrayA [‘b’ => string, ‘c’ => ?string, ‘d’ => SomeClass, ‘e’=> iArrayA, ‘f’ => mixed ]

$array = (iArrayA &| iArrayB) [ ‘a’ => ‘hello’ ];

That would allow us to move into an implementation discussion, which is also absolutely needed.

Best,
Richard Miles

On Mon, Jul 1, 2024, at 12:21 PM, Richard Miles wrote:

Howdy Rob,

I appreciate your feedback, and I think it’s valid. I try to compare my expectations to what is possible in typescript.

I feel like Typescript is the wrong model to follow. The type system in Typescript is Turing Complete (TypeScripts Type System is Turing Complete · Issue #14833 · microsoft/TypeScript · GitHub) and php barely has a type system. It doesn’t even have consistent type checking, for that matter (properties are checked differently than arguments which are checked differently than constructor arguments — and the fact they agree with each other at all, is interesting, because they don’t arrive at the same conclusions in the same way. I’ve been dealing with subtle bugs here for weeks on an unannounced RFC implementation) and this is why generics is a can of worms: implementing it would essentially force a rewrite of the type system into a proper type system.

In my honest opinion, before we can even have this type of conversation, we need to have an RFC about the syntax (there may already be one, I haven’t checked — and internet is spotty where I currently am). The pattern matching RFC was proposed as though it would be written one way, people have thrown out ideas of different syntax, but I don’t think there is an “official” syntax. A good starting point may be to simply propose an RFC about syntax so future RFCs can be consistent.

— Rob

I actually did not know it was turning complete, very interesting!
While it is easy for anyone to say, ‘we're not even close to
typescript,’
that’s precisely what brings me to the table. I would be happy with us
just voting on syntax. It seems like past RFC’s only
ever got hung up on generics (wrongfully?). I want to work on
implementing generics, too, after this. I feel this is probably a good
stepping stone.

A vote would solidify the following:

interface iArrayA ['a' => string ]
interface iArrayB extends iArrayA ['b' => string, 'c' => ?string, ‘d’
=> SomeClass, ‘e’=> iArrayA, ‘f’ => mixed ]
$array = (iArrayA &| iArrayB) [ ‘a’ => ‘hello’ ];

That would allow us to move into an implementation discussion, which is
also absolutely needed.

Best,
Richard Miles

As Stephen already said, we have this already. It's spelled like this:

class A {
  public function __construct(public string $a) {}
}

class B extends A {
  public function __construct(
    public string $a,
    public string $b,
    public ?string $c,
    public SomeClass $d,
    public A $e,
    mixed $f,
  ) {}
}

If you know the keys at code time, use a class, not an array. Full stop, period, end of story. Using an array as a record object in PHP >= 7 *is wrong*. It's slower, more memory-intensive, less ergonomic, harder to debug, harder to statically analyze, harder to learn, harder to use. If you're still doing that, it's past time to stop. If your legacy application from the PHP 3 days is still doing that, it's past time to upgrade it.

So new language features to make "misuse arrays as objects" easier are actively counter-productive.

A Dict / Hashmap is appropriate when you do *not* know the keys in advance, and thus cannot use a pre-defined object for it. There are plenty of use cases for that, but in that case, all you need type-wise is the key type and value type, because all entries should be of the same type (give or take inheritance). Mixing in random other types... is wrong. That's the whole reason why people keep talking about collections/typed arrays/generics.

So the "array interface" syntax you keep posting is actively counter-productive.

--Larry Garfield

Hey Larry,

interface iArrayA [‘a’ => string ]
interface iArrayB extends iArrayA [‘b’ => string, ‘c’ => ?string, ‘d’
=> SomeClass, ‘e’=> iArrayA, ‘f’ => mixed ]
$array = (iArrayA &| iArrayB) [ ‘a’ => ‘hello’ ];

I will start by advocating for how much cleaner this is from its objective counterpart. It also aids in reusability.

As Stephen already said, we have this already. It’s spelled like this:

class A {
public function __construct(public string $a) {}
}

class B extends A {
public function __construct(
public string $a,
public string $b,
public ?string $c,
public SomeClass $d,
public A $e,
mixed $f,
) {}
}

If you know the keys at code time, use a class, not an array. Full stop, period, end of story. Using an array as a record object in PHP >= 7 is wrong. It’s slower, more memory-intensive, less ergonomic, harder to debug, harder to statically analyze, harder to learn, harder to use. If you’re still doing that, it’s past time to stop. If your legacy application from the PHP 3 days is still doing that, it’s past time to upgrade it.

I feel this is a common misconception, or can you clarify this for me?
Array access is faster than object access.
I didn’t want to claim this without first running the benchmarks:

[
php-benchmarks.png

php-benchmarks/benchmark_array_vs_object.php at master · EFTEC/php-benchmarks
github.com

](php-benchmarks/benchmark_array_vs_object.php at master · EFTEC/php-benchmarks · GitHub)

Good news is these benchmarks already exist! I just cloned this repo, required the table builder, and profit.

composer require eftec/mapache-commons
php benchmark_array_vs_object.php

To save you the trouble you can refer to this Medium post:

[
0*gG1FcLJE3h2vybWa.jpeg

PHP, Benchmark time
medium.com

](PHP, Benchmark time. Benchmark array versus object | by Jorge Castro | Cook php | Medium)

I figured you’d say something about the ’newest’ syntax so I added

class DummyClass
{
    public function __construct(public $hello, public $second, public $third)
    {
    }
}

Thus, my results are as follows:

Array numeric no factory: 0% baseline at 0.414 (mind you im on an older MacBook)
Array no factory 0.95%
Array numeric factory: 566.1%
Array factory: 650.07%
Object Constructor: 609.03%
Object no constructor 82.77%
Object no constructor setter/getter: 2058.43%
Object no constructor magic methods: 2273.91%
Object no constructor stdClass: 112.53%

These were pretty consistent with the medium post.

So new language features to make “misuse arrays as objects” easier are actively counter-productive.

A Dict / Hashmap is appropriate when you do not know the keys in advance, and thus cannot use a pre-defined object for it. There are plenty of use cases for that, but in that case, all you need type-wise is the key type and value type, because all entries should be of the same type (give or take inheritance). Mixing in random other types… is wrong. That’s the whole reason why people keep talking about collections/typed arrays/generics.

I think the point we can take away from this is that we could
speed arrays up even more if we make typed arrays stricly bound and not a ‘hash’.
If we knew the keys in advance then in theroy we could make access based on the
numeric value of that property in the interface definition.
But as I keep saying this is worth investigating.

So the “array interface” syntax you keep posting is actively counter-productive.

I’m absolutely just trying to help while I have an abundance of free time. I do admit to been
a n00b sometimes. If something isn’t fast lets talk about how we might make it faster.
I don’t think anyone disagrees with you in that this is a big undertaking that shouldn’t be
taken lightly, but the community is strong and we’ll manage, even if at a turtles pace :slight_smile:

If my understanding above is correct then Larry’s message actually highlights why we
should implement this feature. The community thinks objects are the way to go,
since its the only way to go.

Best,
Richard Miles

(Attachment php-benchmarks.png is missing)

(Attachment 0*gG1FcLJE3h2vybWa.jpeg is missing)

On Mon, Jul 1, 2024, at 15:14, Larry Garfield wrote:

On Mon, Jul 1, 2024, at 12:21 PM, Richard Miles wrote:

Howdy Rob,

I appreciate your feedback, and I think it’s valid. I try to compare my expectations to what is possible in typescript.

I feel like Typescript is the wrong model to follow. The type system in Typescript is Turing Complete (https://github.com/microsoft/TypeScript/issues/14833) and php barely has a type system. It doesn’t even have consistent type checking, for that matter (properties are checked differently than arguments which are checked differently than constructor arguments — and the fact they agree with each other at all, is interesting, because they don’t arrive at the same conclusions in the same way. I’ve been dealing with subtle bugs here for weeks on an unannounced RFC implementation) and this is why generics is a can of worms: implementing it would essentially force a rewrite of the type system into a proper type system.

In my honest opinion, before we can even have this type of conversation, we need to have an RFC about the syntax (there may already be one, I haven’t checked — and internet is spotty where I currently am). The pattern matching RFC was proposed as though it would be written one way, people have thrown out ideas of different syntax, but I don’t think there is an “official” syntax. A good starting point may be to simply propose an RFC about syntax so future RFCs can be consistent.

— Rob

I actually did not know it was turning complete, very interesting!

While it is easy for anyone to say, ‘we’re not even close to

typescript,’

that’s precisely what brings me to the table. I would be happy with us

just voting on syntax. It seems like past RFC’s only

ever got hung up on generics (wrongfully?). I want to work on

implementing generics, too, after this. I feel this is probably a good

stepping stone.

A vote would solidify the following:

interface iArrayA [‘a’ => string ]

interface iArrayB extends iArrayA [‘b’ => string, ‘c’ => ?string, ‘d’

=> SomeClass, ‘e’=> iArrayA, ‘f’ => mixed ]

$array = (iArrayA &| iArrayB) [ ‘a’ => ‘hello’ ];

That would allow us to move into an implementation discussion, which is

also absolutely needed.

Best,

Richard Miles

As Stephen already said, we have this already. It’s spelled like this:

class A {

public function __construct(public string $a) {}

}

class B extends A {

public function __construct(

public string $a,

public string $b,

public ?string $c,

public SomeClass $d,

public A $e,

mixed $f,

) {}

}

If you know the keys at code time, use a class, not an array. Full stop, period, end of story. Using an array as a record object in PHP >= 7 is wrong. It’s slower, more memory-intensive, less ergonomic, harder to debug, harder to statically analyze, harder to learn, harder to use. If you’re still doing that, it’s past time to stop. If your legacy application from the PHP 3 days is still doing that, it’s past time to upgrade it.

So new language features to make “misuse arrays as objects” easier are actively counter-productive.

A Dict / Hashmap is appropriate when you do not know the keys in advance, and thus cannot use a pre-defined object for it. There are plenty of use cases for that, but in that case, all you need type-wise is the key type and value type, because all entries should be of the same type (give or take inheritance). Mixing in random other types… is wrong. That’s the whole reason why people keep talking about collections/typed arrays/generics.

So the “array interface” syntax you keep posting is actively counter-productive.

–Larry Garfield

No offense, but this whole reply seems pretty counter-productive. “Just use objects” might be a valid use-case for you, but that isn’t true for everyone.

There are a number of uses for arrays (values vs references, cow memory efficiency, spoed, flexibility, etc) over objects, not to mention all the legacy code out there that people won’t seem to pay to rewrite…

— Rob

Howdy people,

On Jul 1, 2024, at 10:01 AM, Richard Miles richard@miles.systems wrote:

Hey Larry,

interface iArrayA [‘a’ => string ]
interface iArrayB extends iArrayA [‘b’ => string, ‘c’ => ?string, ‘d’
=> SomeClass, ‘e’=> iArrayA, ‘f’ => mixed ]
$array = (iArrayA &| iArrayB) [ ‘a’ => ‘hello’ ];

I will start by advocating for how much cleaner this is from its objective counterpart. It also aids in reusability.

As Stephen already said, we have this already. It’s spelled like this:

class A {
public function __construct(public string $a) {}
}

class B extends A {
public function __construct(
public string $a,
public string $b,
public ?string $c,
public SomeClass $d,
public A $e,
mixed $f,
) {}
}

If you know the keys at code time, use a class, not an array. Full stop, period, end of story. Using an array as a record object in PHP >= 7 is wrong. It’s slower, more memory-intensive, less ergonomic, harder to debug, harder to statically analyze, harder to learn, harder to use. If you’re still doing that, it’s past time to stop. If your legacy application from the PHP 3 days is still doing that, it’s past time to upgrade it.

I feel this is a common misconception, or can you clarify this for me?
Array access is faster than object access.
I didn’t want to claim this without first running the benchmarks:

[
<php-benchmarks.png>

php-benchmarks/benchmark_array_vs_object.php at master · EFTEC/php-benchmarks
github.com

](php-benchmarks/benchmark_array_vs_object.php at master · EFTEC/php-benchmarks · GitHub)

Good news is these benchmarks already exist! I just cloned this repo, required the table builder, and profit.

composer require eftec/mapache-commons
php benchmark_array_vs_object.php

To save you the trouble you can refer to this Medium post:

[
<0*gG1FcLJE3h2vybWa.jpeg>

PHP, Benchmark time
medium.com

](PHP, Benchmark time. Benchmark array versus object | by Jorge Castro | Cook php | Medium)

I figured you’d say something about the ’newest’ syntax so I added

class DummyClass
{
    public function __construct(public $hello, public $second, public $third)
    {
    }
}

Thus, my results are as follows:

Array numeric no factory: 0% baseline at 0.414 (mind you im on an older MacBook)
Array no factory 0.95%
Array numeric factory: 566.1%
Array factory: 650.07%
Object Constructor: 609.03%
Object no constructor 82.77%
Object no constructor setter/getter: 2058.43%
Object no constructor magic methods: 2273.91%
Object no constructor stdClass: 112.53%

These were pretty consistent with the medium post.

So new language features to make “misuse arrays as objects” easier are actively counter-productive.

A Dict / Hashmap is appropriate when you do not know the keys in advance, and thus cannot use a pre-defined object for it. There are plenty of use cases for that, but in that case, all you need type-wise is the key type and value type, because all entries should be of the same type (give or take inheritance). Mixing in random other types… is wrong. That’s the whole reason why people keep talking about collections/typed arrays/generics.

I think the point we can take away from this is that we could
speed arrays up even more if we make typed arrays stricly bound and not a ‘hash’.
If we knew the keys in advance then in theroy we could make access based on the
numeric value of that property in the interface definition.
But as I keep saying this is worth investigating.

So the “array interface” syntax you keep posting is actively counter-productive.

I’m absolutely just trying to help while I have an abundance of free time. I do admit to been
a n00b sometimes. If something isn’t fast lets talk about how we might make it faster.
I don’t think anyone disagrees with you in that this is a big undertaking that shouldn’t be
taken lightly, but the community is strong and we’ll manage, even if at a turtles pace :slight_smile:

If my understanding above is correct then Larry’s message actually highlights why we
should implement this feature. The community thinks objects are the way to go,
since its the only way to go.

Best,
Richard Miles

So since im not getting any feedback about the above, we can concrete the fastness of array over objects access.

I’m ready to make this Syntax Proposal RFC but still need RFC karma.

Could someone please give my wiki.php.net account access: wookieetyler

Best,
Richard Miles

Hi Levi,

First, were you able to discuss this with authors of other generic
proposals or implementations? Derick Rethans and Arnaud Le Blanc both
have experience there.

This proposal has nothing to do with generics.
Derick Rethans responded in this thread, and I’ve specifically addressed his current (generic?) branch.
It is a community misconception that typed arrays have anything to do with Generics and also
has been discussed in this thread in detail.
Is gatekeeping you asking me to repeat what was discussed back to you
specifically so you can grant me privileges? I digress and I’ll concede.

Second, do you have any work towards an implementation? Technically,
an implementation is not required for RFCs. However, for this feature,

I did start on the implementation and have linked the branch above, but stopped after
Rob Landers’ suggestion:

In my honest opinion, before we can even have this type of conversation, we need to have an RFC about the syntax (there may already be one, I haven’t checked — and internet is spotty where I currently am). The pattern matching RFC was proposed as though it would be written one way, people have thrown out ideas of different syntax, but I don’t think there is an “official” syntax. A good starting point may be to simply propose an RFC about syntax so future RFCs can be consistent.

— Rob

Also, directly from the how-to page on the mailing list “https://wiki.php.net/rfc/howto

"Email internals@lists.php.net to measure reaction to your intended proposal.
State who would implement the feature, or whether the proposal is only a “concept”.
Proceed with an RFC if feedback is not negative or if a detailed RFC will clarify the proposal. “

So, unless I’m mistaken, I think we’re going about this correctly.? I’m not sure whoes 'voice to follow’ since
Rob and Levi have differing opinions on paths forward. I personally would like the syntactic approval before
I implement the full code. The complete implementation details would need its own discussion.

I can guarantee any RFC without an implementation is dead-on-arrival.

You’re not the first person to have a guarantee in this thread… :slight_smile:


Lastly, for a completely separate project, I have a draft/working PR for WebSockets in Apache PHP-CGI context:

[
14047.png

RFC - Added the apache_connection_stream() function for CGI WebSockets by RichardTMiles · Pull Request #14047 · php/php-src
github.com

](RFC - Added the apache_connection_stream() function for CGI WebSockets by RichardTMiles · Pull Request #14047 · php/php-src · GitHub)

Please let me any other reasons I should not have krama: wookieetyler

Best,
Richard Miles

(Attachment 14047.png is missing)

On Tue, Jul 9, 2024 at 10:18 AM Richard Miles <richard@miles.systems> wrote:

Hi Levi,

First, were you able to discuss this with authors of other generic
proposals or implementations? Derick Rethans and Arnaud Le Blanc both
have experience there.

This proposal has nothing to do with generics.
Derick Rethans responded in this thread, and I've specifically addressed his current (generic?) branch.
It is a community misconception that typed arrays have anything to do with Generics and also
has been discussed in this thread in detail.
Is gatekeeping you asking me to repeat what was discussed back to you
specifically so you can grant me privileges? I digress and I'll concede.

Please calm down. I am not gatekeeping, as I don't even have the
know-how to grant you the wiki karma.

Second, do you have any work towards an implementation? Technically,
an implementation is not required for RFCs. However, for this feature,

I did start on the implementation and have linked the branch above, but stopped after
Rob Landers’ suggestion:

In my honest opinion, before we can even have this type of conversation, we need to have an RFC about the syntax (there may already be one, I haven’t checked — and internet is spotty where I currently am). The pattern matching RFC was proposed as though it would be written one way, people have thrown out ideas of different syntax, but I don’t think there is an “official” syntax. A good starting point may be to simply propose an RFC about syntax so future RFCs can be consistent.

— Rob

Also, directly from the how-to page on the mailing list "PHP: rfc:howto;

"Email internals@lists.php.net to measure reaction to your intended proposal.
State who would implement the feature, or whether the proposal is only a “concept”.
Proceed with an RFC if feedback is not negative or if a detailed RFC will clarify the proposal. “

So, unless I'm mistaken, I think we’re going about this correctly.? I’m not sure whoes 'voice to follow’ since
Rob and Levi have differing opinions on paths forward. I personally would like the syntactic approval before
I implement the full code. The complete implementation details would need its own discussion.

Syntax is part of the implementation, but it's not the hard part from
a technical perspective. The hard part is actually implementing the
semantics and behavior, and plumbing it through all the parts of the
engine. It does not matter what the "skin" of the thing looks like, if
the mechanics of the things simply don't work.

Also, I don't mean to say you need a complete implementation, either.
More of a "proof of concept" which means that core issues have been
identified, and are either fixed or outlined so other people are aware
of them.

I can guarantee any RFC without an implementation is dead-on-arrival.

You're not the first person to have a guarantee in this thread… :slight_smile:

No, but I authored and co-authored many RFCs over many years. I was
trying to be helpful. I'll state that I don't think your RFC has any
chance of success. The syntax, the semantics, the discussion so far,
especially that typed arrays have nothing to do with generics... I
think its chance of success is quite low. I messaged you to try and be
helpful despite my own opinions on such things, and tried to point you
to things that I thought would be helpful if you wish to pursue this:

1. A proper discussion with authors of other proposals, including
ones related to generics, is prudent. Even if you believe they aren't
related, I'm sure they've learned things about the engine that would
be helpful to you in your implementation.
2. A proposal for a significant feature without the bones of an
implementation simply will not pass. Since the RFC process was
created, I don't think it's ever happened. There have been cases where
the implementation changed from RFC to what landed (Dmitry completely
reimplemented from scratch one of my RFCs that passed, I think it was
return types), but a basic implementation is needed to fully
understand the problems and challenges of the implementation.

Lastly, I'll note that I responded to you off-list. I don't know why
you brought a private conversation back to the list without discussing
it with me. There wasn't anything rude or inappropriate, and the rest
of the list certainly could have gone without this conversation. We
should respect the time of everyone participating on the list.

Levi,

I did read this email in full before responding in parts. To that I’ll start by saying I’m sorry for origionally beinging this
back into the internals thread and not in a DM. I did not realize it was a DM on oversight, seriously my bad. I still think
we can all learn from this and your opionions here!

On Jul 9, 2024, at 10:53 AM, Levi Morrison levi.morrison@datadoghq.com wrote:

On Tue, Jul 9, 2024 at 10:18 AM Richard Miles <richard@miles.systems> wrote:

Hi Levi,

First, were you able to discuss this with authors of other generic
proposals or implementations? Derick Rethans and Arnaud Le Blanc both
have experience there.

This proposal has nothing to do with generics.
Derick Rethans responded in this thread, and I’ve specifically addressed his current (generic?) branch.
It is a community misconception that typed arrays have anything to do with Generics and also
has been discussed in this thread in detail.
Is gatekeeping you asking me to repeat what was discussed back to you
specifically so you can grant me privileges? I digress and I’ll concede.

Please calm down. I am not gatekeeping, as I don’t even have the
know-how to grant you the wiki karma.

I’ve asked for karma three separate times in this feed alone and it’s pretty unclear who has that
ability, my apologies for assuming. Since you responded to that message specifically, I figured you were a karma granter.

Second, do you have any work towards an implementation? Technically,
an implementation is not required for RFCs. However, for this feature,

I did start on the implementation and have linked the branch above, but stopped after
Rob Landers’ suggestion:

In my honest opinion, before we can even have this type of conversation, we need to have an RFC about the syntax (there may already be one, I haven’t checked — and internet is spotty where I currently am). The pattern matching RFC was proposed as though it would be written one way, people have thrown out ideas of different syntax, but I don’t think there is an “official” syntax. A good starting point may be to simply propose an RFC about syntax so future RFCs can be consistent.

— Rob

Also, directly from the how-to page on the mailing list “PHP: rfc:howto

"Email internals@lists.php.net to measure reaction to your intended proposal.
State who would implement the feature, or whether the proposal is only a “concept”.
Proceed with an RFC if feedback is not negative or if a detailed RFC will clarify the proposal. “

So, unless I’m mistaken, I think we’re going about this correctly.? I’m not sure whoes 'voice to follow’ since
Rob and Levi have differing opinions on paths forward. I personally would like the syntactic approval before
I implement the full code. The complete implementation details would need its own discussion.

Syntax is part of the implementation, but it’s not the hard part from
a technical perspective. The hard part is actually implementing the
semantics and behavior, and plumbing it through all the parts of the
engine. It does not matter what the “skin” of the thing looks like, if
the mechanics of the things simply don’t work.

Also, I don’t mean to say you need a complete implementation, either.
More of a “proof of concept” which means that core issues have been
identified, and are either fixed or outlined so other people are aware
of them.

I see what you’re saying, but getting from my original idea to where we are
now was a community effort. Asking the community for more input still doesn’t
seem like a bad idea and has been ideal thus far; and it’s what Rob suggested.

If you can’t grant me karma and Rob can’t grant me karma, it’s still unclear who
I should be asking. Casper Langemeijer at least has a @php.net email and
believed we should have typed arrays saying, “if anything we would get better talks
about generics”. Now I’d love to hear everyones thoughts and have a clear discussion
on what it is im trying to solve, and how that might best look. I personally like letting
ideas simmer a bit so I feel like I’ve given everyone plenty of time to come up with
better syntactic approaches. Even in the work I had done it is very clear that syntax
is a critical starting point that influences, if not dictates, expected behavior.

I can guarantee any RFC without an implementation is dead-on-arrival.

You’re not the first person to have a guarantee in this thread… :slight_smile:

No, but I authored and co-authored many RFCs over many years. I was
trying to be helpful. I’ll state that I don’t think your RFC has any
chance of success. The syntax, the semantics, the discussion so far,
especially that typed arrays have nothing to do with generics… I
think its chance of success is quite low. I messaged you to try and be
helpful despite my own opinions on such things, and tried to point you
to things that I thought would be helpful if you wish to pursue this:

I’d really like to understand what makes you say this regarding generics?
I didn’t start the conversation with the subject Generics, it’s always been
about Typed Arrays. I appreciate you trying to be helpful and I’m sorry this
came back so poorly. I am willing to take this through to implementation,
but again am just looking for the correct voice to follow.
Maybe someone to say, 'I’ll grant you karma if…’. They may agree with you.

  1. A proper discussion with authors of other proposals, including
    ones related to generics, is prudent. Even if you believe they aren’t
    related, I’m sure they’ve learned things about the engine that would
    be helpful to you in your implementation.

I still would like to understand how generics relate in your perspective that differs
from the points I’ve made in this thread.

  1. A proposal for a significant feature without the bones of an
    implementation simply will not pass. Since the RFC process was
    created, I don’t think it’s ever happened. There have been cases where
    the implementation changed from RFC to what landed (Dmitry completely
    reimplemented from scratch one of my RFCs that passed, I think it was
    return types), but a basic implementation is needed to fully
    understand the problems and challenges of the implementation.

This just differs from other advice already given and the online how-to page, but seriously
I’ll just get started if thats what needs to happen. You have this opinion with past experience
granted, but your not really giving practical feedback on why this implementation is poor.

Lastly, I’ll note that I responded to you off-list. I don’t know why
you brought a private conversation back to the list without discussing
it with me. There wasn’t anything rude or inappropriate, and the rest
of the list certainly could have gone without this conversation. We
should respect the time of everyone participating on the list.

This is entirely on me! I didn’t realize It was a DM and should not have been brought
back onto the list. I’m sorry!

Best,
Richard Miles

On Tuesday, 9 July 2024 at 18:50, Richard Miles <richard@miles.systems> wrote:

I’ve asked for karma three separate times in this feed alone and it’s pretty unclear who has that
ability, my apologies for assuming. Since you responded to that message specifically, I figured you were a karma granter.

Probably because this is not how one asks for karma.

Get wiki RFC karma (this is only required if you don't have a VCS account for php.net. PHP developers can log on with their credentials and already have the necessary karma to create RFCs):

- Register for a wiki account at PHP: Register.
- Email internals@lists.php.net requesting RFC karma for your wiki account. In the email, remind people about the RFC you plan to create. Note that RFC karma does not automatically give you karma to vote. See PHP: rfc:voting

The implication, that seemingly every other person has managed to do, is to send a NEW email thread.
The traffic of the list is extremely high at the moment, and the handful of people that can grant karma do not have the time to sift through every single random email.

This just differs from other advice already given and the online how-to page, but seriously
I'll just get started if thats what needs to happen. You have this opinion with past experience
granted, but your not really giving practical feedback on why this implementation is poor.

The how-to page *explicitly* says:

Consider whether the feature concept should be voted on before you invest time in implementation.
Or perhaps an implementation is needed to show the feature is feasible; in this case, make it clear whether or not the current implementation is being voted on.

For a lot of large features, like what you are proposing, one needs some sort of implementation to even determine the feasibility.

I have barely read the thread, but I have serious doubts that you understand the complexity of the task at hand, as you are far from the first one to propose this nor have a go at this.
Moreover, considering the volume of the list and RFCs, any RFC that is just about syntax is something that I personally will just vote no without reading as I have, frankly, more pressing things to do.

Your RFC and proposal would have way more discussion if you were not proposing this when feature freeze is fast approaching and people are trying to wrap up RFCs they have worked on for the past year.
For the sake of your proposal, I would seriously reconsider proposing this prior to September.

Sincerely,
Gina P. Banyard

Howdy Gina,

Thanks for explicitly clarifying this for me. My other proposal had it explicitly in the first message
to no avail, so I wasn’t sure. Just a humble programmer is trying to make things better.

I haven’t been under the assumption that anyone thought or would think it is unfeasible.
Through this discussion and benchmarks, we proved, if anything, its potential use. I get
people wanting something more substantial. I’m absolutely not trying to waste anyones
time and have started on the implementation but stopped due to feedback from this list.
Maybe that was the mistake.

I have barely read the thread,

It’s hard to show my value when we won’t read the thread.

but I have serious doubts that you understand the complexity of the task at hand, as you are far from the first one to propose this nor have a go at this.

There is not a lot of community encouragement going around today :frowning: I’m not sure this
matters at all. I promise to try my best!

Moreover, considering the volume of the list and RFCs, any RFC that is just about syntax is something that I personally will just vote no without reading as I have, frankly, more pressing things to do.

I’m okay with the doubts and appreciate your consideration of the matter.
Also, thanks for taking the time to respond!

If a vote is unneeded, and no one has any feedback regarding why this syntax would not work,
then I will implement it exactly as planned:

[
TypedArraysRFC.png

TypedArraysRFC/README.md at main · RichardTMiles/TypedArraysRFC
github.com

](TypedArraysRFC/README.md at main · RichardTMiles/TypedArraysRFC · GitHub)

Your RFC and proposal would have way more discussion if you were not proposing this when feature freeze is fast approaching and people are trying to wrap up RFCs they have worked on for the past year.
For the sake of your proposal, I would seriously reconsider proposing this prior to September.

PHP: rfc:release_cycle_update.

It was also suggested that I open a new, updated thread by another contributor in a DM.
I suppose I’ll hold off on this now given todays feedback.

It seems like no one is in direct opposition of what im proposing, but want the POC!
I’ll get to work on this and get back to everyone!

Best,
Richard Miles

···

I’ve asked for karma three separate times in this feed alone and it’s pretty unclear who has that
ability, my apologies for assuming. Since you responded to that message specifically, I figured you were a karma granter.

Probably because this is not how one asks for karma.

Get wiki RFC karma (this is only required if you don’t have a VCS account for php.net. PHP developers can log on with their credentials and already have the necessary karma to create RFCs):

  1. Register for a wiki account at https://wiki.php.net/start?do=register.

  2. Email internals@lists.php.net requesting RFC karma for your wiki account. In the email, remind people about the RFC you plan to create. Note that RFC karma does not automatically give you karma to vote. See https://wiki.php.net/rfc/voting#rfc_proposer

The implication, that seemingly every other person has managed to do, is to send a NEW email thread.
The traffic of the list is extremely high at the moment, and the handful of people that can grant karma do not have the time to sift through every single random email.

This just differs from other advice already given and the online how-to page, but seriously
I’ll just get started if thats what needs to happen. You have this opinion with past experience
granted, but your not really giving practical feedback on why this implementation is poor.

The how-to page explicitly says:

Consider whether the feature concept should be voted on before you invest time in implementation.
Or perhaps an implementation is needed to show the feature is feasible; in this case, make it clear whether or not the current implementation is being voted on.

For a lot of large features, like what you are proposing, one needs some sort of implementation to even determine the feasibility.

(Attachment TypedArraysRFC.png is missing)