Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117853 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 30421 invoked from network); 5 Jun 2022 19:46:35 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 5 Jun 2022 19:46:35 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8E09A180211 for ; Sun, 5 Jun 2022 14:31:55 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 5 Jun 2022 14:31:52 -0700 (PDT) Received: by mail-ej1-f43.google.com with SMTP id m20so25523774ejj.10 for ; Sun, 05 Jun 2022 14:31:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8k3KZz38O6xAo/tuq389I0iuuAngaVVw4HCWv2i3pXA=; b=jS9QeW+vYFPi2TtYZ4kVy2Fid1CwClKeNa6XGHWrsY4q251g22cUyOc326Z22Rzlkk dLnIvIFxeurLVr5MyDG/iUN2+9hr5fA9CBefHRt7WdtT6Q+oSYb2NPeW9LXOjTqJM3xY kPCAgdYEVuVQ1vEgMzKgYhMw8qAI8KgmwPJWNYAwaPqES4JRTj36fUVxNcLoVRPL37OF VAnKG4T/ha1jK7JnhIA7X91aqa3MokuTU6DENvD9ius6nOlY24pa9OeOU65fTkyOBXLf FeOsO7aEjYnxeqP3iFBh3eOLgyCMqRYy3zTuFDUoK/MuD2B0YJ7U+knTnWc0GNeUwoiM 0yTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8k3KZz38O6xAo/tuq389I0iuuAngaVVw4HCWv2i3pXA=; b=fz+UqDV9PySDJNnY0tk9Y5YDwGVn+R3jZucO+kDg4FRbz+PRvI0T3ZLWelbdgvwvA+ rY444X/+4P+SfiW7It/FS+vsyyj+l8DPnF/5MrWDjhE8bTM07IuBbvVqE7AI8Rr9cUwp KLUcrhyRYWhx9XaP0lXCZLM+VHmw3hTEOVMm9NaMl0ssCZfnd6mglnn0VWYnOSI5GJgs o2RFFK3tqGNGrcAroTKLHdTb2y0BVvsB8AmJS425WhGn+8/dAApPbn/AF+vXHwtaKF8p ntk9NvaeGLoTf45WWTvjAcH6afxlWo95EUYq/1P6xnZjbMtjr7SaPZXqNiiijX1LMoLN pejg== X-Gm-Message-State: AOAM533BLkMiavJW+hSOFwOkJEVGuRajRYuYEvjPTCniw9Ww/WvnKEMM NagKxckGo//m82iJGnYb+gkxKvQyqz92S1DQHTVls1H+Qh0= X-Google-Smtp-Source: ABdhPJymi+Yc9dWt/CRW7Dz5d9lpJI3RtFQ95170N9xUXn+7urwAMzEmzD0uFU1+rdUXOmV/hqH7BA5jwQwFpwGMlzU= X-Received: by 2002:a17:907:7207:b0:6ff:d25:ee3f with SMTP id dr7-20020a170907720700b006ff0d25ee3fmr18903373ejc.389.1654464710686; Sun, 05 Jun 2022 14:31:50 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Sun, 5 Jun 2022 22:31:38 +0100 Message-ID: To: shinji igarashi Cc: internals Content-Type: multipart/alternative; boundary="0000000000005fba0905e0ba1598" Subject: Re: [PHP-DEV] Adding new closing tag =?> for keeping trailing newline From: davidgebler@gmail.com (David Gebler) --0000000000005fba0905e0ba1598 Content-Type: text/plain; charset="UTF-8" On Sun, Jun 5, 2022 at 9:24 AM shinji igarashi wrote: > Hello everyone, > > I'd like to propose adding a new closing tag `=?>` to the language. > > PHP currently removes the newline character immediately following > the closing tag `?>`. > Personal opinion, seems like a classic sledgehammer on a nut proposal. I actually prefer the or ."\n" notation since it makes it explicitly clear what you're intending to output and keeps it within the control of the PHP code block. Alternatively it's also enough in the case of plain text or wherever else this matters to you to just add a space after the closing tag before the newline (granted there may be niche situations where this is undesirable). It's not a breaking change for any existing code, at least, but for me I still don't see enough of a benefit that I'd think it was worth adding to the language, as any new syntax creates the potential for confusion and user error. Is this a big enough problem to be worth any change at all? In over 15 years of writing PHP, I've never once had a situation where closing tag newline elision has been an issue. -Dave > > With the new closing tag `=?>`, the code should look like this: > > ``` > - > - > - > ``` > > and the results it produces would be: > > ``` > - 1 > - 2 > - 3 > ``` > > instead of the following: > > ``` > - 1- 2- 3 > ``` > > This addition requires only a one-line modification to the lexer and > doesn't break BC. The proposed patch is here. > https://github.com/php/php-src/pull/8708 > > Before writing an RFC, I would like to hear your input on whether > it's worth tackling. > > Thanks! > > -- > Shinji Igarashi > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > --0000000000005fba0905e0ba1598--