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: 103376,1116ece181be1aea X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-09-09 01:23:52 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news2.telebyte.nl!npeer.de.kpn-eurorings.net!rz.uni-karlsruhe.de!feed.news.schlund.de!schlund.de!news.online.de!not-for-mail From: "Dr. Michael Paus" Newsgroups: comp.lang.ada Subject: Re: Is the Writing on the Wall for Ada? Date: Tue, 09 Sep 2003 10:19:55 +0200 Organization: 1&1 Internet AG Message-ID: References: NNTP-Posting-Host: p508303c6.dip0.t-ipconnect.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: online.de 1063095596 8486 80.131.3.198 (9 Sep 2003 08:19:56 GMT) X-Complaints-To: abuse@einsundeins.com NNTP-Posting-Date: Tue, 9 Sep 2003 08:19:56 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030612 X-Accept-Language: en-us, en In-Reply-To: X-Enigmail-Version: 0.76.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime Xref: archiver1.google.com comp.lang.ada:42310 Date: 2003-09-09T10:19:55+02:00 List-Id: Hi there is no need to discuss this issue here any longer, because the problem is well known and will be fixed in the upcoming release of Java (1.5 Tiger). http://jcp.org/aboutJava/communityprocess/jsr/tiger/static-import.html Greetings Michael Russ wrote: > Hyman Rosen wrote in message news:... > >>Russ wrote: >> >>>Suppose I want to take the sine of an angle in Java. Can I somehow set >>>things up so that I can simply write "sin(x)", or must I write >>>something like "math.sin(x)"? The former is acceptable to me, but the >>>latter is not. >> >>The latter generally. Also for cases like this, 'math' would be a class, >>not an object, and 'sin' would be a static method. If that's too odious, >>you can always do this: >> >> class MotherOfAnythingIWouldEverCall >> { >> double sin(double x) { return math.sin(x); } >> // etc. >> } >> >> class MyClass extends MotherOfAnythingIWouldEverCall >> { >> double f(double x) { return sin(sin(x)); } >> } >> >>But no one would do that. Just pretend you're using Ada in a shop >>that has forbidden use clauses. > > > Then Java was certainly not designed for elegant implementation of > algorithms. > > Let me give you a brief example of some basic greatcircle calculations > based on a spherical model of the earth. > > The great circle distance d between two points with coordinates > {lat1,lon1} and {lat2,lon2} is given by: > > d = 2 * asin(sqrt((sin((lat1-lat2)/2))^2 + > cos(lat1)*cos(lat2)*(sin((lon1-lon2)/2))^2)) > > We obtain the initial course, tc1, (at point 1) from point 1 to point > 2 by the following. The formula fails if the initial point is a pole. > > tc1 = mod(atan2(sin(lon1-lon2)*cos(lat2), > cos(lat1)*sin(lat2)-sin(lat1)*cos(lat2)*cos(lon1-lon2)), > 2*pi) > > The corresponding equations for the ellipsoidal model of the earth are > far more complicated, but even these relatively simple equations > demonstrate the awkwardness of using Java for algorithms. The latter > expression has no less than 9 math functions plus a constant (pi), and > you're telling me I must precede each one with "math." (or do some > other nonstandard trick). > > You can have it.