From: Kresten Krab Thorup <krab@daimi.au.dk>
To: Jeff Sturm <jsturm@sigma6.com>
Cc: Tom Tromey <tromey@cygnus.com>, Maury Markowitz <maury@oaai.com>,
java-discuss@sourceware.cygnus.com
Subject: Re: Objective-C vs. gcj (was: Re: Newbie questions)
Date: Sat, 01 Apr 2000 00:00:00 -0000 [thread overview]
Message-ID: <xz67lheqi53.fsf@xenon.daimi.au.dk> (raw)
In-Reply-To: <387CF708.C0499BC7@sigma6.com>
Jeff Sturm <jsturm@sigma6.com> writes:
> > When you say "weak" typing, what do you mean?
>
> He means Objective-C doesn't do any compile-time binding or even
> checking of method invocations. Every instance variable can be declared
> as "id" which is equivalent to Java's java.lang.Object class.
Equivalent is not quite right. The type `id' is a super-type for all
other types (including root classes such as Object); and indirections
(i.e., method calls) via a reference of type `id' are runtime
type-checked. The compiler will issue warnings in some cases, i.e.,
if it has not "seen" a method declaration with the given name.
> method name is misspelled or can't be resolved at runtime for any
> reason, a runtime error is thrown and the program generally aborts
> (which I consider a drawback of the language).
Right.
> Note that the Java _language_ is strongly typed though bytecode is
> not... all names are dynamically resolved from bytecode, just as in
> Obj-C.
Java byte-code is stronly type checked. The Verifier implements
almost the exact same semantics checks as the compiler does.
> > What is categorization?
The term `categories' stems from Smalltalk terminology. In the file
format for `filing in' code in a ST system, there is syntax that
allows methods to be added to existing classes. This is exactly the
functionality of categories. In Objective C, such categories can be
loaded at runtime.
> Objective-C has a neat feature which makes it extremely simple to write
> delegate classes. The runtime attempts to dispatch a method invocation
> to the named method, but if a method is not found it defaults to the
> "forward:" (?) method, which can be overridden to route the invocation
> to another object, or even marshal the arguments for delivery to a
> remote object. Obj-C had a very elegant solution to distributed
> programming that way.
>
> Similar tricks could be performed with Java reflection, I'd guess.
In Java, this is not possible; it would require a change to the
language semantics. The new 1.3 proxy stuff does something that comes
close, though.
-- Kresten
Kresten Krab Thorup "I like my eggs ploded"
Department of Computer Science, University of Aarhus
Aabogade 34, DK-8200 Aarhus N, Denmark
+45 8942 5665 (office), +45 2343 4626 (mobile)
next prev parent reply other threads:[~2000-04-01 0:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-04-01 0:00 Newbie questions Maury Markowitz
2000-04-01 0:00 ` Tom Tromey
2000-04-01 0:00 ` Objective-C vs. gcj (was: Re: Newbie questions) Jeff Sturm
2000-04-01 0:00 ` Kresten Krab Thorup [this message]
2000-04-01 0:00 ` [OFFTOPIC] " Joerg Brunsmann
2000-04-01 0:00 ` Per Bothner
2000-04-01 0:00 Maury Markowitz
2000-04-01 0:00 ` Jon Olson
2000-04-01 0:00 ` Jeff Sturm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xz67lheqi53.fsf@xenon.daimi.au.dk \
--to=krab@daimi.au.dk \
--cc=java-discuss@sourceware.cygnus.com \
--cc=jsturm@sigma6.com \
--cc=maury@oaai.com \
--cc=tromey@cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).