Path: utzoo!utgpu!water!watmath!clyde!rutgers!labrea!decwrl!hplabs!hpda!hpesoc1!hpcllla!hpclisp!hpclscu!shankar From: shankar@hpclscu.HP.COM (Shankar Unni) Newsgroups: comp.lang.pascal Subject: Re: Complex arithmetic Message-ID: <950005@hpclscu.HP.COM> Date: 13 Jan 88 17:50:09 GMT References: <11219@brl-adm.ARPA> Organization: HP ITG/ISO Computer Language Lab Lines: 39 / hpclscu:comp.lang.pascal / 4526P%NAVPGS.BITNET@CUNYVM.CUNY.EDU (LT Scott A. Norton, USN) / 6:42 pm Jan 11, 1988 / > My first gripe is that Pascal doesn't provide, or let me define, infix > arithmetic operators for complex numbers. Fortran has complex math > built in, and Ada lets you define "+", for example, as an operator > for user-defined types. This is one among several big hits against Pascal, at least as it is defined by the ANSI folks. Lots of other features (seperate compilation, type coercion, pointer manipulation, extensibility, etc) are also missing. There is an evolving standard for Extended Pascal (also by the ANSI committee) which has most of these features, and a whole lot more (to the point where it looks like a union of Pascal, FORTRAN and COBOL (shudder!!)). But the most important "feature", i.e. extensibility of the language (ability to define and overload operators, add "predefines" (inline procedures)) is still absent. C++ (or objective C) is much better in this regard, giving the programmer the ability to define classes of objects, and overloaded functions and operators (a lot like ADA) to generate inline code for these types. As a starter, the compiler comes with a few such types implemented as add-on include files, to give the programmer a good example to base his/her modules on. One of these, of course, is a "complex" module. I realise, of course, that this is no consolation to you. As Pascal stands today (or even as it stands tomorrow, for that matter), you may have to define "LISP-like" functions to do your stuff. BTW, most Pascals allow users to return structures as function return values, so at least you should be able to get rid of most of the new/dispose stuff: simply define functions like: function add (var c1, c2 : complex) : complex; ... ----------------------------------------------------------------------------- Shankar Unni allegra) Unix Mail: shankar@hpda.hp.com UUCP: ucbvax)!hplabs!hpda!shankar sun) (AT&T: (408) 447-5797) decwrl) -----------------------------------------------------------------------------