Java versus C# Delegates

This white
paper
explains why Java doesn’t have C#-style delegates. It
should be read with care; the “application footprint” section is
pretty bogus, contrasting the existing reality of delegates with a
hypothetical (but easily possible) future world where anonymous
classes have less metadata.

What I found most interesting about this paper, though, is its
bigger mistake. Much of its argument is actually quite reasonable.
However, it completely misunderstands the psychology of programming
language adoption by developers, and in particular of those developers
most likely to imprint on a language and argue (usually inanely) about
its details. People in this mode don’t want to hear reasons why not,
they want notational convenience. I’m there myself when I complain
about missing UI interconnects and missing Gnome features… I don’t
care about the cost, I just want the darn feature.

Usually languages handle this by using their bureaucracy to thwart
some kinds of additions — which is usually a good thing. Java is no
exception here, but the situation is somewhat unusual because C#
occupies such a similar niche but has a very different design
philosophy.

C++/CLI

I read a draft of the proposed ECMA C++/CLI language
specification. This thing is so bad that it is hard to know where to
start critiquing it. How about, context-sensitive keywords? Or, my
personal favorite, keywords with embedded whitespace? This latter is
scarily close to Dalibor’s joke that some future Java will have
keywords in color… “oops, you want the salmon ‘if’ there”.

(This will actually be an important development for two reasons. First it will allow the
long-promised but never-quite-actualized crossover between
programming and interior decoration. Second, it will give a new and
richer meaning to the traditional Emacs haiku:
M-x font-lock-mode:
Your buffers should resemble
Angry fruit salad)

But back to the subject… a language with both templates
and generics. Yeah! A language that adds “^” and “%”
operators to go alongside “*” and “&”! Rock! This language is
like an ordinary programming language that fell into a huge vat at a
chemical factory, and emerged as a supervillain. With tentacles,
laser beam eyes, and the ability to change sex at will.

Clearly, though, what we really need is Objective C++/CLI. That
way we can combine all the bad and overlapping features, all the
punctuation, and all the insanity into one nice package. Which we can
then detonate.

Be the first to leave a comment. Don’t be shy.

Join the Discussion

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.