Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126273 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 B20CE1A00BC for ; Sun, 2 Feb 2025 20:57:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1738529660; bh=Ps4UIF3Jux9Sd8npnMUbrOdcz4BWRNsNWx1+VpmeQYw=; h=References:In-Reply-To:From:Date:Subject:To:From; b=k3dJksc+rxv1ED7NgBd1OKNBnFthOCd02mEYe02qUMjW0fHHfZ/ZCYD4eJ/awtDlC IZCaGby+Ijl3XO3gXwc2AHoJSJD3BeUEyyrhaDEd2npQJ+gKwwwNZyzti6rcnFujJ2 4dtLZidywhL4oe87ZB0a32cVnsE0Ut+r41nOipudy3VcZe0CdfQKCGUAi9zNtMo/p0 nqf6IfRwnEIkat3TbckimIZDTmBrbYH1FP4owxlXxZZ4p8KMvbKf8dojzcacCBRsBF HiJ8WWHGtI5s6NdfZSCUBA9pb2uEdRAH0uGNZTst6qpiLa6HvjSLYnh9V2LTz5bs1p ICSyaVQlnKPpQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id ECDD318006A for ; Sun, 2 Feb 2025 20:54:19 +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=-1.2 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, 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-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.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 ; Sun, 2 Feb 2025 20:54:19 +0000 (UTC) Received: by mail-qk1-f180.google.com with SMTP id af79cd13be357-7bcf32a6582so344182985a.1 for ; Sun, 02 Feb 2025 12:57:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738529825; x=1739134625; darn=lists.php.net; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Ps4UIF3Jux9Sd8npnMUbrOdcz4BWRNsNWx1+VpmeQYw=; b=cevxnV5gmvcUb+RHgWX7FskDMMT1jOqRBITxJOEz0rBpaTjggWtlr5cshvHa/2xc+L Snx5pBrSEJ03MBI7hM+6rd1sZNLLNHi/5RnmCNN4RfUOaeWrVKZute7P1xxzYmSQ9TDu C7KOJxVAthruGakm2K4cYf702Qg3qDqIeEXK0487TAkwRjhg/WMxaNkqHUh3ukGNp/3V AxVgdpz9vWuYfyXDSK0pMBOHPG1qxEQ+lsPsjYECyOjJa84u/jKxx1OnmxVCaM1vSkGC OrHT/RARJxZ6HYqMCMNEl5mXSfDR0HwaJU4R36EyXS8y7JKU9znRY9qOejzkar1MmT3R aCSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738529825; x=1739134625; h=content-transfer-encoding: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=Ps4UIF3Jux9Sd8npnMUbrOdcz4BWRNsNWx1+VpmeQYw=; b=QxMTNUIDayfakx4pooUnQKvg6rljlbex5LsXDSRJNK9hQD/PZlnXEID1R/BNacNi/I 1olE54aiWXAGBpfgGeHGWfsnbWPts4I66XNS0PzBdYTpHqU56bK+jxpIdwxiWKEiVQ/G ZuK4mmi/UBV/uK10vzd23tlzUFNRm38G6BIyG0t3pUA+6H/VASFO9zVQuciXdSmbW2o4 H1tK+wUTXhyFDk4/uI7Hj/eo/4IGkFG2l+hZUqyW1gDW6MRxw4r3arsy30V1pVveI0Qt JItkaIDKbYWqVYdgXW1YMhnVxxYS7nx8kqYv9P53iMBodmwbj69uqQxLu4wJq4saRTWb pC5Q== X-Gm-Message-State: AOJu0YyMjszSRFOkN0pBbAH5PN7N8/wsuYDkHBqMwP2QzrmTaL4yx777 050No7oRFAxs4AWxzU1gYZu1l51H2RZJRfFlT+L3PDhqOpuqZ8sqYXh4O3gHm85FpkpUN8JXrxM MkpMlNhYvM9ni2aLaQc1kQ639dsiuTVnxarhlMg== X-Gm-Gg: ASbGncvqJOE6n6WHsQHA27sGf/oTnSsY+loNju0Yu3lWLeaBRonr3K6Jx+eq/YsPwkr OaoZ9Bunr0/TGnZl6Dz/rRwYPwBwORyRq1h5pE381x1kBE7vk2htMyqYkpAJFiEx67FYOSTa0xU bVEUaMXcdf1hZ3jk47Bh7zvyHjJOM6wCA= X-Google-Smtp-Source: AGHT+IF36YnZ6WVXajp4rU2M4s0YfaTOUOvaWQdfgIhbO37U2cuso9WpGrnCf0FtPxWH4XLdGKXDdBvOu5PbYXC0dT0= X-Received: by 2002:a05:620a:2848:b0:7b1:5089:485b with SMTP id af79cd13be357-7bffcccae9dmr2467254985a.3.1738529825224; Sun, 02 Feb 2025 12:57:05 -0800 (PST) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <878EED34-B28D-48FE-8EBE-5929841C12BD@gmail.com> In-Reply-To: <878EED34-B28D-48FE-8EBE-5929841C12BD@gmail.com> Date: Sun, 2 Feb 2025 21:56:54 +0100 X-Gm-Features: AWEUYZnS-gvJ6TZNd8spku8TYW-f4Iw1yJfaXy17hsXL_YLZwKL3zCV7B7D-DG8 Message-ID: Subject: Re: [PHP-DEV] Re: Discussion: making continue and break into an expression To: internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: tovilo.ilija@gmail.com (Ilija Tovilo) Hi Dmitrii On Sun, Feb 2, 2025 at 2:36=E2=80=AFPM Dmitry Derepko w= rote: > > I had similar idea to make `break`, `continue` and `return` be expression= s instead of statements to simplify almost the same cases as Robert describ= ed above. > > Grammar corrections in the PR. https://github.com/php/php-src/pull/17647 > Ilija pointed to memory leaking problems as well. > > Thinking about Ilija memory leaking case: > new Foo + return 1 > > I think we may have a workaround here, by allowing all of these construct= ions only available at some specific points: > - as the statement now > - $cond ? : ; > - match ($v) { =E2=80=A6 =3D> } > > So it will deny such cases: > - operand OPERATOR (1 + return; $cond && break; etc) > > It may prevent memory leaking problems. Isn=E2=80=99t it? Note that technical discussions don't need to happen on the internals mailing list. It has a lot of recipients and they are usually not interesting to the majority of people. GH is a better place for that. This alone will not be sufficient, because the ?: and match expressions themselves may be nested in other expressions that create temporary variables. E.g. new Foo + ($cond ? $x : break) will create the same issue. Restricting control flow statements fully to a combination of these expressions would work, however is also less useful and thus less persuasive. In my experience, incomprehensible limitations are generally not well received by internals. Ilija