opionions here!
> On Jul 9, 2024, at 10:53 AM, Levi Morrison
> wrote:
>
> On Tue, Jul 9, 2024 at 10:18 AM Richard Miles <mailto:richard@miles.systems>> wrote:
>>
>> Hi Levi,
>>
>> First, were you able to discuss this with authors of other ge
Howdy people,
> On Jul 1, 2024, at 10:01 AM, Richard Miles wrote:
>
> Hey Larry,
>
>>> interface iArrayA ['a' => string ]
>>> interface iArrayB extends iArrayA ['b' => string, 'c' => ?string, ‘d’
>>> =>
p with Chocloaty.
Python ships with pip, and Node ships with npm.
Python didn’t start shipping with pip until version >= 3.4.
I would be happy to see PHP shipping with the composer as a default-enabled
flag.
Best,
Richard Miles
ut the community is strong and we’ll manage, even if at a
turtles pace :)
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
g, ‘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
t; mixed ]
$a = new Dict;
Maybe the signature for Dict is:
class Dict {}
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
someone has an opinions/considerations on wether to extend the current array
implemention with metadata or creating a
dedicated structure via a new class `SplTypeDefinedArray` that would be
helpful. The posed implementation reads as a
static cast, but it doesnt have to be implemented as such.
Best,
Richard Miles
laring types is actually just a typecast, so perhaps
that should change or
we just extend the current array implementation to hold another metadata field.?
Best,
Richard Miles
arameterized_traits
I’m also interested in this; it will help see branches like these.
Did you ever get the POC working? What did you feel like was the biggest hurdle?
Best,
Richard Miles
read:
interface iArrayA [ ‘a’ => string ]
interface iArrayB extends iArrayA [ ‘b’ => string, ‘c’ => ?string]
P.s. I also started a draft for the addition of the `apache_connection_stream`
function https://github.com/php/php-src/pull/14047
and would like to create an RFC for that as well.
Best,
Richard Miles
I suppose you don't actually need the `is` op; you can use the implements &|
extends keywords :)
Best,
Richard Miles
> On Jun 26, 2024, at 5:26 PM, Richard Miles wrote:
>
>> We've done some initial work related to this as part of PHP Foundation work:
>> <
ase, a typecast would do it.
class A {
public iArrayB $array = [
‘a’ => ‘hello’,
‘b’ => ‘world'
];
}
If generics and the is operator get passed then one could in theory do.
class A {
public T $array = [
‘a’ => ‘hello’
];
}
$a = new A;
Best,
Richard Miles
Hey Derick,
> A summary on the state of this, and actual genetics will be available soon
> too.
My mouth is watering already :) I have tons of free time at the moment if you’d
like any help!
Best,
Richard Miles
wed. If the
set of possible values needs to increase a typecast would do it.
class A {
public iArrayB $array = [
‘a’ => ‘hello’,
‘b’ => ‘world'
];
}
Best,
Richard Miles
> Begin forwarded message:
>
> From: Bilge
> Subjec
I wonder if this could be helpful in implementing Generic Classes?
https://wiki.php.net/rfc/generics
Interface Boxable {...}
class Box {...}
Taken from the RFC ^
Best,
Richard Miles
.
Would love to get involved with generic classes.
How would you pose the syntax?
Best,
Richard Miles
> On Jun 26, 2024, at 2:08 PM, Bilge wrote:
>
> On 26/06/2024 20:59, Richard Miles wrote:
>> I think we should have typed arrays in PHP.
>
> Generics or bust.
>
> Cheers,
> Bilge
7;a' => 'profit'
];
$a : iArrayA &| iArrayB = [ // throws a RuntimeException since c does not
exist in iArrayA and b is required in iArrayB
'a' => 'fail'
'c' => ''
];
I'm not sure what the best data structure would be. Rob Landers suggested a
circular buffer in the pattern-matching email thread, but I'm open to anything.
Best,
Richard Miles
After a coffee break, I think this is how the language could do this in a
semantically pleasing way.
interface iArrayA ['a' => string ]
interface iArrayB extends iArrayA ['b' => string ]
$arr is iArrayA &| iArrayB
Best,
Richard Miles
> On Jun 26, 2024,
patible ways.
__
I think there is a need to ensure a key does not exist even if we’re not happy
about this syntax, but if not having `$arr is ['a' => string, 'b' => ?string,
…]` would still make me very happy.
Best,
Richard Miles
> On Jun 24, 2024, at 5:31
_value);
Please refer to the PR for the real implementation :) Thanks for your time!
PHP Wiki user: WookieeTyler
Best,
Richard Miles
Miles Systems LLC
Richard@Miles.Systems
(817) 789-3294

Confidentiality Notice: This email message, including any attachments, is for
the sole use of th
20 matches
Mail list logo