Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117438 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 6257 invoked from network); 28 Mar 2022 11:54:35 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 Mar 2022 11:54:35 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 56FAA1804C9 for ; Mon, 28 Mar 2022 06:22:34 -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-yw1-f180.google.com (mail-yw1-f180.google.com [209.85.128.180]) (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 ; Mon, 28 Mar 2022 06:22:34 -0700 (PDT) Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-2ea1b9b3813so43197597b3.2 for ; Mon, 28 Mar 2022 06:22:34 -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; bh=8OVB2I1nDKn72is/HHqNn9AVlvYWSn6Fo2gi9ByGeBs=; b=mrL98pYV1/sFWb49Qpx12esm3kAnbRUQaq2a+EVWgmnAylT8eb8KoiasI7xrVqdBCN EV96fiPdUDVn8lUBLyyZO5R+gPbSG73UcpP/17U7Xbu3Jihfh75z2HcrEOaP0i7BIVVx zd1nuu0I2xaYuIKYxZWsSdM1XfRKVAbSdF81ZeRpB1f8mVdg4Y2zE7xK8iqNhl+EHqaE HoLj5CKxOMvmngIvl1C/Xnn/UmKGuurS1eJ77fVvkgpW82xZ7jDQBCGgFlWenlhwIBI6 DHPasU3vn9oEG8uMpeGmP3TCmFEasDTe3O+MSQeqQtGbr0VH+9iPPQi/WdG0Yp/HJgJM MsJQ== 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; bh=8OVB2I1nDKn72is/HHqNn9AVlvYWSn6Fo2gi9ByGeBs=; b=ZWiJtN0BK7Y4ZdUB9bsLqQqrgZ3MWJnJ4yWMkjwAyHRhhsSOCpernTJTijtvIDQHsL Xiasnf48ttZR25fXZDtuBNv0NnpRcfrlM7Xx2htb63Nm99B3o71DmI5qMMGJenwIR13K C/iDdqFUPKdrIaCpZG0juovC/Opa3oe5x12yIMHYj+2swwCeHixpZQbGbWV9RKvBMnRb J9vytI5pSuIPSY9Wc92Q3HuunmT2BnAmvaXtSEPNeG/6D4SAfnU2LIjfgO5VjP9clh37 UUG2PG6T8mRbjM8SaYw+qCa5pnaqJ3YHaZbYsynpZadRslIYJTbG1BmQUbAghQV+mZrg sevw== X-Gm-Message-State: AOAM530EjD0+8qtydpaDOx0YUNX7lCjlG9kSdY42OMCOEwG7VBvEWPA9 S0aDT4Bsj/GorWX9GvQ8g2lXqVLIBaJVtwMEIs4neAV1bg== X-Google-Smtp-Source: ABdhPJxirTuliDKQNAIprbGiZoUFH7+lWYxt1/KgYWlfpCRg6G146DwYGjOY03Vbs833vEWv8yGTRsnuvb6S6/zTOcs= X-Received: by 2002:a81:7950:0:b0:2dc:4ef:6a7 with SMTP id u77-20020a817950000000b002dc04ef06a7mr25049852ywc.135.1648473753594; Mon, 28 Mar 2022 06:22:33 -0700 (PDT) MIME-Version: 1.0 References: <10558027.nUPlyArG6x@arnaud-t490> In-Reply-To: Date: Mon, 28 Mar 2022 15:22:22 +0200 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="000000000000812c6b05db473406" Subject: Re: [PHP-DEV] [RFC][Under discussion] Arbitrary string interpolation From: guilliam.xavier@gmail.com (Guilliam Xavier) --000000000000812c6b05db473406 Content-Type: text/plain; charset="UTF-8" Hi, > A large part of that is because the placeholders are positional rather > > than named, so you have to keep track of which is which; but by the time > > you've got named placeholders, you might as well have variable > > interpolation. > > I feel the same way. PHPStorm has a feature that highlights the given > expression when your cursor is placed on a %s placeholder and vice > versa. This seems to be the treatment of that symptom. > Has "add named placeholders to *printf()" been proposed/discussed before (I didn't find)? What about strtr() (e.g. `strtr('The {foo} is {bar}.', ['{foo}' => FOO, '{bar}' => bar()])`)? (and even templating engines like Twig?) Anyway, it sometimes baffles me indeed that I can build a string with a method call like `"...{$foo->bar()}..."` but not with a function call like `"...{foo($bar)}..."`, and also with complex interpolation via callable variable like `"...{$foo($bar + baz($qux))}..."` but not with simple constant like `"...{FOO}..."` or operation like `"...{$foo + 1}..."` :/ Regards, -- Guilliam Xavier --000000000000812c6b05db473406--