www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Translating Java into D

reply NonNull <non-null use.startmail.com> writes:
Greetings, Java seems to be almost a subset of D in various ways. 
Has there been any work done to automatically translate Java 
source into D?
Nov 14 2019
next sibling parent reply Heromyth <bitworld qq.com> writes:
On Thursday, 14 November 2019 at 19:50:22 UTC, NonNull wrote:
 Greetings, Java seems to be almost a subset of D in various 
 ways.
No, it's not exactly right. Java is more powerful than D as for a language. Many things that Java can do can't be done by D. For example, reflection, full meta info for a type in runtime, type deduction for a template, template member override. See: https://stackoverflow.com/questions/4829631/unusual-generic-syntax-arrays-stringaslist https://www.baeldung.com/java-executor-service-tutorial
 Has there been any work done to automatically translate Java 
 source into D?
We ported some projects in Java by hand.
Nov 14 2019
next sibling parent reply Andre Pany <andre s-e-a-p.de> writes:
On Friday, 15 November 2019 at 03:29:16 UTC, Heromyth wrote:
 On Thursday, 14 November 2019 at 19:50:22 UTC, NonNull wrote:
 Greetings, Java seems to be almost a subset of D in various 
 ways.
No, it's not exactly right. Java is more powerful than D as for a language. Many things that Java can do can't be done by D. For example, reflection, full meta info for a type in runtime, type deduction for a template, template member override. See: https://stackoverflow.com/questions/4829631/unusual-generic-syntax-arrays-stringaslist https://www.baeldung.com/java-executor-service-tutorial
 Has there been any work done to automatically translate Java 
 source into D?
We ported some projects in Java by hand.
With the compile time reflection capabilities of D you can build a runtime reflection system. Therefore I would say D has reflection. The other points I do not have enough knowledge what Java provides. Kind regards Andre
Nov 15 2019
parent Heromyth <bitworld qq.com> writes:
On Friday, 15 November 2019 at 13:15:29 UTC, Andre Pany wrote:
 On Friday, 15 November 2019 at 03:29:16 UTC, Heromyth wrote:
 On Thursday, 14 November 2019 at 19:50:22 UTC, NonNull wrote:
 Greetings, Java seems to be almost a subset of D in various 
 ways.
No, it's not exactly right. Java is more powerful than D as for a language. Many things that Java can do can't be done by D. For example, reflection, full meta info for a type in runtime, type deduction for a template, template member override. See: https://stackoverflow.com/questions/4829631/unusual-generic-syntax-arrays-stringaslist https://www.baeldung.com/java-executor-service-tutorial
 Has there been any work done to automatically translate Java 
 source into D?
We ported some projects in Java by hand.
With the compile time reflection capabilities of D you can build a runtime reflection system. Therefore I would say D has reflection. The other points I do not have enough knowledge what Java provides. Kind regards Andre
Yes, you can do everything with D in theory. The fact is that there are many stuff waiting for you to implement them when you are porting a project from Java to D, like the different or missing APIs, language features etc. See what we got from the portings: Containers: https://github.com/huntlabs/hunt/tree/master/source/hunt/collection Threading: https://github.com/huntlabs/hunt/tree/master/source/hunt/concurrency
Nov 15 2019
prev sibling next sibling parent reply GreatSam4sure <greatsam4sure gmail.com> writes:
On Friday, 15 November 2019 at 03:29:16 UTC, Heromyth wrote:
 On Thursday, 14 November 2019 at 19:50:22 UTC, NonNull wrote:
 Greetings, Java seems to be almost a subset of D in various 
 ways.
No, it's not exactly right. Java is more powerful than D as for a language. Many things that Java can do can't be done by D. For example, reflection, full meta info for a type in runtime, type deduction for a template, template member override. See: https://stackoverflow.com/questions/4829631/unusual-generic-syntax-arrays-stringaslist https://www.baeldung.com/java-executor-service-tutorial
 Has there been any work done to automatically translate Java 
 source into D?
We ported some projects in Java by hand.
? I really sure of this? Can this be true ? Pls I need more clarity on this by professional in this group. I am of the opinion that D is much more powerful than Java since I am familiar with the language to some extent. I am even to start a GUI app in java due to the fact I have no find a GUI toolkit in D that meet all my need. I will appreciate detail analysis of this claim
Nov 15 2019
parent Jacob Carlborg <doob me.com> writes:
On 2019-11-16 08:13, GreatSam4sure wrote:

 I am of the opinion that D is much more powerful than Java since I am 
 familiar with the language to some extent. I am even to start a GUI app 
 in java due to the fact I have no find a GUI toolkit in D that meet all 
 my need.
There's DWT [1], which is a port of the Eclipse SWT Java library. [1] https://github.com/d-widget-toolkit/dwt -- /Jacob Carlborg
Nov 16 2019
prev sibling parent Alexandru Ermicioi <alexandru.ermicioi gmail.com> writes:
On Friday, 15 November 2019 at 03:29:16 UTC, Heromyth wrote:
 On Thursday, 14 November 2019 at 19:50:22 UTC, NonNull wrote:
 Greetings, Java seems to be almost a subset of D in various 
 ways.
No, it's not exactly right. Java is more powerful than D as for a language. Many things that Java can do can't be done by D. For example, reflection, full meta info for a type in runtime, type deduction for a template, template member override. See: https://stackoverflow.com/questions/4829631/unusual-generic-syntax-arrays-stringaslist https://www.baeldung.com/java-executor-service-tutorial
 Has there been any work done to automatically translate Java 
 source into D?
We ported some projects in Java by hand.
Regarding template member override. Generics in java are mainly compile time thing that boils down to auto generated casts when working with generic types (in bytecode), and therefore a templated method in java is actually a standard method that just works with Object class under the hood, hence it is possible to override in implementor of interface/class. It can be done in D too you'll just need to strip out generics part in method declaration and just use casts from root Object for worst case. Also what do you mean by "type deduction for a template"? Best regards, Alexandru.
Nov 16 2019
prev sibling next sibling parent DanielG <simpletangent gmail.com> writes:
Potentially relevant old thread:

https://forum.dlang.org/thread/ssdcoqhylmskfytfiian forum.dlang.org
Nov 15 2019
prev sibling parent Jacob Carlborg <doob me.com> writes:
On 2019-11-14 20:50, NonNull wrote:
 Greetings, Java seems to be almost a subset of D in various ways. Has 
 there been any work done to automatically translate Java source into D?
Yes, I'm working on a tool, JPort [1], for automatically translating Java to D. It's not done yet and there's been a couple of years now since I last worked on the project. [1] https://github.com/d-widget-toolkit/jport/tree/dev -- /Jacob Carlborg
Nov 16 2019