Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122691 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 96CD81ADA74 for ; Tue, 19 Mar 2024 16:53:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1710867200; bh=VPx4lrlbXP9FE3VuWgav8/LjDp4U57aBs8ji1DScL8Q=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=FfrwlCM3ITIHsDr1rQyt5sZYIKB1etRGE9hECcgF8KnviZ59lmjoPYBtaUtSzKKow qqS8Lzzqrrbr8c4KeBCMIA0PUefxqS6YxWL9l/SW/UejJhYxyIL99RTnw1DbYM+JsV Oe7W3KVvU++cVT16gflf8xPTCVe3BDYLqU7d3eDjuJEG79npYs66LwBqdM+AWfa+rU hxlXMWQeH/9G/TOGomA/88I6poHYkasWKon5YfaPN7hw2JwVaUQd/hd7s2Oa1yOPeD 3YpXOxMS7CGljs8G+UWupDF0b5AYOvH4SkNrFRWDChimRBfg0CB2cp9duBR4aXNP0y ronQ+P43b8ZdQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6AE48180A0A for ; Tue, 19 Mar 2024 16:53:18 +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_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) (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 ; Tue, 19 Mar 2024 16:53:16 +0000 (UTC) Received: by mail-pg1-f180.google.com with SMTP id 41be03b00d2f7-5dbf7b74402so4092309a12.0 for ; Tue, 19 Mar 2024 09:52:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710867174; x=1711471974; 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=VPx4lrlbXP9FE3VuWgav8/LjDp4U57aBs8ji1DScL8Q=; b=CoWWH+JMS/9EI/2qVVzwhD/3E73VPn62JQG+z5z080uHRKU6QweHnoKGwpzBHkRv3Z sitTIXfRtqps8TwAspLy/szSw/y6VG222JKRzCRJhS0LBdZn/9OVagN8StbntIVmkqEv f/KIOro3TVpmQgddDxPK3OJ1i0j7a1nTHwnwXIPB2UIw1FGjzxf9NaeiA2cg1y2Irr1S JPTI2re6SvVer8N95eUmgZa5cxOeByWHOSmCwrfIEoU2m7DTuMXglLqjax81iYXI+G6i WyCorJDHXJQp1uJ35CJ5DAY9MqfnLOiNGW5xs567oFhSu5JGXPGNyIxvbaeAX2N2mxqc r7tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710867174; x=1711471974; 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=VPx4lrlbXP9FE3VuWgav8/LjDp4U57aBs8ji1DScL8Q=; b=D2URki+v2QuMVZ9GmdQfWMyb1hofrv8QpQXWyKeDm0W4wVwxDO/NaZr8rissG0rQ35 nZUXiwDzNM7pzzGWyZXUY6N1BJD/FKmr3G2Xc5RG25DBLh7e4UPtSf0Kyg5pZk+QANcZ Y7L8Kflml+D3Q/jQ5CN/yNk7fW4IYUzaA2VfmaTskiKZ/gnUxySpBSVyI6WgS/ch5t48 z2LYQV0kWIzfgUNvRzEaLwwypufSYS/nPh0lAOeftsot8Zhz2L/tp3k32Yv5Mr4JW5m1 UjGGhmxMOeOfClxnI+3ymErgXh6lwlgMBjuER/H7vE41pSQ6dOJvwvNea3OmJa72WX01 0SWQ== X-Forwarded-Encrypted: i=1; AJvYcCX2sBLo5cg7w2/BI+Z0ltZhHBq86ULqlrL74JA8gOY0WGgAb1QEChDMgWA3FS3DnHQ9Pf+tssPLCok4GUNJDF7g7YlN+qT0Vw== X-Gm-Message-State: AOJu0YyFRz1gm8nRuK6+cHxVxtFMrtVcjKZ5GFvD5NVJkZil1Yfv7PLT g9FOgO16kotJJg7bMRlCyJ4QQ379+lLc/Qr6g3JGbZIqBE9xI8lQwQ1BakmJa9U9mkMdBvcCmf8 YuDIY9PjUtHKcoIzRN7lbqaLlbW8= X-Google-Smtp-Source: AGHT+IGv29Lv+A7pv1GVTRoySnzQLdPfw8f8j/xlKcZDEFq5McagVyZoMyYpyenKHxDiOXDyMd4M64d9pvxHZIGNQfM= X-Received: by 2002:a17:90b:608:b0:29c:4082:2d0b with SMTP id gb8-20020a17090b060800b0029c40822d0bmr12373890pjb.28.1710867173890; Tue, 19 Mar 2024 09:52:53 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 19 Mar 2024 17:52:41 +0100 Message-ID: Subject: Re: [PHP-DEV] Proposal: AS assertions To: Deleu Cc: Robert Landers , internals Content-Type: multipart/alternative; boundary="0000000000002864b90614064ef9" From: ocramius@gmail.com (Marco Pivetta) --0000000000002864b90614064ef9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, 19 Mar 2024 at 17:46, Deleu wrote: > On Tue, Mar 19, 2024 at 1:42=E2=80=AFPM Marco Pivetta wrote: > >> One note: if what you are going for is what `azjezz/psl`, be aware that >> exception / error tracing design needs special attention here: it's not = as >> simple as it looks! >> > > I believe you answered your own question here. The proposal seems far > simpler and reaches 100% of PHP projects as opposed to the ones that eith= er > opt to use psalm or opt to use azjezz/psl. > Eh, kinda: you'd need to check how `Psl\Type\TypeInterface` recursively validates types and throws meaningful errors. Having that in the engine, given its structure, is a massive BC surface that is best kept as a `composer` dependency that can move separately. I hardly see that working in a language-level RFC, with the speed at which the language can do BC incompatible changes. See https://github.com/azjezz/psl/blob/5f0aeacb708a33d5b2d53a832736c7767a99b215= /src/Psl/Type/TypeInterface.php#L21-L35 See https://github.com/azjezz/psl/blob/5f0aeacb708a33d5b2d53a832736c7767a99b215= /src/Psl/Type/Exception/CoercionException.php#L49 See https://github.com/azjezz/psl/blob/5f0aeacb708a33d5b2d53a832736c7767a99b215= /src/Psl/Type/Exception/Exception.php#L22 See https://github.com/azjezz/psl/blob/5f0aeacb708a33d5b2d53a832736c7767a99b215= /src/Psl/Type/Exception/TypeTrace.php That stuff is all but figured out, even in userland :-) Also worth mentioning: https://github.com/CuyZ/Valinor/blob/37993b64a6eb04dc0aee79e03f2ddb4f86ff9c= 3a/src/Mapper/TreeMapper.php#L23-L25 https://github.com/CuyZ/Valinor/blob/37993b64a6eb04dc0aee79e03f2ddb4f86ff9c= 3a/src/Mapper/MappingError.php#L13 and the whole rabbit hole behind that Marco Pivetta https://mastodon.social/@ocramius https://ocramius.github.io/ --0000000000002864b90614064ef9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, 19 Mar 2024 at 17:46, Deleu <deleugyn@gmail.com> wrote:
On Tue, Mar 19, 2024 at 1:42=E2=80=AFPM Marco Pivetta <ocramius@gmail.com>= wrote:
One not= e: if what you are going for is what `azjezz/psl`, be aware that exception = / error tracing design needs special attention here: it's not as simple= as it looks!

I believe y= ou answered your own question here. The proposal seems far simpler and reac= hes 100% of PHP projects as opposed to the ones that either opt to use psal= m or opt to use azjezz/psl.

Eh, kinda: you'd need to check how `Psl\Type\TypeInterface` recursiv= ely validates types and throws meaningful errors.

= Having that in the engine, given its structure, is a massive BC surface tha= t is best kept as a `composer` dependency that can move separately.
I hardly see that working in a language-level RFC, with the speed at whi= ch the language can do BC incompatible changes.

--0000000000002864b90614064ef9--