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-Thread: 103376,c406e0c4a6eb74ed X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!news-stoc.telia.net!news-stoa.telia.net!telia.net!masternews.telia.net.!newsc.telia.net.POSTED!not-for-mail From: =?ISO-8859-1?Q?Bj=F6rn_Persson?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114 X-Accept-Language: sv, sv-se, sv-fi, en-gb, en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: ADA Popularity Discussion Request References: <49dc98cf.0408110556.18ae7df@posting.google.com> <6F2Yc.848$8d1.621@newsread2.news.pas.earthlink.net> <413e2fbd$0$30586$626a14ce@news.free.fr> <9snhizowcwg9.16smaxkxhyu67$.dlg@40tude.net> <1m4nnmjq31u5p.1ufrf06w53qsz.dlg@40tude.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Message-ID: Date: Thu, 09 Sep 2004 16:00:37 GMT NNTP-Posting-Host: 217.209.116.179 X-Complaints-To: abuse@telia.com X-Trace: newsc.telia.net 1094745637 217.209.116.179 (Thu, 09 Sep 2004 18:00:37 CEST) NNTP-Posting-Date: Thu, 09 Sep 2004 18:00:37 CEST Organization: Telia Internet Xref: g2news1.google.com comp.lang.ada:3541 Date: 2004-09-09T16:00:37+00:00 List-Id: jayessay wrote: > Bj=F6rn Persson writes: >=20 >>Dmitry A. Kazakov wrote: >> >>>Because, take a static >>>language, derive everything from same base, and you will have the case= , >>>where the type information would be as useless (at compile time) as in= a >>>dynamically typed language. Static typing does not make type informati= on >>>unavailable. It makes it in some cases a-priory known. >> >>That's an interesting point. In Java, all classes are derived from >>Object. Yet I find type information useful in Java. But if all >>parameters of all methods were declared as Object, then it would start >>to look like a dynamically typed language. >=20 > Egads, no! It would begin to look _UN_typed! Please try to get a > grip on this. class Superclass { Object One; } class Subclass extends Superclass { Object Two; } class Other_Class {} class Proof { void A_Method(Object Thing) { System.out.println("This object's type is \"" + Thing.getClass().getName() +"\"."); System.out.println("Accessing \"One\"."); ((Superclass)Thing).One =3D new Other_Class(); if(Thing instanceof Subclass) { System.out.println("Accessing \"Two\"."); ((Subclass)Thing).Two =3D new Other_Class(); } } public static void main(String[] Param) { Object Super =3D new Superclass(); Object Sub =3D new Subclass(); Object Other =3D new Other_Class(); Object Demo =3D new Proof(); ((Proof)Demo).A_Method(Super); ((Proof)Demo).A_Method(Sub); ((Proof)Demo).A_Method(Other); } } $ javac Proof.java $ java Proof This object's type is "Superclass". Accessing "One". This object's type is "Subclass". Accessing "One". Accessing "Two". This object's type is "Other_Class". Accessing "One". Exception in thread "main" java.lang.ClassCastException at Proof.A_Method(Proof.java:7) at Proof.main(Proof.java:22) Note how everything is declared as Object. Note how the type of each=20 object can still be determined. Note how Java refuses to turn an=20 Other_Class object into a Superclass object. Do you consider this=20 untyped? If so, please state exactly how you define "untyped", so we can = start speaking the same language. --=20 Bj=F6rn Persson PGP key A88682FD omb jor ers @sv ge. r o.b n.p son eri nu