Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123904 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 9B8BF1A009C for ; Wed, 26 Jun 2024 23:26:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719444456; bh=AMAGv5SgrLaF3HW+YVeEvDmKivOl01NtpxtwySPKIwE=; h=From:Subject:Date:References:To:In-Reply-To:From; b=PEdR3C0sk/v3BrWHjFbVAh2sQifujargQ/G+t1f7Sq1JwjvzsL7c/KwFM2kXL+MIy UjZUpZciP5EABqbs27c7DkjA8xJs/eRez5FsXx04/1fpCy722R56wGgVnS6Sek61K3 VzvFbjQw4g/G8Dw+Eq6HhjKpgB3IUGM6E+tJ5DUdBqq4gL31TKkMrTb+egREsLxbuF A30WUQqUIB5t0rZsg/aBgc/PHWA1bJyPL9AzW7wn2PqyBczwnjIc/jzQDLz3T2uszQ Dq7xkXSTMo0ZinhZMF88aZmRUCpKVwr/GNj+cpf2e7uxRS/JAXW1+9kfdh4DFdQo6w QpdCprtahfSiw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6D805180951 for ; Wed, 26 Jun 2024 23:27:34 +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_MISSING, 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-io1-f41.google.com (mail-io1-f41.google.com [209.85.166.41]) (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 ; Wed, 26 Jun 2024 23:27:33 +0000 (UTC) Received: by mail-io1-f41.google.com with SMTP id ca18e2360f4ac-7f3d3919a4aso41835539f.1 for ; Wed, 26 Jun 2024 16:26:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=miles.systems; s=google; t=1719444374; x=1720049174; darn=lists.php.net; h=message-id:in-reply-to:to:references:date:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=pAruMSfOANQg4wVemkA1js6pdVBgHbqRiOwH0+zhet0=; b=hTi0MCGUne6nED+P5bdXJp1Md5Qs6oH5sfVrUq3GS2oIZGge0zaNa+HW04QpOD/XWN 89dkMRgGiWiC+xW/zl/BUm2K8lEAcErmWtiXc7DRLIS5Lw27Wo2PeLatf1f0K36kmf91 fCOWfFIL5Jbr5FjP3ptRirqAZ7KW8mQ2+DwpsztVKr5F25ioAKzbji1py8jwzTqoyGoR N8SCX+REr5f/Q/aHp74giOuZmhv8P3u0BvCXv1cwaueeTsS/Qv22kS5Zdbd7AxxcJ8M1 u+KDq27REx58caKIa+azv5NM6EugZZphs1PmTrEqXoQ1uJFwY266ZNfiHC7B+HnwaIv7 nZoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719444374; x=1720049174; h=message-id:in-reply-to:to:references:date:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pAruMSfOANQg4wVemkA1js6pdVBgHbqRiOwH0+zhet0=; b=HbaHbNV+R18vRjGHJilZK49+uP7hUiVITE4X+y9+OsuVOS8svO5HIeBtyPIytFff/o boq8E3oNFZwRjSrYM0sbTRwSo3tt6XS6VItapWGh8BLZCypSWjj8rm41ggRCBPWcCv+K JQr7Qa+T93hjTjtimpjnYjAIEHWmh5vvmcyKHDRMCZRLhZUcvwAOTXZ8YRYpk/wPB+03 Pv960OzqDNXLI0BKt4HgQaTeL2uwHT0Do4rEmMIFgyCPT5b17WbJKnfP3gZ8p2isfdlS i3MoB9iJMr95GLdizhlGFFuXKcxcFzA/mYQf9CIs/wsqdK1Nuq7q0LE8G0VjKH4T2sHS KLHQ== X-Gm-Message-State: AOJu0YxSSibVTwxSnQtBpR2/h0+l8hyDPMlDsy/tCHig8/GvtZbhaBXG +sZdD7HI5z6mgAU/UBoyUAU+O5FbSyOmenaUtOHHUvkwuUt1tjLevDa7s6urvWeOrAaFyKFlyBg ZfBCEJznyKdJVkKWyrEas7F666m6nchXL8mwDyw1CnUVvexkICZkhyD14FS2TFryXXTKrHLMdxY mjnbdsBP97yPj22FVMUclTbAn/KBU/poFjDgf2lIoP X-Google-Smtp-Source: AGHT+IE9nndDiSUjYeX3WYzy3IMZ18IQxshtPiZb/EVWIbYPQE6JGtnVopIlBrOdiRbeFdNCKfKsaA== X-Received: by 2002:a05:6602:6b89:b0:7eb:dc70:979c with SMTP id ca18e2360f4ac-7f3a4e68497mr1411675939f.21.1719444374505; Wed, 26 Jun 2024 16:26:14 -0700 (PDT) Received: from smtpclient.apple ([2601:283:4600:6770:1058:1c9c:6c8b:173a]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-7f45442e1dbsm3323039f.30.2024.06.26.16.26.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Jun 2024 16:26:14 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\)) Subject: Re: [PHP-DEV] [Initial Feedback] Typed Arrays Date: Wed, 26 Jun 2024 17:26:03 -0600 References: <6D0733B2-A1D1-45EC-B93E-029B1616A22F@miles.systems> <682DAE9D-7C53-4C2B-9ECF-9B8358DF0AA1@php.net> To: php internals In-Reply-To: <682DAE9D-7C53-4C2B-9ECF-9B8358DF0AA1@php.net> Message-ID: X-Mailer: Apple Mail (2.3774.600.62) From: richard@miles.systems (Richard Miles) > We've done some initial work related to this as part of PHP Foundation = work: > = After reviewing the PR I don't think this accurately captures what we're = attempting to do/discuss.=20 Are there other branches you could share? You=E2=80=99ve posed a lot of = new syntax. I have questions. collection(Dict) Articles Article> {} The code above is limiting compared to the posed syntax in this thread. = Since your just working on providing a specific datatype with a custom = syntax. What am I supposed to be able todo inside the {}? Why not?=20 collection(Dict
) Articles {} or just=20 Dict
Articles {} Seq
Articles {} and then there's the completely new syntax? Am I supposed to be able to = add methods in this block? class Articles extends Dict
{} If I'm not then it should read more like the following: $a =3D (Dict
) []; ____________________________________________________________ But this all feels off-topic. Because, we need to get Typed Array = syntax!=20 interface iArrayA ['a' =3D> string ] interface iArrayB implements iArrayA ['b' =3D> string, 'c' =3D> ?string = ] $array =3D iArrayA [ =E2=80=98a=E2=80=99 =3D> =E2=80=98hello' ]; // reads the same as a typecast $array =3D (iArrayA &| iArrayB) [ =E2=80=98a=E2=80=99 =3D> =E2=80=98hello' ]; // It=E2=80=99s essentially like a typecast, which should probably be = allowed. If the set of possible values needs to increase, a typecast = would do it.=20 class A { public iArrayB $array =3D [=20 =E2=80=98a=E2=80=99 =3D> =E2=80=98hello=E2=80=99, =E2=80=98b=E2=80=99 =3D> =E2=80=98world' ];=20 } If generics and the is operator get passed then one could in theory do. class A { public T $array =3D [=20 =E2=80=98a=E2=80=99 =3D> =E2=80=98hello=E2=80=99 ];=20 } $a =3D new A; Best, Richard Miles=