<div dir="ltr"><div>Hi Chris,</div><div>(Fraction numerator: 5 denominator: 1) is an improper Fraction, everything can happen because it does not fulfill the contract: proper fractions shall be reduced.</div><div>Even if you fix = by reverting to previous version, other things may break.</div><div>For example, what happens with:</div><div><br></div><div>    [c = a] assert.</div><div><br></div><div>Another example:</div><div><br></div><div>    | a b |<br>    a := Fraction numerator: 2 denominator: 10.<br>    b := Fraction numerator: 3 denominator: 15.<br>    [a hash = b hash] assert.<br></div><div><br></div><div>Yet another:</div><div><br></div><div>    [((Fraction numerator: 2 denominator: 250) nthRoot: 3) = 5 reciprocal] assert.</div><div><br></div><div>Dealing with improper Fraction could be possible, but would involve extra costs for all sorts of operations.</div><div>I advise not to, respecting the invariant enables simpler and efficient code.</div>In the same way, you can create Dictionaries that are not properly rehashed (example when restoring from 32 to 64 bits with too low level constructs). We can, but shall better not.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le ven. 31 déc. 2021 à 14:38, Marcel Taeumel <<a href="mailto:marcel.taeumel@hpi.de">marcel.taeumel@hpi.de</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div id="gmail-m_-5534919838181473549__MailbirdStyleContent" style="font-size:10pt;font-family:Arial;color:rgb(0,0,0);text-align:left" dir="ltr">
                                        One more comment: This used to work by accident before Nicolas actually made use of the contract (established in 1999) in Fraction >> #=. Is this actually a matter of backwards compatibility?<div><br></div><div>Best,</div><div>Marcel</div><div></div><blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-top:20px;margin-left:0px;padding-left:10px">
                        <p style="color:rgb(170,170,170);margin-top:10px">Am 31.12.2021 14:33:36 schrieb Marcel Taeumel <<a href="mailto:marcel.taeumel@hpi.de" target="_blank">marcel.taeumel@hpi.de</a>>:</p><div style="font-family:Arial,Helvetica,sans-serif"><div id="gmail-m_-5534919838181473549__MailbirdStyleContent" style="font-size:10pt;font-family:Arial;color:rgb(0,0,0);text-align:left" dir="ltr">
                                        Ha! Reading the comment in #numerator:denominator:, this isn't really a bug but an inconvenience:<div><br></div><div><div><span style="font-size:13.3333px">NOTE: This primitive initialization method will not reduce improper fractions,</span></div><div><span style="font-size:13.3333px"><span style="white-space:pre-wrap">   </span>so normal usage should be coded as, eg,</span></div><div><span style="font-size:13.3333px"><span style="white-space:pre-wrap">           </span>(Fraction numerator: a denominator: b) reduced</span></div><div><span style="font-size:13.3333px"><span style="white-space:pre-wrap">    </span>or, more simply, as</span></div><div><span style="font-size:13.3333px"><span style="white-space:pre-wrap">               </span>a / b</span></div></div><div><span style="font-size:13.3333px"><br></span></div><div><span style="font-size:13.3333px">-- di 8/31/1999</span></div><div><span style="font-size:13.3333px"><br></span></div><div><span style="font-size:13.3333px">:-)</span></div><div><span style="font-size:13.3333px"><br></span></div><div><span style="font-size:13.3333px">No transitive law broken here. Not sure how we can avoid using #numerator:denominator: without #reduced ... sounds like a linting rule to enforce ...</span></div><div><span style="font-size:13.3333px"><br></span></div><div><span style="font-size:13.3333px">Best,</span></div><div><span style="font-size:13.3333px">Marcel</span></div><div></div>
                                        <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-top:20px;margin-left:0px;padding-left:10px;min-width:500px">
                        <p style="color:rgb(170,170,170);margin-top:10px">Am 31.12.2021 14:30:39 schrieb Marcel Taeumel <<a href="mailto:marcel.taeumel@hpi.de" target="_blank">marcel.taeumel@hpi.de</a>>:</p><div style="font-family:Arial,Helvetica,sans-serif"><div id="gmail-m_-5534919838181473549__MailbirdStyleContent" style="font-size:10pt;font-family:Arial;color:rgb(0,0,0);text-align:left" dir="ltr">
                                        Hi Chris --<div><br></div><div>> <span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">Fraction numerator: 5 denominator: 1.</span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">I think that the issue is that this line does not answer an Integer but a Fraction. Numbers are special in the object-oriented world in that they can change their class without notice. :-)</span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">This works:</span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">| a b c |</span><br style="font-family:Arial,Helvetica,sans-serif;font-size:13px"><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">a := 5/1.</span><br style="font-family:Arial,Helvetica,sans-serif;font-size:13px"><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">b := 5.0.</span><br style="font-family:Arial,Helvetica,sans-serif;font-size:13px"><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">c := 5.</span><br style="font-family:Arial,Helvetica,sans-serif;font-size:13px"><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">self assert: a=b; assert: b=c.   "Pass"</span><br style="font-family:Arial,Helvetica,sans-serif;font-size:13px"><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">self assert: a=c.    "Fail"</span><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">Best,</span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">Marcel</span></div><div></div><blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-top:20px;margin-left:0px;padding-left:10px;min-width:500px">
                        <p style="color:rgb(170,170,170);margin-top:10px">Am 31.12.2021 01:30:25 schrieb Chris Muller <<a href="mailto:ma.chris.m@gmail.com" target="_blank">ma.chris.m@gmail.com</a>>:</p><div style="font-family:Arial,Helvetica,sans-serif">
<div dir="ltr"><div>__________<div><i>“If a is equal to b and b is equal to c, then a is equal to c.”</i><br></div></div>__________<div><br></div><div>| a b c |<br>a := Fraction numerator: 5 denominator: 1.<br>b := 5.0.<br>c := 5.<br>self assert: a=b; assert: b=c.   "Pass"<br>self assert: a=c.    "Fail"<br></div><div>__________<br></div><div><div><br></div><div>I understand this is not a normal way to create Fractions, but serializers must often construct objects in other-than-normal ways.  This constructor on Fraction is actually a valid API, but leaves an inconsistent comparison contract with other Numbers.<br></div></div><div><br></div><div>I fixed it by reverting Fraction>>#= to the (nice 3/28/2006 23:41) edition.<br><br>Comments?</div><div><br></div></div>
</div></blockquote>
                                        </div></div></blockquote></div></div></blockquote>
                                        </div></div><br>
</blockquote></div>