Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123447 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 2B5F51A009C for ; Tue, 28 May 2024 13:10:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1716901911; bh=/1bi68QfZ1+P8eNMaFKutsLE3JZsQmbEsubCnUQPF64=; h=References:In-Reply-To:From:Date:Subject:To:From; b=O8Do0aEj1Zl78rMlKYl846srZOhzVuA5Fqpgr7lva4bFvh9Kkg6oex1c6lXNo6OHd AR/ZZEUyYhtqWR9ubfq2BP3OvRXhsJJN6FL2GTEzfuBrce5VEwrDJ33h7oaCZF+BdF Wz5S158O4CuXfGeZsmrhgxtyEGvECxy3QHkCVDPvcmwIqN2PQ54aICXrzJYoSSK2np z7/Z7RcLhOK1gws4RhiG3LB/YgpvOjjXOlUAlqLfa5mUPzSbXSX5piVWY0hcwZycmM d7uOl8rh75vRaWaerkcDUQ+s8wc1VMpyDI2ld9oZt2JJSAUbgt5dXnLLBl4oCgqAEV pWvH0MUkABU7A== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 34C8D1809BB for ; Tue, 28 May 2024 13:11:51 +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, 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-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51]) (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, 28 May 2024 13:11:50 +0000 (UTC) Received: by mail-qv1-f51.google.com with SMTP id 6a1803df08f44-6ab9d9f0ee2so2950706d6.3 for ; Tue, 28 May 2024 06:10:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716901850; x=1717506650; 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=/1bi68QfZ1+P8eNMaFKutsLE3JZsQmbEsubCnUQPF64=; b=X5kHd0I99omClsPe+Nx7dlPDsULde3RvsU/Iakdar2QotAc2RBqejw9//UcKx+1FuO lrz1JDMawYyqul1S9Vdl7lu+R5gP0CPd36JnWGyiiF/gjjg5XVVKYgBQXpvZgYMjNvCq t0VdqIq0X0Krrugg30foz9szGKQI5b5Wl/IS1hL7+eSjsnnLJZgYezC4I+7V21Lb1Hcd n9LJhG+Bykgakm7jT1ZF7IP7LVgbb6nW4EU5i7f0D4OKA/pQ16Tson68s35inNsnx79Q UXWbT3bD5uCmLrAUjJxtTcamOX8F02O8qWOLzz3dr1P+1EHmhMo7DTNs2vhJwBSga8g0 T36g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716901850; x=1717506650; 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=/1bi68QfZ1+P8eNMaFKutsLE3JZsQmbEsubCnUQPF64=; b=uUITNIFpyQJ0T1Xj9EIrGxt4U8kvPL1e6yXbtfebUWoGs7pC8a1Z45ddtyJ96kGNSc vKtzw2UzbHT8n+qL5O5sdnQxmmofR7YYyRgHWt3+LM1cvnEVhUWqGhM5LBBGEqnIWAN0 egM2di5rP4g7JlFsYXb9DKyWtlZ1+bD30pNyPLjxn1i/P7O/uRbWEsFm2dcT2T6FMJ1G Vemmpiz3ywa5gBgbdVkWCCq3HlyfEYgMVppe67loBqAIP7pomEPzkiR4YuOOT/vUIqlK jcJqWCNhxbJS6oWfo6ojjh0xMoMXRUgErUClSC5tq+NGaC7ERmbUaTBBXTROTNdu2iGq jdqw== X-Gm-Message-State: AOJu0YxQ/QaUo4S5+tDx0KOU+iBL5vC2LsGHfUEhTFhFZJysZzO573C5 +ydgyQkqeQUWNhnMjCnzg6PddPDqUaoLPG3irgLlMdyeOpY16bRaHwsV1pCvmoHLCN7D3kHtfW0 /BeBEzH5gv693Sn2IoxGXGB879/F0sdcT X-Google-Smtp-Source: AGHT+IHmC19BFg8XDd/ZFwYYald50Fi77qxsuLjXtpdeYAQvk02xFhXmmho66wSa+Y6wPdfJGQb5i6FfJNmzfFeDtNQ= X-Received: by 2002:a05:6214:4382:b0:6ad:83d3:2e88 with SMTP id 6a1803df08f44-6ad83d3364fmr52589226d6.19.1716901850015; Tue, 28 May 2024 06:10:50 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 28 May 2024 15:10:39 +0200 Message-ID: Subject: Re: [PHP-DEV] [RFC] Transform exit() from a language construct into a standard function To: PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: tovilo.ilija@gmail.com (Ilija Tovilo) On Tue, May 28, 2024 at 2:10=E2=80=AFPM Gina P. Banyard = wrote: > > On Monday, 27 May 2024 at 02:31, Ilija Tovilo wr= ote: > > > > On Wednesday, 8 May 2024 at 14:40, Gina P. Banyard internals@gpb.moe = wrote: > > > > > > > I would like to formally propose my idea for exit() as a function b= rought up to the list on 2024-02-24 [1] with the following RFC: > > > > https://wiki.php.net/rfc/exit-as-function > > > > > > As mentioned early on in private, I don't see a convincing reason to > > remove tokenizer/parser support for exit/die. I'd rather see this > > handled in the parser directly, by converting the standalone keywords > > to function calls. This avoids any backwards incompatibility, and > > avoids special handling in zend_compile_const. > > I must be honest, I don't really understand how parsers work, so I went w= ith what I could understand and implement. > But I'm struggling to see a reason for keeping the token in the first pla= ce, and what issues hooking into zend_compile_const() has. Mostly because I think handling exit and die as constants is misleading. exit; isn't a constant any more than yield; is. Instead, you could turn exit; into the same AST as exit(); (i.e. a function call), which will make the compiler handle it automatically. If you wish, I can have a quick look. > > Another thing that's probably not too important: The PR likely breaks > > dead code elimination for exit() and die(). This could be re-added by > > checking for the never return type instead. > > Checking for a never return type seems more robust if it wasn't already s= upported by DCE. > I will see if I can do this. That would be great! I agree that this can be done in retrospect. Ilija