RE: Generating C# from Java (Was: fit, nfit, et al?)

Daniel Gackle <[email protected]> Thu, 07 Aug 2003 21:13:34 -0600
Newsgroups gmane.comp.programming.tools.fit.devel
Message-ID <[email protected]>
Michael,

The difficulties you mention are indeed difficulties, but they apply to the
reverse direction: they are C# constructs that would be hard to translate
into Java.  Happily, we wouldn't have to deal with them at all.  Sort of
like doing a reverse commute, watching all the traffic lined up in the other
direction. :)

The question is, what Java-only constructs would be hard to translate into
C#?  One that comes to mind is anonymous classes.  However, there are fewer
of these, and I'm not (yet) aware of any showstoppers.  (In the particular
case of anonymous classes, MS are adding them to C# anyway so arguably one
wouldn't bother.)

I agree with you that this is NOT the simplest thing that could possibly
work.  Java and C# may be closer than any other two languages I've worked
with, but this would still be a big job.

The issue here is the tradeoff.  If you spend X units of effort porting
stuff by hand, for what X would it make more sense to take the time to build
a tool to do it (and future such tasks) automatically?  My feeling is that
for translating any single program, X is probably less than that threshold.
But if you have a community working on translating N programs, N times X may
be greater than that threshold.

Daniel

p.s. I don't want to get too far off-topic. If this is annoying anyone,
please say so and I will set up a separate channel.


-----Original Message-----
From: [email protected]
[mailto:[email protected]]On Behalf Of Michael C Two
Sent: Thursday, August 07, 2003 8:43 PM
To: [email protected]
Subject: Re: [Fit-dev] Generating C# from Java (Was: fit, nfit, et al?)



I'm not so sure it would work out that well. It would be a little difficult
to add support for things like properties, indexers, delegates and events in
a generator. I think there is just enough different between the languages
that you end up with hand written code mixing in with generated.

I like the idea from the stand point of there being one FIT but it happens
to run in many languages (make it FIT once and it FITs anywhere, probably
gettig myself in trouble with SUN). But I'm not sure how practical it is.

There were some minor issues in the first .NET port of FIT since things like
the defauly access level are different. Methods without an access specifier
are private in C# so the classes were not extendable. Things like that would
probably be corrected but I don't think the converters are smart enough to
know to write code to access methods or properties.

I like the idea buy I can't say it is in the simplest thing that could
possibly work catagory yet.

ThoughtWorks, where being meta-cognitive is something worth thinking about.