Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125274 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 34C1D1A00BD for ; Mon, 26 Aug 2024 15:29:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1724686263; bh=+lzySSl/fbRJTWRjB3Hy3iEahdlyMsi1M+LXRLl6/ws=; h=References:In-Reply-To:From:Date:Subject:Cc:From; b=OGnkAMN6PVlXssCVDC6fORMGvZ5VdHWHJR7YqaVgh3jdyikiUM62cM2TIRTUyiGLb pAvJKYIz6ERWSJrn27qMEVialLaRKUC6bYAPyZW3ip2SdwzAKCB4c+CArQ0P7FuKiQ jmBhW3tSEufzEGX8ikNlC6hYN7POevu8f3sUNXc3F1FE2NYZ6YaeepWlx5VVPdqHoX eeEeANwVZwWLXe1MLc6zPvFSv3L+ZCCXko9FD6M5KQwDzYLbXa9yPJWzVP9Rso5rej IzDhEq0an5rK+Z7IcsTmBWNYf5Tzy0iDluoMZZd1S2tIiF2K2ZHNnP7f2N2H9e47P/ Um+vCk7b6DYlA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 41292180078 for ; Mon, 26 Aug 2024 15:31:03 +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=4.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,MALFORMED_FREEMAIL,MISSING_HEADERS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (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 ; Mon, 26 Aug 2024 15:31:02 +0000 (UTC) Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a8692bbec79so558164666b.3 for ; Mon, 26 Aug 2024 08:29:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724686148; x=1725290948; darn=lists.php.net; h=cc:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=XVNQppJ68t1EjgtI0d2yurcQA+d/4BV9m+PY9PBIg00=; b=TPqy4Dtl4dWDvtKuWOM2gThmS6i6pyB3UlTWHxuyyRRo5TFYJIzmPaA/hCdky+2z2s 3dFJI3cPUC/LRsb1sFwwiOdivLDAX6OzJ/6qZHeW+OLEANYis7MfBTpwjzHwSW3A6PDT zTOpyKslfp3uJgXgEjNq8fuYIIaWhsQJ8DH74L6kj45DB5h0gEbxNsiSckDYfnJSY2l1 Eu/zZvDpuEUqSw06i1WyEMSqxyRxqZbPf1lxXTCuV69RTxOn5VU6+mQ4KHoHX/5v0yBy OaMGcJIBf/tUSlxab29QEY6VVPFQHJ+BjYEPAzl4LLP6rG6rcRKpKf4hllrxZ8cHpLUq RGSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724686148; x=1725290948; h=cc: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=XVNQppJ68t1EjgtI0d2yurcQA+d/4BV9m+PY9PBIg00=; b=uCLrHoWeuGlDRoHIbOSy0aUsHa9zuu7WiNDQ2rFwmZxcyN3xyvtBb8cXG84JAMlRHN DwfTASlWk+lrzB8oeiPjAqfFghigt78BOHLH0k/AaaDJ7n64D565Y0ZVzycfxYIiipdu bbMMQMd57o8YqB+/Fv6kub7YKOjwTUztraMCYeNtqM1puiL5wNMs56UGQUJcRU6tFB+1 m5/yc+gFe7eDlHUJWVGepPCa3nL3/9+EJJMBFHv4io061J1wni/8an6RlllaEQukQzTm whDYzT4BFnn+urbSNQSBEgLR0Zc05IUEDsKyW+4YPVZYiVDcjPt8A9OxDfo6J8R9VwHx Cngw== X-Gm-Message-State: AOJu0Yy31LbFi5jJvgF/HAPJQn2wMzPe2EtYV4aHExBKiSEwYYew69vQ sX+h67EbbanJREVvuHhoQomVLFJKMXWAdUK3o9nM/SiUEfpflfky07HN0U1H/7a2q0rZJDNkz0H H1+lVz6wolyDMH9X91PVAG4ip+qJ4iQ== X-Google-Smtp-Source: AGHT+IGfE+3X65QkpJa5jOu63hUez0MPRKinvnWt7/aHTSOqgYelt69CRXz+sRAAE6eQNDGYVJjZmv+wwmazcSZFFFU= X-Received: by 2002:a17:906:c114:b0:a86:968b:e9c1 with SMTP id a640c23a62f3a-a86a5169d01mr701198866b.5.1724686148371; Mon, 26 Aug 2024 08:29:08 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <0c8ed5d6-5507-4c41-8d7f-05d14ba8aa4c@scriptfusion.com> <0cfd3a28-3cb0-4478-85fb-cf086d8e5c66@app.fastmail.com> <3e0d031e-256f-47cd-9a2b-dcdc760f5498@scriptfusion.com> <6afeb23a-867f-457d-9b13-fdf5af02c31e@scriptfusion.com> <928d6c8c-c969-4d55-82ff-5da8fc3d3035@scriptfusion.com> <73301950-03e7-4f3c-9fab-402645f77272@gmx.de> In-Reply-To: Date: Mon, 26 Aug 2024 17:28:40 +0200 Message-ID: Subject: Re: [PHP-DEV] [RFC] Default expression Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000391413062097c903" From: weirdan@gmail.com (Bruce Weirdan) --000000000000391413062097c903 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Aug 26, 2024 at 12:47=E2=80=AFPM Rowan Tommins [IMSoP] wrote: > Another approach that occurred to me was in the executor: rather than > evaluating to the default value immediately, "default" could resolve to a > special value, essentially wrapping the reflection parameter info. Then > when the function is actually called, it would be "unboxed" and the actua= l > value fetched, but use in any other context would be a type error. > I guess what the opponents to this RFC are zeroing on in this thread is the conclusion that `default` (as proposed) is a form of contravariant return, and thus breaks Liskov Substitution Principle. Your suggestion of making it an opaque value that cannot be read outside of the called function is a nice (and maybe the only) way to resolve this problem. --=20 Best regards, Bruce Weirdan mailto: weirdan@gmail.com --000000000000391413062097c903 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

On Mon, Aug 26, 2024 at 12:47=E2=80=AFPM Rowan Tommins [IMSoP] &= lt;imsop.php@rwec.co.uk> wro= te:
Another appr= oach that occurred to me was in the executor: rather than evaluating to the= default value immediately, "default" could resolve to a special = value, essentially wrapping the reflection parameter info. Then when the fu= nction is actually called, it would be "unboxed" and the actual v= alue fetched, but use in any other context would be a type error.

I guess what the opponents to this RFC are zeroi= ng on in this thread is the conclusion that `default` (as proposed) is a fo= rm of contravariant return, and thus breaks Liskov Substitution Principle. = Your suggestion of making it an opaque value that cannot be read outside of= the called function is a nice (and maybe the only) way to resolve this pro= blem.
=C2=A0

--
=C2=A0 Best regards,
=C2=A0 =C2=A0 =C2=A0 Bruce Weirdan=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 mailto:weirdan@gmail.com
--000000000000391413062097c903--