Re: Re: want an Object-oriented interface for HashContext

From: Date: Mon, 12 Oct 2020 14:01:20 +0000
Subject: Re: Re: want an Object-oriented interface for HashContext
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-112037@lists.php.net to get a copy of this message
Op ma 12 okt. 2020 om 14:55 schreef Christoph M. Becker <cmbecker69@gmx.de>: > 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. > > Dear all, As a user/developer of the language itself: it seems to me this is what a package using composer could easily fix right? Does this really have to land in core to be used in the wild? With the proliferation of all the up and coming features and performance improvements it seems to me like these types of improvements using lower level PHP interfaces / native functions have no merit in core itself? (packagist / composer packages don't always have to be full frameworks / large solutions right IMHO) This would also allow the developer to pick and choose a personal style and we don't have to flood the internals with bikeshedding ;) Robin Speekenbrink

« previous php.internals (#112037) next »