Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123957 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 650861A009C for ; Thu, 27 Jun 2024 19:41:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719517388; bh=cv+LUJFF9kD4ofYpHXB3xJN9uJx5r/ZFm0IvIrEMjfA=; h=From:Subject:Date:References:To:In-Reply-To:From; b=XlEjki+ZzyO9zGc1VoR3tag63EuhXJJcDB/9Po9+095k/OCJKVWn0NtPutJdbaOUz d4YjxCS6zWBDP2KoUVAKPv8xPL0FEOrEZngQO/qvOLenjMhzPzQKSV8B07aK8Cgqmp 43VTB30Tjr4l9sVSd6vOs3rAR11Cg2ZuNFbG5Ei/lvjAl/FvNFuBIPlS5O74T0vtn7 mNVMELZyI2clNa9hUHZn4v9EZDPLzeViT+RshKZUbkb2e14xLGekoO3J82bkDiyiLm PCltGyIac39RJr+F5LU+mzyWxxnzOjVAcuEF6i+8Rx+eOikq+JkBcU2w3zhmd/oHrv T9t7Z5ndp3sCw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 17E6218064E for ; Thu, 27 Jun 2024 19:43:07 +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,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-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49]) (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 ; Thu, 27 Jun 2024 19:43:06 +0000 (UTC) Received: by mail-io1-f49.google.com with SMTP id ca18e2360f4ac-7eee734a668so371731139f.3 for ; Thu, 27 Jun 2024 12:41:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=miles.systems; s=google; t=1719517307; x=1720122107; darn=lists.php.net; h=message-id:in-reply-to:to:references:date:subject:mime-version:from :from:to:cc:subject:date:message-id:reply-to; bh=Ee8qHd+guJK94yOARRnR9aF7rp+j0EcZr3MYVAK0TBs=; b=YaVqP3+dgfKBv+2GyTCFmfMmLDgmPXMp22zO9TLlT9jmpRxcKOmJx1fPCN+jm+RHYS x7L74i+dmrEF9rOTtm5KafRWviJVdQQZPsnw++qEu5MW6DmzbSoxIpzsf7FN0PcKq1dk KTMc+QUcuoHsP06QQxTVvtH81GXqCym67/uOMUUJP/VcJUctOQoed+j0GuA/HWYE25or qowfQUT53jTL5Rwxdlv+UsjP9W0PAXyJ3OxiQnjRgc7+6cMsgeB/SDOrij6k8NKfAeaq n/cfrrZ/P8mxh/D3SxCfNXTclPKNvV7mLABqj3RxhertTxHue4t38URnC4yJNzTbEnad v5ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719517307; x=1720122107; h=message-id:in-reply-to:to:references:date:subject:mime-version:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Ee8qHd+guJK94yOARRnR9aF7rp+j0EcZr3MYVAK0TBs=; b=veH+yyQx4nBuDC3vCVMHkoRpPa5e3UkiVWmlcRqsmaV6Yphu0tjW+zB8M3Y+S1D0be XcgDUjbDJtodi7H/4Q5l2whRD8nkXg2g2+odI2R2JqdL5BKjC4xETlty7XMB28//gwCw Mtrmy8ZpwHy1o7A0B6A4ouTyfQO28AXGF8WUOyZg8WTHlkFq+ACENu2VM0TQ22Onsu2r YGqy1XorWaXz0Hx8wwdxg7Tpte7gN3y+0ytNZnQJ5dMuodaTuvHBn1ynFDBZyou7uWcw CP1/SbOnJzxIVgQW2ATUmwJzZrSooa1F7x9Oq0JRhwYLjv4zkVf6vnbSA+sR3+6pLPMX w+Qw== X-Gm-Message-State: AOJu0YxLJGAHMprWp41ZTKCH5X8BkAgt0ZTr/Cl0hPxsUqcak17SkjTs bTAXIYyRL0WIQd49YUGTuPyLqOc7s802wjWT1TfOizP0SsO7U0jEVmwkIvN1E0PbcO7W99bZBuz p4jNiIJub7x+M/ogxtx6JIsUUDFpZSWFDeEnKeoVcJKJxNEaEtMfzb8eLVxpz8WocpqrkAwfs6Q hqcGuApLmanRS11GueIVorS+Yo8OjCzjUcrqDluaPX X-Google-Smtp-Source: AGHT+IGMvjZozzSy2ZmTHBswYOECi2vbV014bl+cNBZBy7ol4KCWhfqXG9+/DPvSjAuBjt7QmcGIxA== X-Received: by 2002:a05:6602:6401:b0:7eb:846f:4280 with SMTP id ca18e2360f4ac-7f3a15461a6mr1986295539f.16.1719517306936; Thu, 27 Jun 2024 12:41:46 -0700 (PDT) Received: from smtpclient.apple ([2601:283:4600:6770:1162:5bdb:4ea8:2245]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4bb73fa182csm86466173.111.2024.06.27.12.41.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Jun 2024 12:41:46 -0700 (PDT) Content-Type: multipart/alternative; boundary="Apple-Mail=_EB98EB60-7829-4182-9B5E-39BC4C7514C5" 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: Thu, 27 Jun 2024 13:41:35 -0600 References: <6D0733B2-A1D1-45EC-B93E-029B1616A22F@miles.systems> <682DAE9D-7C53-4C2B-9ECF-9B8358DF0AA1@php.net> <69CBCE02-0A07-4B9B-80B4-E2A1311E2642@miles.systems> To: php internals In-Reply-To: <69CBCE02-0A07-4B9B-80B4-E2A1311E2642@miles.systems> Message-ID: X-Mailer: Apple Mail (2.3774.600.62) From: richard@miles.systems (Richard Miles) --Apple-Mail=_EB98EB60-7829-4182-9B5E-39BC4C7514C5 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Could someone please spare a moment to give me karma so I can open an = RFC?=20 I greatly appreciate your time. My username is: wookieetyler Derick Rethans commit inspired me to start looking at the source code in = more depth.=20 I got started on this branch = last night, I focused on the zend_language_parser.y. I think I got that = figured out, and not I need to adjust the functions it touches = (zend_ast_create_decl and zend_ast_create). I might call myself a very seasoned n00b here, so my main goal is to get = it working. interface_declaration_statement: T_INTERFACE { $$ =3D CG(zend_lineno); } T_STRING interface_extends_list backup_doc_comment '{' = class_statement_list '}' { $$ =3D zend_ast_create_decl(ZEND_AST_CLASS, = ZEND_ACC_INTERFACE, $2, $5, zend_ast_get_str($3), NULL, $4, $7, = NULL, NULL); } | T_INTERFACE { $$ =3D CG(zend_lineno); } T_STRING interface_extends_list backup_doc_comment '[' = array_statement_list ']' { $$ =3D zend_ast_create_decl(ZEND_AST_CLASS, = ZEND_ACC_INTERFACE, $2, $4, zend_ast_get_str($2), NULL, $3, $6, = NULL, NULL); } ; Then for casting:=20 expr: ... | type_without_static expr { $$ =3D zend_ast_create(ZEND_AST_CAST, $2, $4); = } | '(' type_expr_without_static_or_nullable ')' expr { $$ =3D zend_ast_create(ZEND_AST_CAST, $2, $4); } | '(' expr ')' { $$ =3D $2; if ($$->kind =3D=3D ZEND_AST_CONDITIONAL) $$->attr =3D = ZEND_PARENTHESIZED_CONDITIONAL; } | new_expr { $$ =3D $1; } ... I should also point out that the syntax I posed yesterday was a bit = incorrect as I extended an interface using the `implements` keyword. >> interface iArrayA ['a' =3D> string ] >> interface iArrayB implements iArrayA ['b' =3D> string, 'c' =3D> = ?string ] It should actually read: interface iArrayA [ =E2=80=98a=E2=80=99 =3D> string ] interface iArrayB extends iArrayA [ =E2=80=98b=E2=80=99 =3D> string, = =E2=80=98c=E2=80=99 =3D> ?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 --Apple-Mail=_EB98EB60-7829-4182-9B5E-39BC4C7514C5 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
Could = someone please spare a moment to give me karma so I can open an = RFC? 
I greatly appreciate your time. My username = is: wookieetyler

Derick Rethans commit = inspired me to start looking at the source code in more = depth. 
last night, I focused on the = zend_language_parser.y. I think I got that figured out, and not I = need to adjust the functions it touches (zend_ast_create_decl and zend_ast_create).
I might call myself a very = seasoned n00b here, so my main goal is to get it = working.

interface_declaration_statement:
T_INTERFACE { $<num>$ =3D = CG(zend_lineno); }
T_STRING interface_extends_list backup_doc_comment '{' = class_statement_list '}'
= { $$ =3D zend_ast_create_decl(ZEND_AST_CLASS, = ZEND_ACC_INTERFACE, $<num>2, $5, zend_ast_get_str($3), NULL, $4, = $7, NULL, NULL); }
| T_INTERFACE { $<num>$ =3D CG(zend_lineno); = }
T_STRING = interface_extends_list backup_doc_comment '[' array_statement_list = ']'
= { = $$ =3D zend_ast_create_decl(ZEND_AST_CLASS, ZEND_ACC_INTERFACE, = $<num>2, $4, zend_ast_get_str($2), NULL, $3, $6, NULL, NULL); = }
;


<= div>Then for casting: 

expr:
...
|       type_without_static expr
{ $$ =3D zend_ast_create(ZEND_AST_CAST, $2, = $4); }
| '(' = type_expr_without_static_or_nullable ')' expr
{ $$ =3D = zend_ast_create(ZEND_AST_CAST, $2, $4); }
| '(' expr ')' {
$$ =3D = $2;
if ($$->kind =3D=3D ZEND_AST_CONDITIONAL) = $$->attr =3D ZEND_PARENTHESIZED_CONDITIONAL;
= }
| new_expr = { = $$ =3D $1; }
...


I should = also point out that the syntax I posed yesterday was a bit incorrect as = I extended an interface using the `implements` = keyword.


interface iArrayA ['a' =3D> string ]
interface = iArrayB implements iArrayA ['b' =3D> string, 'c' =3D> ?string = ]

It should actually = read:

interface iArrayA [ =E2=80=98a=E2=80=99 = =3D> string ]
interface iArrayB extends iArrayA [ =E2=80=98b=E2= =80=99 =3D> string, =E2=80=98c=E2=80=99 =3D> = ?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

= --Apple-Mail=_EB98EB60-7829-4182-9B5E-39BC4C7514C5--