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.

Reply via email to