<div dir="ltr"><br><br>On Thursday, March 6, 2014 4:41:08 PM UTC-6, Chris Angelico wrote:<div> </div><blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
<br>What does your proposed hierarchy offer that numbers.Number doesn't?
<br><br></blockquote><div><br></div><div>hi Chris, numbers.Number is the right concept, but not the correct relationship...</div><div>in sixty's vernacular, its the right hoo hoo but the wrong tah tah...</div><div><br></div><div>Here is the numbers.Number hierarchy:</div><div><br></div><div>CLASSES</div><div> builtins.object</div><div> Number</div><div> Complex</div><div> Real</div><div> Rational</div><div> Integral</div><div> </div><div><br></div><div>Compare numbers.Number with my proposal. (I am not wanting to go into semantics at</div><div>this point, but the numbers.Number model is not unified and has problems. If it were</div><div>ok, we would not be having this discussion. ) The age old question, "How's that working</div><div>for you?" Well, not too well. </div><div><br></div><div>Chris, its not just the virtual function table, its also operator overloading, and its policy </div><div>handled by (AI) that intelligently decides what to do if someone tries to add a real_b with</div><div>a real_d. But, it should not do this:</div><div><br></div><div><div>>>> from pdeclib import *</div><div>>>> x=1</div><div>>>> y=Decimal(.1)</div><div>>>> x+y</div><div>Decimal('1.10000000000000000555111512312578270211816')</div><div>>>> </div></div><div><br></div><div>The policy hidden under the abstraction way down in the guts of the Class</div><div>hierarchy should make the decision to do this:</div><div><br></div><div><div>>>> ====== RESTART =====</div><div>>>> from pdeclib import *</div><div>>>> x=1</div><div>>>> y=.1</div><div>>>> </div><div>>>> def add_(x, y):</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>return d(x)+d(y)</div><div><br></div><div>>>> add_(x, y)</div><div>Decimal('1.1')</div><div>>>> </div></div><div><br></div><div>Please don't pick at this. The point is not the code or the syntax. The point</div><div>is that the policy in a correctly related Class hierarchy can handle somebody</div><div>asking the system to add a 1.23b with a 1.23d , and if setup correctly, will </div><div>just work. </div><div><br></div><div>The idea is to unify numbers, so that efficient intelligent processing can occur</div><div>without "types" or "limits".</div><div><br></div><div>I'll say more later... after we see how folks respond.</div><div><br></div><div>marcus</div></div>