Article View: comp.lang.modula2
Article #332Re: Overloading Operators: Extension to Language
From: Thomas Koenig
Date: Thu, 05 Oct 1989 13:05
Date: Thu, 05 Oct 1989 13:05
44 lines
2799 bytes
2799 bytes
MARKV@UKANVAX writes:
> I really don't see what the arguement is. If you wan't to return an
> array or record why not just return the pointer? Visually it is still
> obvious in the code what you are doing and is fast also. If you want
> to return a new record or array, then there is NEW or ALLOCATE.
>
> -Mark Gooderum
> MARKV@UKANVAX
The point is the following: If I have to do, for example, complex
arithmetic with complicated formulas, I don't want to have to keep
track of what I have allocated in the meantime. (Ever try a Newton
iteration with a formula like f(x)=exp((a*x**2+b*x+c)/(d*x+e)) ?)
The derivative in the case above is quite complicated, without the
added bother of either
1) defining my own stack for calculations
2) using auxilliary variables for intermediate results (I tried
that once; the result was a program I could not read although
I had written it)
3) allocating space for intermediate results which has to be
deallocated later (or else I am going to see some very strange
results when space runs out on the heap)
4) keeping track of real and imaginary parts seperately
In complicated formulas using complex arithmetic, I don't want to do
any of the four above, because the mathematics is bothersome enough
without the added complexity of bookkeeping. If I can't do it in
Modula, I will do it in FORTRAN or C (FORTRAN because it already has
complex arithmetic). I don't want to use either language more than I
can help it, because I think Modula is much superior to both of them
in almost every respect, but at present, Modula does not leave me
much of a choice in such matters.
With the possibilities of returning at least records via function
values and with of passing multidimensional arrays of varying size to
procedures, like level 1 ISO Pascal, which allows the construct
procedure something(var a:array[1..n,1..m] of real); ,
after which the array a and the integers n and m can be accessed,
Modula would be my language of choice for numerical work. As it is
today, it isn't.
Thomas Koenig UI0T@DKAUNI2.BITNET
UI0T%DKAUNI2.BITNET@CUNYVM.CUNY.EDU
(soon) UI0T@IBM3090.RZ.UNI-KARLSRUHE.DE
Technical Details
Message-ID:
<"89-10-05-13:54:59.55*UI0T"@DKAUNI2.BITNET>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!DKAUNI2.BITNET!UI0TShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!DKAUNI2.BITNET!UI0T From: UI0T@DKAUNI2.BITNET (Thomas Koenig) Newsgroups: comp.lang.modula2 Subject: Re: Overloading Operators: Extension to Language Message-ID: <"89-10-05-13:54:59.55*UI0T"@DKAUNI2.BITNET> Date: 5 Oct 89 13:05:18 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: Modula2 List <INFO-M2%UCF1VM.BITNET@PSUVM.PSU.EDU> Organization: The Internet Lines: 44 X-Unparsable-Date: Thu, 5 Oct 89 13:54:00 LCL