Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115082 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 90012 invoked from network); 23 Jun 2021 22:32:46 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Jun 2021 22:32:46 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 402E61804DA for ; Wed, 23 Jun 2021 15:51: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=4.0 required=5.0 tests=BAYES_50, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (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 ; Wed, 23 Jun 2021 15:51:22 -0700 (PDT) Received: by mail-lj1-f169.google.com with SMTP id c11so5089009ljd.6 for ; Wed, 23 Jun 2021 15:51:22 -0700 (PDT) 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=U9mzETsMVgdZlMF9dex0rA6Uxge9g9gX0IWch7jqXrI=; b=tmE6e8cyAXqHxD2nsLSXtackkDVOsbtvlfEOlg6M4rS7MXNkhSGCIXDK5VF4dw4qY8 B4iFXxd+WgBL3fHZkc691bLuSAt/+ipxtdNyQ8895nn4VhlMsWwKObnLqDGLj4E5wZcb VCU2trxWv4Q76nt8xOTETwDoDAckTqX+C7oFZS+YMwgLtgcL3K3AOr7JV41eyWKX6MuY WTlHS5f7A9zs28Kf9gmnhWucokaF+IYQGlOmlU1wYkPzgp9omXSX22yRSdTitgiXaCqj ECczfp92Z1YCiixktCi/yDrLY0gOLqwXszkvs/g1+m4RVGsuwvnUODBdkRgmJGJqvV2m KqzQ== X-Gm-Message-State: AOAM531CMo3CXrgBH90m6knO2AhmVCd6ZsyTqTD7Bqror7aJp9yJx19a AZg/IL6QIbYiy6drH6PuVm7ytZIOJfsa2Lz55wiWZg== X-Google-Smtp-Source: ABdhPJwVA04aFAPl0RJSRSVLuTbHnC7eVWLjurh4GLRV8JsSaoyRM0w4jlVWr/8/TnLtAtTjP02QNx6BoNb5YNdz/FM= X-Received: by 2002:a2e:7807:: with SMTP id t7mr1439529ljc.433.1624488680388; Wed, 23 Jun 2021 15:51:20 -0700 (PDT) MIME-Version: 1.0 References: <012901d7683a$446a7ba0$cd3f72e0$@gmail.com> In-Reply-To: Date: Wed, 23 Jun 2021 17:51:09 -0500 Message-ID: To: Mike Schinkel Cc: "G. P. B." , Hamza Ahmad , PHP internals Content-Type: multipart/alternative; boundary="000000000000bc87c805c576be82" Subject: Re: [PHP-DEV] Introduce str_left/right In 8.1 From: pollita@php.net (Sara Golemon) --000000000000bc87c805c576be82 Content-Type: text/plain; charset="UTF-8" On Wed, Jun 23, 2021 at 2:10 PM Mike Schinkel wrote: > I have frequently heard the justification of maintenance burden mentioned > as an objection to adding specific features. And in many cases, it is easy > to see why future maintenance burden would be a concern. > > However, it *seems* in this case that these functions are so trivial to > implement that once written and documented they would likely never need to > be touched again. But as I do not yet know the internals of PHP I obviously > do not know that to be a fact. > > Honest question: Would you mind explaining the type of maintenance > required for simple functions like this? What is likely to change in the > future that would require maintenance? And would you mind giving a few or > at least one example of a trivial function that did need to be maintained > after it was written? > > Honest answer. I won't personally feel any pain from adding these functions. No more than I felt when str_contains() was added over my objections. Nobody maintaining PHP will feel significant burden from them. They'll sit in ext/standard/string.c doing their trivial work, opaque to the jit, and they'll get used or not. If cluttering the kitchen sink with one more unwashed utensil makes someone happy, then fine. I'm not going to vote for it though, because it belongs in composer/packagist land, not in core. I've listed the reasons for this in the str_contains() threads, feel free to reference those, they're still valid and correct. -Sara P.S. - I don't actually think the octet versus codepoint versus grapheme argument can be particularly persuasive given that our core string functions aren't encoding aware in the slightest. That ship has sailed. It is, however, another argument for doing this in userspace where the tradeoff is far more obvious, and dealing with alternative multibyte engines and/or polyfills is much more facile. --000000000000bc87c805c576be82--