Thread overview | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
March 29, 2005 Writing Java in D | ||||
---|---|---|---|---|
| ||||
Here's a followup to the other popular thread here, "Writing C in D" (even though that one was hijacked) For fun, I implemented Java's String, List and Map in D. (not the real classes, just something resembling them...) I called it "Dcaf" : http://www.algonet.se/~afb/d/dcaf/html/class_string.html http://www.algonet.se/~afb/d/dcaf/html/class_string_buffer.html http://www.algonet.se/~afb/d/dcaf/html/struct_list.html http://www.algonet.se/~afb/d/dcaf/html/struct_map.html I didn't make them generic (templates), since it was just a simple toy example on how one can write Java-like D code ? The real classes are : http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html http://java.sun.com/j2se/1.4.2/docs/api/java/lang/StringBuffer.html http://java.sun.com/j2se/1.4.2/docs/api/java/util/List.html http://java.sun.com/j2se/1.4.2/docs/api/java/util/Map.html Also filled in some missing parts on the "Java to D" page: http://www.prowiki.org/wiki4d/wiki.cgi?JavaToD The idea was to have it put next to the other such pages, that is "C to D" and "C++ to D" in the main documentation. http://www.digitalmars.com/d/ctod.html http://www.digitalmars.com/d/cpptod.html I think D would actually be easier for Java programmers than C or C++ would, due to them having several things in common... Porting some real Java code and running some benchmarks would be fun ? Who knows, it might even have some real use... (Like for "molt" or so) http://dsource.org/projects/molt/ --anders |
March 29, 2005 Re: Writing Java in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anders F Björklund |
Anders, IMHO that is too much of wasted energy and time. If someone wants to
REALY contribute to D - better to work on pure, "native" UI, ie. standard D
UI which would be used everywhere, or to help DTL project, or Phobos,
or ... core D .
D needs good, stable, flexible frameworks for common programming tasks - DB, NET, UI, SCIENCE, ...
--
...........
Dejan Lekic
http://dejan.lekic.org
|
March 29, 2005 Re: Writing Java in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anders F Björklund | > I called it "Dcaf" : cute :-) > Also filled in some missing parts on the "Java to D" page: http://www.prowiki.org/wiki4d/wiki.cgi?JavaToD > > The idea was to have it put next to the other such pages, that is "C to D" and "C++ to D" in the main documentation. http://www.digitalmars.com/d/ctod.html http://www.digitalmars.com/d/cpptod.html > > I think D would actually be easier for Java programmers than C or C++ would, due to them having several things in common... agreed - porting Java to D is pretty easy. I'll add some more tips to that page: non-trivial initialization of data members must go in ctors, how to deal with inner classes and how to port synchronization constructs. > Porting some real Java code and running some benchmarks would be fun ? Who knows, it might even have some real use... (Like for "molt" or so) http://dsource.org/projects/molt/ I added the port of Doug Lea's Java locks library to that list as another example. |
March 29, 2005 Re: Writing Java in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dejan Lekic | Dejan Lekic wrote: > Anders, IMHO that is too much of wasted energy and time. And I didn't even get paid to do it, either... :-) You might be overestimating the amount of time that went into it, though. (not into D, but into "Java-D") It was just a quick hack. > If someone wants to > REALY contribute to D - better to work on pure, "native" UI, ie. standard D > UI which would be used everywhere, or to help DTL project, or Phobos, > or ... core D . I've done those. Too. This was just a little side-track. My reasoning wen't like: If it's easier for Java programmers to start with D, then those same programmers could help out with D too ? --anders |
March 29, 2005 Re: Writing Java in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anders F Björklund | In article <d2btof$1nr2$1@digitaldaemon.com>, =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= says... >My reasoning wen't like: >If it's easier for Java programmers to start with D, >then those same programmers could help out with D too ? Don't let anyone's opinion deter you. IMO, anything that can accelerate the adoption of D by new programmers, is a good thing. BTW, I like the 'Dcaf' name. Now, what we really need is something along the lines of a "methodone" lib to get the c++ junkies un-hooked and on to D. <j/k> - EricAnderton at yahoo |
March 29, 2005 Re: Writing Java in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ben Hinkle | "Ben Hinkle" <bhinkle@mathworks.com> wrote in message news:d2bslg$1mv2$1@digitaldaemon.com... > > I called it "Dcaf" : > cute :-) I think that's inspired <g>. > agreed - porting Java to D is pretty easy. I'll add some more tips to that page: non-trivial initialization of data members must go in ctors, how to deal with inner classes and how to port synchronization constructs. These will be a big help. |
March 29, 2005 Re: Writing Java in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anders F Björklund | In article <d2btof$1nr2$1@digitaldaemon.com>, =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= says... > >If it's easier for Java programmers to start with D, >then those same programmers could help out with D too ? Yes, and I think Java programmers will also be delighted to see those familiar utility classes and APIs instead of learning a new one. This certainly will help them to start using D. BTW, whey you choose to JDK1.4.2? If you hack the 1.5 code, we will get all the good template stuff for free: e.g. http://java.sun.com/j2se/1.5.0/docs/api/java/util/Map.html I hate to cast everything back and forth from Object! |
March 29, 2005 Re: Writing Java in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to nobody | nobody@d.com wrote: > Yes, and I think Java programmers will also be delighted to see those familiar > utility classes and APIs instead of learning a new one. This certainly will > help them to start using D. It wasn't really intended as a standard library, just to show how it *could* be implemented in D... > BTW, whey you choose to JDK1.4.2? Because JDK 1.5 is not available for PowerPC yet ? And besides, I only know JDK 1.4.2 myself anyway :-) --anders |
March 30, 2005 Re: Writing Java in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anders F Björklund | Anders F Björklund wrote: > Here's a followup to the other popular thread here, > "Writing C in D" (even though that one was hijacked) > > For fun, I implemented Java's String, List and Map in D. > (not the real classes, just something resembling them...) > > > I called it "Dcaf" : Awesome! ... > I think D would actually be easier for Java programmers than > C or C++ would, due to them having several things in common... Sure. And there's no reason why we should look only to the C/C++ community for converts. Everyone's invited. -- jcc7 http://jcc_7.tripod.com/d/ |
March 30, 2005 Re: Writing Java in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anders F Björklund | In article <d2bjsu$1aun$1@digitaldaemon.com>, =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= says... > >Here's a followup to the other popular thread here, "Writing C in D" (even though that one was hijacked) > >For fun, I implemented Java's String, List and Map in D. (not the real classes, just something resembling them...) > > >I called it "Dcaf" : > >--anders A very original name, that's cute...I like it! :)) David L. ------------------------------------------------------------------- "Dare to reach for the Stars...Dare to Dream, Build, and Achieve!" |
Copyright © 1999-2021 by the D Language Foundation