<div><div dir="auto">IMO the double dispatch mechanism is pretty elegant, and I found it to work well even after extending Smalltalk to cover much more of mathematics.</div><div dir="auto"><br></div><div dir="auto">What I found more important is to make sure that every element has “parent”, an algebraic structure it belongs to. Then, if I try to do ‘a * b’ with a and b in two different rings A and B for example, the double dispatch mechanism looks for a canonical ring homomorphism A -> B or B -> A to convert one of the elements, and then resends the message with both elements in the same ring, works perfectly.</div><div dir="auto"><br></div><div dir="auto">Anyway, this is just implemented for convenience, in truth I don’t really need it and I could just raise an exception when trying to multiply two elements of different rings.</div><div dir="auto"><br></div><div dir="auto">In the base image there’s a little annoyance because of the automatic conversion of x/1 fractions to the integer x. I ended up creating a new class Rational and avoiding Fraction in my code, but it’s not a big deal for me, and the way Fractions work in the base image seems to be what most people expect.</div></div><div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, 2 Jan 2021 at 12:52 AM, Ces VLC via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st" target="_blank">cuis-dev@lists.cuis.st</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="ltr">Hi again!<div><br></div><div>Being completely new to Smalltalk, I learnt about the "double dispatch" technique yesterday, and my first reaction was that I felt quite disappointed, because everything I was learning in Smalltalk was clean, tidy, and efficient, ...until I read about double dispatching.</div><div><br></div><div>Then I searched the Blue Book for double dispatching and found zero matches. Then I learnt Smalltalk-80 used "generality numbers" instead of double dispatching. With a bit more of searching, I found Cuis uses double dispatching because that change was done in Squeak by Ingalls time ago.</div><div><br></div><div>When reading the "generality numbers" approach in the Blue Book, I don't feel disappointed at all: it looks to me like the clean and obvious solution to the problem (ie: binary operators should be legal for objects of the same class only, and trying to perform a binary on different classes should trigger an error... however, if for some reason you want Smalltalk to do the conversion for you, the generality number approach doesn't break tidiness and pure design).</div><div><br></div><div>But I have a question, though: Did any of you have a long experience with Smalltalk-80 and found the generality number technique to be a limiting factor? I mean: Were your applications worse written (ie: with worse design) because of not having double dispatch?</div><div><br></div><div>I'd like to check whether Smalltalk without double dispatching is worse than with it, or not.</div><div><br></div><div>Thanks a lot,</div><div><br></div><div>César</div></div><div dir="ltr"><div><br></div></div>
-- <br>
Cuis-dev mailing list<br>
<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
<a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
</blockquote></div></div>
</div>