Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114847 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 58445 invoked from network); 13 Jun 2021 19:56:19 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 13 Jun 2021 19:56:19 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9585F1804C0 for ; Sun, 13 Jun 2021 13:12:23 -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.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 13 Jun 2021 13:12:22 -0700 (PDT) Received: by mail-lf1-f54.google.com with SMTP id r5so17489869lfr.5 for ; Sun, 13 Jun 2021 13:12:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=craigfrancis.co.uk; s=default; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qka0BkKXubAAv6NXRxY0Tyu9MWxcAmmyTWUL+tZ9oEQ=; b=aF7w6VLAOioa9k13XexVDODVm72JsDnca+TFcfMDDN8FU15AHyF8XCHugNC4hU89pQ 9uH0qAj2O1+m2fGEykLuk9NWppN7/a23RU0HiXt8i+mmVoZ/62EyeeBY6t2dSiSPs7io QlrGkn7fnfofO2UOdr40SdsD1CGz8bLVvYmFA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qka0BkKXubAAv6NXRxY0Tyu9MWxcAmmyTWUL+tZ9oEQ=; b=Qzn+Q9Os6uU5RiJ/siJM74lbgBYFrndEBV9WZvapHFFI6OP2UGn5aHynkJlAojmhb+ pZs1HsFv2jRn6FJksImNVzZbFShUIgc0/acWLAP0qsrQfAgT7skN4ZskPFCOGP+BeD7F g4KuSrO3CslAhpqtngY5Wu2UTTJgal0vgKACUUHRJtYCfdLo3+nWPgEz+Z5FQJvbKm+g Eot9cVpsfZIYfXWJXyxY7tX8apVrrPp/fX4i4mZoJeUNs7zeQ1Wfi9FYUVycXg7VmTkH YWRy62pa+ANlRpPT/JxVXfDpP7wepM6wqpAvf1twOcf8lKqeH6IuFC68cDw/6Lh39kyW J/lA== X-Gm-Message-State: AOAM531vuDjADxCEfjkaSUTHQkJzZ3hHSP7Xn2YKPBpUnzFCfwfSTpyR waGNxBny7JCAFuGXAOsJz+P5Yr/Nizzs3vOH0bBF6A== X-Google-Smtp-Source: ABdhPJyCilplEyNn/ViYaIL8a/aFL74CYgXXMDsyfWC+Sy3OqkOMD+xyPcZadlyZmDQdoNhbsVtdazse6R6L4FUiKRk= X-Received: by 2002:a05:6512:3b99:: with SMTP id g25mr9557875lfv.262.1623615138657; Sun, 13 Jun 2021 13:12:18 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Sun, 13 Jun 2021 21:12:07 +0100 Message-ID: To: someniatko Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000978b7a05c4ab5b78" Subject: Re: [PHP-DEV] [RFC] is_literal From: craig@craigfrancis.co.uk (Craig Francis) --000000000000978b7a05c4ab5b78 Content-Type: text/plain; charset="UTF-8" On Sun, 13 Jun 2021 at 20:33, someniatko wrote: [...] Have you considered [a] new `literal-string` type, which would be enforced by PHP all the time? Thanks someniatko, a "clearer intent" is a really nice way of putting it. It is something that Joe is considering, but for a future version, simply because it will require more discussion (which I'm happy to help with). And I agree, there would be value in having a `literal-string` type, especially when working with IDE's and Static Analysers; but it brings a couple of issues that the is_literal() function solves: 1) Libraries need to support older versions of PHP, so they wouldn't be able to use the `literal-string` for many years; whereas they can use `function_exists('is_literal')` today, probably to provide their own function that simply returns true on pre PHP 8.1. 2) The is_literal() function gives the libraries a choice on how to handle the situation. At the moment they just receive a string of unknown origin, so they can trigger a warning, while also supporting legacy projects who want to switch off the warnings. And some developers might want to use a library that has an option that can raise exceptions (so they can be certain there are no issues). Craig --000000000000978b7a05c4ab5b78--