<html><head></head><body>
<p>Erg, I meant "Hi Levente", of course. It there an exception to
mark deprecated and suggest alternate code to use?</p>
<p>K, r<br/>
</p>
<div class="moz-cite-prefix">On 7/21/20 3:22 PM, Robert wrote:<br/>
</div>
<blockquote type="cite" cite="mid:U9UV-5f8EQVBLD_UhJ7WQVyomwvlC8rH4ki_VHOzw9m0x35G_ygzULxdlYk_YAeDq4zzWFFHQZzbW0cKkrHdq3t3mb9KHB3Fl_pAfJDvtAQ=@pm.me">
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<div>Hub Levente,</div>
<div><br/>
</div>
<div>I like the idea of SHA256 and friends to throw an exception
when #new is called directly </div>
<div> SHA256 new.</div>
<div>With a message to call newSHA256.</div>
<div><br/>
</div>
<div>What do you think?<caret></caret></div>
<div><br/>
</div>
<div id="protonmail_signature_block" class="protonmail_signature_block">
<div>
<div>Kindly,<br/>
Robert<br/>
</div>
</div>
</div>
<div><br/>
</div>
<div><br/>
</div>
On Tue, Jul 21, 2020 at 14:02, Levente Uzonyi <<a href="mailto:leves@caesar.elte.hu" class="" moz-do-not-send="true">leves@caesar.elte.hu</a>> wrote:
<blockquote class="protonmail_quote" type="cite"> Hi Chris,<br/>
<br/>
On Mon, 20 Jul 2020, Chris Muller wrote:<br/>
<br/>
> Hi Levente,<br/>
><br/>
> > > HashFunction newSHA256<br/>
> > ><br/>
> > > instead of<br/>
> > ><br/>
> > > SHA256 new<br/>
> > ><br/>
> > > in order to take advantage of Levente's plugin.<br/>
> ><br/>
> > That is indeed some sort of a change but it only
affects those who<br/>
> > compiled the SHA256Plugin themselves since that plugin
wasn't shipped with<br/>
> > the VM.<br/>
><br/>
> Ah, you're speaking about legacy code. I really hope we
can include your plugin in future VM's. Are Eliot, et al, on
board?<br/>
<br/>
The most recent VMs ship with the plugins.<br/>
<br/>
> > I decided against the practice of making #new return
an instance of<br/>
> > another class than the receiver, as it was with the
previous<br/>
> > implementation, because that makes it a lot harder for
others to<br/>
> > understand the code.<br/>
><br/>
> Hm. I sort of agree, although I guess Factory is a
recognized pattern. To me, the issue is that writing<br/>
><br/>
> "SHA256 new"<br/>
><br/>
> , is a perfectly intuitive and obvious way to use it,
but sticking out like a sore thumb as a subversively-wrong-way
to-use-it. It'd be better if it threw an error, and even better
than that if it just worked.<br/>
><br/>
> I know you care about the quantity of methods in the image
(as do I), how about quality? Can SHA256 #new be improved by
doing essentially what HashFunction #newSHA256 does, and simply
sending some alternative to new (i.e.,<br/>
<br/>
It's not clear what do you mean by caring about the quantity of
methods.<br/>
<br/>
> basicNew initialize) to avoid the recursion?<br/>
<br/>
That would do exactly what I do not want to do: #new would
return an<br/>
object whose class is not SHA256.<br/>
<br/>
><br/>
> Above, you mentioned you decided against the practice, does
that mean you're writing:<br/>
><br/>
> SHA256 newSHA256<br/>
><br/>
> ? If not, how did you do it?<br/>
<br/>
Use HashFunction's class side #new* methods to create the
instances.<br/>
HashFunction is a facade and a factory at the same time.<br/>
I originally wanted to create a separate class for this role
named Hasher,<br/>
but HashFunction seemed to work just as well.<br/>
<br/>
</blockquote>
</blockquote>
</body></html>