From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1108a1,b87849933931bc93 X-Google-Attributes: gid1108a1,public X-Google-Thread: 103376,b87849933931bc93 X-Google-Attributes: gid103376,public X-Google-Thread: fac41,b87849933931bc93 X-Google-Attributes: gidfac41,public X-Google-Thread: 114809,b87849933931bc93 X-Google-Attributes: gid114809,public X-Google-Thread: 109fba,b87849933931bc93 X-Google-Attributes: gid109fba,public From: piercarl@sabi.demon.co.uk (Piercarlo Grandi) Subject: Re: OO, C++, and something much better! Date: 1997/02/19 Message-ID: X-Deja-AN: 219833495 X-NNTP-Posting-Host: sabi.demon.co.uk X-Disclaimer: Contents reflect my personal views only References: <5de62l$f13$1@goanna.cs.rmit.edu.au> <32FB8B51.1759@concentric.net> <3302DB3E.F70@concentric.net> Content-Type: text/plain; charset=US-ASCII Organization: Home's where my rucksack's Mime-Version: 1.0 (generated by tm-edit 7.94) Newsgroups: comp.lang.c++,comp.lang.smalltalk,comp.lang.eiffel,comp.lang.ada,comp.object Date: 1997-02-19T00:00:00+00:00 List-Id: >>> "jsa" == Jon S Anthony writes: [ ... on the role of operators and the interpration of "+", I would say ... ] piercarl> It was also perhaps not clear that by "maths" I meant piercarl> something like ``ordinary maths'', a not well defined but piercarl> hopefully intuitively perceivable notion; jsa> And? Presumably, by "ordinary maths" here you really mean jsa> arithmetic. No, telepathy does not work over the net. I meant something like ``the sort of maths ordinary people learn at ordinary schools''. Which is rather fuzzy notion, for reasons illustrated below. jsa> That is a precisely and rigorously defined system. Of course any given system of arithmetic is (hopefully) so; but the notion of ``arithmetic'' *isn't*. There is a large difference between a mathematical system like a particular formalization of a particular arithmetic system and the fuzzy notion of ``ordinary maths'', or even that of ``arithmetic''; it is a fuzzy notion because while most probably it includes *some* sort ofarithmetic, it may include several other things. Consider just this: suppose one wanted to say that ``ordinary maths'' is the maths that most people learn at school; well, different countries, and different types of school in the same country, teach different extensions of ``ordinary maths''. Then what type of school? High school? College? University? And which subject? And so on. Thus my warning that using ``familiar'' looking syntax in programming may be dangerous: for it gives a false sense of recognition of notions like ``addition'' that are really quite ambiguous. Some particular notion of ``addition'' can be well defined; but perhaps ``surprisingly'': piercarl> for most any given procedure indicated by "+" computes *some* piercarl> mathematical function, even if not necessarily the one piercarl> indicated by "+" in most ``ordinary maths'' jsa> Presumably you simply mean here that "computer arithmetic" or the jsa> specification of arithmetic operations in a programming language jsa> definition is not the same as standard arithmetic (even though in jsa> many practical cases you can ignore the differences). Well, sure. Well, sure, but the important thing is that in many practical cases one *cannot* ignore the differences, not that in others one *can*, for it when one cannot that problems arise. Also, in order to be able to ignore the differences (and many do, without realizing it), a non trivial amount of analysis (for example range analysis) may have to be performed. Particularly horrid subtleties happen with the various ways that ``real'' numbers are approximated. Again, to me it may well be misleading to use for programming a notation that resembles that of ``ordinary maths'', for it induces in the innocent some terrible assumptions, some of which are even true, like yours "in many practical cases you can ignore the differences". Yeah, but it's dangerous not to check that this is the case, and notational similarity can mislead on how often this can be done. This impinges on OO: 'class Complex' should perhaps bear a prominent sticker saying "Warning: use of instances of this class as if they were complex numbers can be hazardous to your health". piercarl> (one favourite example is that "+" between 'unsigned' operands piercarl> in ``C'' computes the function ``addition module 2^N'' rather piercarl> than addition on nonnegative numbers). jsa> Why is congruential arithmetic not ordinary? Get real! I doubt that for example the average MBA or the average medical doctor would consider congruential arithmetic ``ordinary'', even if they may well agree that it has a precise definition and theory, if they have heard it exists. Even the average PhD in geography (a subject that is not totally devoid of maths courses like history would be) may not be that familiar with congruential arithmetic. jsa> Note that this too has a completely precise and rigorous definition jsa> and theory. Again, there is a difference between a rigorous definition and theory of any particular mathematical subject, and the notion of ``ordinariness'', congruential arithmetic, however precisely and rogorously defined in any particular incarnation, is normally known only to those that have studied fairly ``advanced'' maths at university Also, if one looks at two "congruential arithmetic" chapters in two relevant texbooks, their scope will be rather different. The notion of ``congruential arithmetics'' is rather fuzzy itself, for there are _many_ possible "completely precise and rigorous definition and theory." of it. piercarl> by "+" in some branch of maths would tend to be few; one major piercarl> factor is that procedures usually compute functions over piercarl> finite domains/codomains, which is almost never the case in piercarl> [``ordinary''] maths, and even in ``discrete'' maths. jsa> What makes you say that?? Certainly any congruence system has this jsa> exact aspect. Large chunks of combinatorics deal in finite jsa> systems. What about finite groups? And whose to say that in "day jsa> to day arithmetic" you aren't dealing with a congruence system jsa> whose modulus just happens to be 10^50 or something? Ah sure, you would expect the average college or university graduate, ``ordinary'' people that contend with ``ordinary maths'', deal day-to-day in combinatorics, finite groups, arithmetic mod 10^50, and so on, for example when figuring out their taxes or planning next year's budget for their practice. :-). piercarl> At times, BTW, I am not so sure that is such a good idea, for piercarl> while the function computed by the "+" procedure usually piercarl> somewhat resembles the function indicated by "+" in maths, the piercarl> details (and vital ones) are as a rule grotesquely different piercarl> (just consider addition of 'real's and of 'R'eals). jsa> Again - it depends on context. jsa> There are cases where the two will denote identical results. piercarl> Well, this is actually quite impossible as literally written piercarl> :-); the results of any particular "+" operation are in the piercarl> domain of implementation entities, those of any articular "+" piercarl> function are in the domain of mathematical entities. jsa> Yes, I see the "smiley", but I'm not sure this distinction is true jsa> or of any use. It is indeed very useful; for ``computational'' entities and``mathematical'' entities have really intrinsically different properties. The notation may be the same, the syntax even, but one forgetting that ``maths'' and ``computing'' are very different things leads to overoptimism and eventually (pretty quickly) mistakes. Learning to avoid such an attitude is for example one of the first things that numerical analysts have to do. I remember a famous paper that explains various ways to write a good program that finds, if any, the two real roots of a 2nd order equation; it is absolutely nontrivial, jsa> It would seem to imply that any set of "squiggles" on a blackboard jsa> or piece of paper are "implementation entities" and have not much jsa> to do with the mathematical entities they represent. I don't think jsa> so... Well, let's say that "not much to do" is an unfair caricature of what I have written. They are related; the relationship may even be straighforward; but they are rather different things with rather different properties. piercarl> What you probably wanted to say is that it can happen that the piercarl> function computed by some particular "+" operation is exactly piercarl> the same as that meant by some "+" function in ``ordinary'' piercarl> maths. jsa> What I meant was that you can't distinguish the two in any jsa> meaningful way even if they are "in some sense different". I hope you don'tq really mean this, for this is quite gross! If you mean it, well, an aversion at distinguishing different sorts of entities, mathematical and computational entities, for example, can be be quickly remedied by reading any sort of nice introductory textbook, I would suggest "Structure and Interpretation of computer programs". [ ... some agreeable agreements deleted, to avoid offending News tradition :-) :-) :-) ... ]