Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124113 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id BA6DA1A009C for ; Sun, 30 Jun 2024 16:13:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719764083; bh=BRMb1azaz45g7eISgbTbWTqyj9WMhYH5j+qAdrlAA9s=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=CkXayE6uVf0tGbtnjJICTCL2Nk7guQQNCR8/ZyRLLrRvWVa8KvG5ThI4Z3tW/DxYi pmUr01NDiCeCoX/9fp3B1DGYiy1tRyI+C/AOaxxamAooZmfMnSq0o763yWfzwm2mAa fU4HPchkyP55QUnBciE1MwYayCNgiXjUOn5zx5vtkPuygg+mScMm44/4TCABcR1/Ln FgKgvd5J0C5HygM6R2rkIFo+YyqUWae8xA77SGVjjNeJfNUB2UmrG8sVBGgwtmNMqM OhfNs/lMUL1L23nXMhqoGupwXqh8nsFwDeL2AlzHNIJqLqqM38CTRKnPmJGkWAAFjR iRTbKF1PmVxYA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id EA7D31804C5 for ; Sun, 30 Jun 2024 16:14:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 30 Jun 2024 16:14:42 +0000 (UTC) Received: by mail-yb1-f175.google.com with SMTP id 3f1490d57ef6-e02c4983bfaso2107982276.2 for ; Sun, 30 Jun 2024 09:13:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719764002; x=1720368802; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=BRMb1azaz45g7eISgbTbWTqyj9WMhYH5j+qAdrlAA9s=; b=DuemFx0EUKWneuJeXEArBRhVUm8ciBhLZwPXF1/LOF6ZuHp1xYWcxXL1VG8LuBslSm LC/IJ9grpasTK74aloCTVS2Nz+4v2ixD/i5X7YRTwxxwcec47PcE//9SuQG2BVRHmHpU 4i7LSptFPCD+5Ofr4F5k38XKaZq/G1VNW+tSuV9jItpVPzoUIl9BuQwgbUEVvP0dzQJV BzMTv79a+6FuDROqQCLninRtGntdeIsLk46W4ov363XpDDmlAw5QbjSHjGQgJH6p8CXf JNEd/NOj6tPUMLYqEtjmiyURfrnNtBukq/u98ykqnvjXp8kktUQ8cbLg0262muAwCVo5 4X1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719764002; x=1720368802; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BRMb1azaz45g7eISgbTbWTqyj9WMhYH5j+qAdrlAA9s=; b=RA2Otr6GK08Vegt19limPlQRDGHLRne+C675l0occUkrSfSfmdSQm7bPD5TWYxIKdX nlvQgWPEbDriVSMiR6FuUUprOSMTjFUFtG5FLco9kANiecHmeHVuOVuYPskSg0mPTJjf 01TL0tJyqLwdSOnCkCaGEVNJBBb3xolWFpPlS0gutqw6+83eubDxw4S4kFLomlNC8ARc ySMVjLIXZBKUhvzjcAJkCcFB9C26Eb014fTdmjRSJMzHqCc4YONvwU7x3xqpXhzHzC6X ivFJk09ydm5jFpzUzjmyMVRGG8tmFqp0tvbEdB+UoYPxBEXKc6/woVcVYgjjxXIfn/AW JFJQ== X-Gm-Message-State: AOJu0YwH9SVnJ9skdt2yqvsD5JYIaB4/KwiWGyZiJAK+PSyTaDr0du5N b681oyeRVJ7TyI2WHRXpI33C5YUFQoa74wbAXBM7MtQAZKW9gC7rifG0m3+YzDb+KbOSDqucCXK 2kAo5hxSX3UDgYoP/RgCgNpUajqY= X-Google-Smtp-Source: AGHT+IHM25ABN/EdRvv1HKUiwKoGyNzhDnYJQ0Q4DS5BY9nB2Zme5vC1hyQUecTNwWtJh2wslcfth+aIVTKQuJDxWVw= X-Received: by 2002:a25:6601:0:b0:e03:6147:4c91 with SMTP id 3f1490d57ef6-e036ec63938mr3805579276.60.1719764001691; Sun, 30 Jun 2024 09:13:21 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: <4ECBB519-B129-426F-93AE-33738A1ABA06@miles.systems> In-Reply-To: <4ECBB519-B129-426F-93AE-33738A1ABA06@miles.systems> Date: Sun, 30 Jun 2024 18:13:12 +0200 Message-ID: Subject: Re: [PHP-DEV] [Initial Feedback] Typed Arrays To: Richard Miles Cc: php internals , Derick Rethans , Levi Morrison Content-Type: multipart/alternative; boundary="0000000000006b201c061c1dc258" From: michal.brzuchalski@gmail.com (=?UTF-8?Q?Micha=C5=82_Marcin_Brzuchalski?=) --0000000000006b201c061c1dc258 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Richard, czw., 27 cze 2024, 22:33 u=C5=BCytkownik Richard Miles napisa=C5=82: > > > I worked with Joe Watkins to do a proof-of-concept for generic traits. > > It's a bit old since it's from 2017, but could be a useful starting > > point if you are serious about pursuing this idea: > > > > > https://github.com/php/php-src/compare/master...morrisonlevi:php-src:para= meterized_traits > > > I=E2=80=99m 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? > 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 I must admit that the collection proposal is bit too complex to address such tiny but powerfully in my opinion functionality which is typed array. What Derick showed looks more like generic collection and such require declaring it's type. In my opinion this is way too mush hassle to declare as many collection types as many usages in application. Also two collection types with the same collection item type will not be compatible from type perspective. While typed array seems much more clear and compatible in all places where typed array is needed without declaring separate type for each usage. If I were to choose between typed-array and collection like Derick showed a little bit I'd choose typed arrays definitely as a first feature to be merged into PHP. Cheers, Micha=C5=82 Marcin Brzuchalski > --0000000000006b201c061c1dc258 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Richard,

czw., 27 cze 2024, 22:33 u=C5=BCytk= ownik Richard Miles <richard@miles.systems> napisa=C5=82:

> I worked with Joe Watkins to do a proof-of-concept for generic traits.=
> It's a bit old since it's from 2017, but could be a useful sta= rting
> point if you are serious about pursuing this idea:
>
> https://github.com/php/php-src/compare/master...morrisonlevi:php-src:p= arameterized_traits


I=E2=80=99m also interested in this; it will help see branches like these.<= br> Did you ever get the POC working? What did you feel like was the biggest hu= rdle?

T= here even was an RFC in voting which Joe implemented and it addresses nearl= y what is discussed it this thread=C2=A0https://wiki.php.net/rfc/arrayof

<= /div>
I must admit that the collection<Dict> proposa= l is bit too complex to address such tiny but powerfully in my opinion func= tionality which is typed array. What Derick showed looks more like generic = collection and such require declaring it's type. In my opinion this is = way too mush hassle to declare as many collection types as many usages in a= pplication. Also two collection types with the same collection item type wi= ll not be compatible from type perspective. While typed array seems much mo= re clear and compatible in all places where typed array is needed without d= eclaring separate type for each usage.

If I were to choose between typed-array and collection like = Derick showed a little bit I'd choose typed arrays definitely as a firs= t feature to be merged into PHP.

Cheers,
Micha=C5=82 Marcin Brzuchalski=C2= =A0
--0000000000006b201c061c1dc258--