Re: Java to D

2019-08-31 Thread GreatSam4sure via Digitalmars-d-learn

On Saturday, 31 August 2019 at 16:44:01 UTC, Patrick wrote:
On Wednesday, 28 August 2019 at 10:33:33 UTC, GreatSam4sure 
wrote:
On Wednesday, 28 August 2019 at 09:35:55 UTC, Jacob Carlborg 
wrote:

[...]



Thanks i will check it up


Take a look at JavacTo  
https://sourceforge.net/projects/javacto/


This is a java tool that uses the javac compiler to translate 
java to another language.  And includes a java to D code set.


It is a very visual tool and has great animation during 
translation and works well while using the java debugger. I 
include “How to get started with Eclipse”.


You can find more translations statistics at this post: 
https://forum.dlang.org/thread/yuamvgsdfshgrbesm...@forum.dlang.org#post-yuamvgsdfshgrbesmjlt:40forum.dlang.org


Hope this helps

Patrick



Thanks a lot. I will dive in soon. I am in the mid of a project 
now


Re: Java to D

2019-08-31 Thread Ernesto Castellotti via Digitalmars-d-learn

On Wednesday, 28 August 2019 at 08:14:25 UTC, GreatSam4sure wrote:

Good day everyone.

DWT is a library for creating cross-platform GUI applications. 
It's a port of the SWT Java library from Eclipse. Currently 
supported platforms are Windows, using Win32 and Linux, using 
GTK.


[...]


Perhaps this tool could be useful 
https://github.com/jtransc/jtransc





Re: Java to D

2019-08-31 Thread Patrick via Digitalmars-d-learn

On Wednesday, 28 August 2019 at 10:33:33 UTC, GreatSam4sure wrote:
On Wednesday, 28 August 2019 at 09:35:55 UTC, Jacob Carlborg 
wrote:

On 2019-08-28 10:14, GreatSam4sure wrote:

[...]


DWT is ported manually from Java. Here's a very short guide 
[1]. That guide is probably written for D1.



[...]


I'm working on a tool do be able to automatically convert Java 
code to D code [2]. It's been a while since I did any actual 
work on that project. As far as I can remember, it can do a 
syntactic translation of most Java code. What's remaining is 
the semantic translation.


[1] http://dsource.org/projects/dwt/wiki/Porting
[2] https://github.com/d-widget-toolkit/jport/tree/dev



Thanks i will check it up


Take a look at JavacTo  https://sourceforge.net/projects/javacto/

This is a java tool that uses the javac compiler to translate 
java to another language.  And includes a java to D code set.


It is a very visual tool and has great animation during 
translation and works well while using the java debugger. I 
include “How to get started with Eclipse”.


You can find more translations statistics at this post: 
https://forum.dlang.org/thread/yuamvgsdfshgrbesm...@forum.dlang.org#post-yuamvgsdfshgrbesmjlt:40forum.dlang.org


Hope this helps

Patrick






Re: Java to D

2019-08-28 Thread GreatSam4sure via Digitalmars-d-learn
On Wednesday, 28 August 2019 at 09:35:55 UTC, Jacob Carlborg 
wrote:

On 2019-08-28 10:14, GreatSam4sure wrote:

[...]


DWT is ported manually from Java. Here's a very short guide 
[1]. That guide is probably written for D1.



[...]


I'm working on a tool do be able to automatically convert Java 
code to D code [2]. It's been a while since I did any actual 
work on that project. As far as I can remember, it can do a 
syntactic translation of most Java code. What's remaining is 
the semantic translation.


[1] http://dsource.org/projects/dwt/wiki/Porting
[2] https://github.com/d-widget-toolkit/jport/tree/dev



Thanks i will check it up


Re: Java to D

2019-08-28 Thread Jacob Carlborg via Digitalmars-d-learn

On 2019-08-28 10:14, GreatSam4sure wrote:

Good day everyone.

DWT is a library for creating cross-platform GUI applications. It's a 
port of the SWT Java library from Eclipse. Currently supported platforms 
are Windows, using Win32 and Linux, using GTK.


What are the tools and step involved in converting a java GUI toolkit to 
D2? Is it possible in D2? What are the tools and steps involved? Is 
there any tutorial involve? Can one get a mentor for such a program in 
the forum


DWT is ported manually from Java. Here's a very short guide [1]. That 
guide is probably written for D1.


I am thinking if it is possible to port JavaFX to D(i.e. DFx). That will 
be nice for the D language. Javafx is a nice GUI toolkit.


I am basically interested in GUI desktop app that connects to the web 
for the now.


I can do that on Java but I would love to use D if it is possible.


I will be happy to be linked to material, tools, and tutorial that will 
be of help


I'm working on a tool do be able to automatically convert Java code to D 
code [2]. It's been a while since I did any actual work on that project. 
As far as I can remember, it can do a syntactic translation of most Java 
code. What's remaining is the semantic translation.


[1] http://dsource.org/projects/dwt/wiki/Porting
[2] https://github.com/d-widget-toolkit/jport/tree/dev

--
/Jacob Carlborg


Java to D

2019-08-28 Thread GreatSam4sure via Digitalmars-d-learn

Good day everyone.

DWT is a library for creating cross-platform GUI applications. 
It's a port of the SWT Java library from Eclipse. Currently 
supported platforms are Windows, using Win32 and Linux, using GTK.


What are the tools and step involved in converting a java GUI 
toolkit to D2? Is it possible in D2? What are the tools and steps 
involved? Is there any tutorial involve? Can one get a mentor for 
such a program in the forum


I am thinking if it is possible to port JavaFX to D(i.e. DFx). 
That will be nice for the D language. Javafx is a nice GUI 
toolkit.


I am basically interested in GUI desktop app that connects to the 
web for the now.


I can do that on Java but I would love to use D if it is possible.


I will be happy to be linked to material, tools, and tutorial 
that will be of help






Re: Switching from Java to D: Beginner questions, multiplatform issues, etc.

2014-02-28 Thread Jesse Phillips

On Friday, 28 February 2014 at 12:10:17 UTC, Bienlein wrote:
This topic mentions IMHO an important point: D is not only 
interesting for C++ people, but also for Java developers. 
Companies that are happy with Java may have little incentive to 
change to D or maybe Go. But when starting something new D can 
be an alternative to Java as it also can be used for 
application development to some extend (has a GC, fast build 
times and other things that result in good productivity). 
Someone like me who has spent his career with Smalltalk and 
Java and doesn't know a thing about systems programming can get 
along with D quite easily. Something like a "D for Java 
developers" user guide would make sense IMHO.


Well, not exactly what you are after. But there have been Java 
related guides, which could use some updating and moving to the 
new wiki:


http://wiki.dlang.org/Coming_From/Java

http://www.prowiki.org/wiki4d/wiki.cgi?ComingFrom/Java
http://www.prowiki.org/wiki4d/wiki.cgi?JavaToD


Re: Switching from Java to D: Beginner questions, multiplatform issues, etc.

2014-02-28 Thread Bienlein
This topic mentions IMHO an important point: D is not only 
interesting for C++ people, but also for Java developers. 
Companies that are happy with Java may have little incentive to 
change to D or maybe Go. But when starting something new D can be 
an alternative to Java as it also can be used for application 
development to some extend (has a GC, fast build times and other 
things that result in good productivity). Someone like me who has 
spent his career with Smalltalk and Java and doesn't know a thing 
about systems programming can get along with D quite easily. 
Something like a "D for Java developers" user guide would make 
sense IMHO.


D has better performance than Java and better productivity than 
C++. Java is starting to get polluted with several things like 
dependency on XML which really degrades productivity. I don't 
spend my time looking for bugs in source code, but in XML 
definition files (every framework has XML, some even allow you to 
define logic in XML like Apache Camel). And this takes much more 
time than when looking into code.


Then Java suffers from its threading model which is suitable for 
general purpose programming, but not for web applications. For 
WhatsApp a single machine holds over a million network 
connections (see 
https://www.erlang-solutions.com/about/news/erlang-powered-whatsapp-exceeds-200-million-monthly-users) 
due to Erlang's threading model being able to get this 
accomplished. In Go more than 100k network connections is also 
not a problem (according to some tweet by Rob Pike). What seems 
to attract people to Go is Go's threading model that is very well 
suited for network programming and server-side web development. 
But Go's language is simplistic and that probable won't change. 
My impression is that this is on purpose. They want a modernized 
C and that's it. So there is room for D here for server-side 
development à la Go but with a high-level language. There is 
really hell going on in Go's user forum. Multi-threading and 
concurrency through goroutines as well as good libraries for 
network programming seem to be the driving factors for Go.


D is really modelling power as well. That's the big win over Go. 
No Java/EE architect will accept a language without inheritance 
nor method overriding. I think there is no feature in Scala that 
D doesn't have (except implicits, which is a good thing not to 
have). On the contrary D has immutable types and pure functions. 
Things that aren't possible in Scala due to limitations of the 
JVM or need for interoperability.


-- Bienlein


Re: Switching from Java to D: Beginner questions, multiplatform issues, etc.

2014-02-27 Thread DS6

On Thursday, 27 February 2014 at 23:12:16 UTC, Ali Çehreli wrote:
Because this is actually a newsgroup (i.e. NNTP), pretending to 
be a forum. :)


I could kinda tell from both the URL and the "Posting to 
digitalmars.D.learn" line.

I've never used a newsgroup before, cool.


Re: Switching from Java to D: Beginner questions, multiplatform issues, etc.

2014-02-27 Thread Ali Çehreli

On 02/27/2014 03:09 PM, DS6 wrote:

Also *3: Not having to make an account to post here is also nice. I
don't really like signing up for things.


Because this is actually a newsgroup (i.e. NNTP), pretending to be a 
forum. :)


Ali



Re: Switching from Java to D: Beginner questions, multiplatform issues, etc.

2014-02-27 Thread DS6
Also *3: Not having to make an account to post here is also nice. 
I don't really like signing up for things.


Re: Switching from Java to D: Beginner questions, multiplatform issues, etc.

2014-02-27 Thread DS6

On Thursday, 27 February 2014 at 22:58:40 UTC, Ali Çehreli wrote:

But of course: :)


Yeah I found that out already; I have schoolwork to do but D is 
really interesting and stuff and argh.
I think one of the things I also like about D so far is the 
community.
Most Java communities, when I asked questions about 
hard/not-before-accomplished tasks, were either completely 
ignored or "LOL GO USE THIS LIBRARY" when I wanted to do it 
myself. I have a feeling it's not going to be like that here, 
with the way all of you cool doods have been replying.


Also, not having headers is totally rad. I never liked headers. 
Having the compiler handle that for you is very nice.


Also also, I've noticed that D supports lax typecasting through 
the "auto" type, oh God I didn't even know that that is wonderful.


Re: Switching from Java to D: Beginner questions, multiplatform issues, etc.

2014-02-27 Thread Ali Çehreli

On 02/27/2014 02:40 PM, DS6 wrote:

> What exactly is the difference between C and D headers?

D code that needs to use a C library must use "D bindings" of that C 
library. Here is Deimos, a collection of D bindings of many C libraries:


  https://github.com/D-Programming-Deimos

More information:

  http://dlang.org/interfaceToC.html

> Interesting that Facebook uses it, not to mention even such a
> high-scaled company should praise D over C++.

A recent article about that:


https://code.facebook.com/posts/729709347050548/under-the-hood-building-and-open-sourcing-flint/

> I'll probably find this out on my own eventually, but does D support
> operator overloading?

But of course: :)

  http://dlang.org/operatoroverloading.html

Ali



Re: Switching from Java to D: Beginner questions, multiplatform issues, etc.

2014-02-27 Thread Simon Bürger

What exactly is the difference between C and D headers?
D itself does not use headers at all. But you will need "D 
headers", if you want to call a C library from D. The translation 
is mostly syntatic and straight forward like:

* replace #define-constants with enums
* replace macros with (templated) functions
* replace #ifdef with static-if / version
etc...


Metaprogramming is always welcomed; makes things much easier in 
the long run.
I'll probably find this out on my own eventually, but does D 
support operator overloading? That would be simply amazing.

Absolutely it does. Even in a more "meta"-way than c++:

struct S
{
int x;
S opBinary(string op)(S other) // overloads + - * / % all at 
once

{
  return mixin("x "~op~" other.x");
}
}


Re: Switching from Java to D: Beginner questions, multiplatform issues, etc.

2014-02-27 Thread Jeremy DeHaan

On Thursday, 27 February 2014 at 22:40:36 UTC, DS6 wrote:

What exactly is the difference between C and D headers?


D does not have any separation between header and code files like 
C or C++. There are files with the .di extension which are 
similar, but not quite the same. What he meant is that you need 
to bring the declaration code found in header files into your D 
code so that the compiler knows they exist.




Re: Switching from Java to D: Beginner questions, multiplatform issues, etc.

2014-02-27 Thread DS6

On Thursday, 27 February 2014 at 10:52:51 UTC, John Colvin wrote:
It's a flexible, well designed language. Many things that are 
complex and/or slow in other languages can be written in a 
readable and performant manner, with fewer nasty surprises.


I find I usually run into some "nasty surprises", especially when 
dealing with complex tasks, in Java, having to constantly 
recompile and retest my code. This is a welcomed change.


Fine as long as you stick with x86/x86_64 CPUs and a normal 
desktop operating system, i.e. Linux, Windows, OS X, ***BSD


If I ever decide to go multiplatform with my applications, those 
would be all I would target anyway. My code would be open-source 
regardless, so it's not like someone couldn't port it.


Support for other types of systems is work-in-progress, mostly 
focused around gdc/ldc as dmd is an x86/x86_64 only compiler. 
Bear in mind that the same frontend is used for all 3 
compilers, dmd is the reference compiler, gdc/ldc lag 1 release 
behind dmd.


I've grown up on x86 so other architectures are pretty far in the 
future.


You can use any C library from D, but you have to port the 
headers. This has been done for many libraries


What exactly is the difference between C and D headers?
=
Links to other languages include 
https://github.com/JakobOvrum/LuaD


That is a _very_ welcomed link. Lua would have to be my favorite 
scripting language to use.
There are numerous Java ports for Lua, but they're much harder to 
develop for than the original C variant.


Depends on your definition of enterprise. There are companies 
that use D (http://wiki.dlang.org/Current_D_Use).


Interesting that Facebook uses it, not to mention even such a 
high-scaled company should praise D over C++.


In my opinion, D code is highly scalable and maintainable. In 
particular, the strength of D's metaprogramming makes for 
flexible code.


Metaprogramming is always welcomed; makes things much easier in 
the long run.
I'll probably find this out on my own eventually, but does D 
support operator overloading? That would be simply amazing.



Overall, D is a pragmatic language.


Thank you for taking the time to answer my questions, I am much 
more interested in D now.


Re: Switching from Java to D: Beginner questions, multiplatform issues, etc.

2014-02-27 Thread John Colvin

On Thursday, 27 February 2014 at 10:23:40 UTC, DS6 wrote:

Okay, down to the questions I have about D:
 - Why should I use D over another language? What general 
benefits does it provide me, in relation to the points I made 
about it above? Is it a solid base to build off of, but still 
simple in nature?


It's a flexible, well designed language. Many things that are 
complex and/or slow in other languages can be written in a 
readable and performant manner, with fewer nasty surprises.



 - How is multiplatform compilation handled by D?


Fine as long as you stick with x86/x86_64 CPUs and a normal 
desktop operating system, i.e. Linux, Windows, OS X, ***BSD


Support for other types of systems is work-in-progress, mostly 
focused around gdc/ldc as dmd is an x86/x86_64 only compiler. 
Bear in mind that the same frontend is used for all 3 compilers, 
dmd is the reference compiler, gdc/ldc lag 1 release behind dmd.


 - How well supported is D? I've read that D is still 
relatively... Not new, or young, but less known than other 
languages. Does it have support for major libraries, like SDL? 
Aside: Whether or not these libs are "official" or not doesn't 
matter to me, they usually aren't anyway.


You can use any C library from D, but you have to port the 
headers. This has been done for many libraries, see here: 
http://code.dlang.org/

There are some nice D-style wrappers that exist as well.
Links to other languages include 
https://github.com/JakobOvrum/LuaD, 
https://bitbucket.org/ariovistus/pyd
C++ libraries are less well supported, but there has been a 
certain amount of success.



 - How is D used in the enterprise world?


Depends on your definition of enterprise. There are companies 
that use D (http://wiki.dlang.org/Current_D_Use).


 - Lastly, and probably most important, is D code scalable and 
easy to maintain? You never know, something I make could gain 
popularity and I would suddenly need to mass-produce and 
heavily modify my code to suit the needs of whatever crowd of 
people suddenly want my services, whatever services I may 
offer. Is going large-scale from an initially small-scale 
project or otherwise prototype at least comparable, say, Java 
(which is quite easy to manage large-scale if you do things 
right)?


In my opinion, D code is highly scalable and maintainable. In 
particular, the strength of D's metaprogramming makes for 
flexible code.




Overall, D is a pragmatic language.


Switching from Java to D: Beginner questions, multiplatform issues, etc.

2014-02-27 Thread DS6
Though this post may seem long, my questions are indeed asked. I 
just kinda started typing and didn't stop; I guess this is both a 
question post and a vent post. Please bear with me.


Hello, I'm a hobbyist programmer, and I'm tired of the way things 
are going. I'm looking for a change.
I must admit, I've been pampered most of my programming life: 
I've consistently used higher-level languages, like Java (which I 
have been using as of late), that do all the work for you. But I 
find it's hard to quickly prototype and implement new ideas and 
to test new code because of that. Creating a solution to an 
otherwise simple task takes numerous new and extended classes and 
lots of time. There's always the option of choosing a dedicated 
external library or otherwise development environment to build 
off of a central idea, but I want to keep things simple and work 
with the core essentials and not resort to learning the ins and 
outs of another codebase. Sadly, Java's "core essentials" are 
absolutely humungous and hard to keep track of. If I feel the 
need to search for an alternative development environment just to 
get a more focused feature subset that may or may not already 
exist in part or in full in a language, I don't really think that 
language is right for me and what I want to accomplish, whatever 
that may be at the time.
As an example, I would occasionally find myself making some code 
that does nearly the same thing as an already-implemented class 
in the JDK/JRE, simply because I forgot to do any research on the 
topic beforehand or I didn't think there was already a solution 
for my problem.


Overall, using Java takes massive dedication for the language and 
a large, pre-defined, solidly-built goal, and I may not have some 
or all of the previous at any point in time while both fleshing 
out my ideas and working on already-established projects. When 
programming in Java, there is a large number of classes that are 
available for one to use, that are fully-featured and complete, 
and function extremely well for their intended purpose. However, 
the way Java is set up makes me feel like I have to twist and 
bend those classes into the idea I see in my head, instead of 
using them as a base like they're intended to be used. I could 
always start from scratch and build my classes how I want, using 
other classes only when necessary, but what's the point in that 
when there's already classes out there that do what I want, and 
probably more efficiently? Instead I dig through them until I 
find something that works how I want it to and may occasionally 
miss something that works better or fits my desires better 
because I simply didn't notice it or got fed up with looking and 
stopped. It's been like that for all of the more expansive 
higher-level languages I've used, not just Java.


(Aside: Don't get me wrong, I am NOT bashing Java. It's an 
excellent, solid framework that can handle damn near anything you 
throw at it, and usually in a very skilled, complete, and 
well-thought-out manner. It's great for both small- and 
large-scale, enterprise operations, and is able to function at 
full-capacity in the most intense of circumstances. It certainly 
has its place, a place it holds firmly and effectively, but I 
don't really think it's good for me; I'm not exactly some bigwig 
company that needs XYZ huge projects produced.)


It really comes down to what you're looking for. Honestly, I'm 
still not sure what I'm looking for, but I know I love 
programming and I want to find my calling for it. I've always 
wanted to get into general game design but I've never really 
found anything that truly clicks with me. I've tried other game 
design-specific solutions, even ones designed for Java like 
jMonkeyEngine, but development with these types of applications 
is usually very closed and has that pre-built "here use this 
class" feeling like Java does.
I must sound pretty hypocritical/demanding here; I want a solid 
base to work off of but I don't want it to feel pre-built? I 
suppose what I mean is that I want it to work as-is, but I also 
want things to be bare enough so that I can create what I want 
without worrying about what class to use or what method to 
override. Java isn't just your average framework, it has 
everything you could ever need... And that's not really what I 
want. I want a skeleton, so that I can fill in the parts that I 
need to how I want, without resorting to using X number of 
classes. Not only do I feel that restricts my creative abilities, 
but it's generally difficult. That's part of the reason I chose 
D: It has all the advantages of using a low-level language, 
mainly in its simplicity, but with the ease of use and 
completedness that comes from using a higher-level language, or 
as so I've read about it.


I want programming to be challenging and engaging, and moreover 
fun and enjoyable, while having it not being a chore just to 
accomplish little goals. Java kinda feel