Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112048 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 81790 invoked from network); 13 Oct 2020 16:46:14 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 13 Oct 2020 16:46:14 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 10C631804CC for ; Tue, 13 Oct 2020 09:01:26 -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=1.4 required=5.0 tests=BAYES_00, 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-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (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 ; Tue, 13 Oct 2020 09:01:25 -0700 (PDT) Received: by mail-lf1-f49.google.com with SMTP id j30so313337lfp.4 for ; Tue, 13 Oct 2020 09:01:25 -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=jRoBj3FXmIDoRnYJzp/NRBMPctZhfl2twBe+zZdyN/Q=; b=VQqFmtTLm766AEe9OKrnkWcJ06RxphOBKrFblk8vTM3qhJYR/P8KzrDw0x8wN82kKj 5mck1IwmqJFNyEjhBeXJ7TgELiC2sC2DPkcdCKCrL8NZWtOGG56DYAeCzytqn1ztekFJ LDh2SyJjhROhVIMA2Z7To+IXqzBH4D0lXS9GN570cNe/r2JQLRtbdZvElfnYpjlOIofw 3uPiBFBZYAI2aOWAjXfMqJFLbRgXbo1vWQbg0yvlrcHBi95vWMWro7DyGJbc1SXDGAYc V1kGGxJZp7hSfDSrxkXpBthQw95eQCqoau2mzsI7wY08HAzGTE9554T0B4utJznQXzVc DJTA== X-Gm-Message-State: AOAM532kSy0uoI9KEU1T19qypPGvQLVgL4TOxOOSleezYdrZQ4KIbOSm +5wnywEC35VPdnKtr2LpzP7Icn+zunslFjzxDAI32Q== X-Google-Smtp-Source: ABdhPJwbYyM4far6B6P9I2W0+dXP56G7nNYl1m+9cN/gM404jD9dFFRHBi9c7CG3ND5ePrOFA//NZ4+AKFUUSNGBKgQ= X-Received: by 2002:a05:6512:2098:: with SMTP id t24mr46115lfr.116.1602604883119; Tue, 13 Oct 2020 09:01:23 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 13 Oct 2020 11:01:12 -0500 Message-ID: To: "Christoph M. Becker" Cc: Hans Henrik Bergan , PHP internals Content-Type: multipart/alternative; boundary="000000000000c6284705b18f869e" Subject: Re: [PHP-DEV] Re: want an Object-oriented interface for HashContext From: pollita@php.net (Sara Golemon) --000000000000c6284705b18f869e Content-Type: text/plain; charset="UTF-8" On Mon, Oct 12, 2020 at 7:55 AM Christoph M. Becker wrote: > > On 12.10.2020 at 13:49, Hans Henrik Bergan wrote: > > > something like > > > > $result = (new HashContext("SHA1"))->update($str1)->update($str2)->final(); > > > > (userland sample imp: https://3v4l.org/lXd3u ) > > > > I tried asking on the bugtracker ( https://bugs.php.net/bug.php?id=80221 ) , > > but was told to ask on this mailing list instead. > > Thanks for bringing this up on the mailing list! > > I basically very much support a proper OOP interface, but I think the > method names should use camel-case (e.g. ::updateFile() instead of > ::update_file()), and it might be appropriate to rename ::final() to > ::finalize(). More bikeshedding regarding the method names, and maybe > their signatures might be in order. We do not necessarily have to make > these methods aliases of the existing functions, although that's of > course possible. > Ditto all this. When we converted resource to object I fully intended to propose adding methods on the context using pretty much exactly the API you describe. Digests lend themselves quite well to this, tbqh. I did want to separate the tech debt of removing resources from the feature creep of adding an OOP API though, and with that release already quite featurefull, plans to expand it fell by the wayside. Happy to co-author an RFC with you if you'd like to get involved directly, or I can just pick up the ball and run with it if you'd rather make the feature request then step back. -Sara --000000000000c6284705b18f869e--