Re: Unclear about the benefits of D over C++ and Java

2016-01-05 Thread Wyatt via Digitalmars-d

On Sunday, 3 January 2016 at 18:39:21 UTC, Shannon wrote:
On Sunday, 3 January 2016 at 15:38:18 UTC, Dibyendu Majumdar 
wrote:


I am looking to choose between D, Swift and Rust for a project 
that I am currently coding in C++. So far D seems the 
alternative but I guess I won't know until I try out a few 
things.


Why I now choose D, even for commercial jobs...


Nice story; mind if we put it on the user narratives wiki page?

-Wyatt


Re: Unclear about the benefits of D over C++ and Java

2016-01-05 Thread welkam via Digitalmars-d
On Saturday, 2 January 2016 at 11:31:24 UTC, Dibyendu Majumdar 
wrote:
* Do D compilers generate more efficient code compared to C++ 
compilers? Are there performance benchmarks comparing D 
implementation against C and C++?


* Can D generics do everything C++ templates can (are they 
Turing complete for instance) - and what additional 
capabilities does D have that would make a significant 
difference to the way templates are used in C++?


* How does D's performance compare with Java when it comes to 
concurrent applications or garbage collection?


* How stable is D? Can one use it without fear that the next 
version will significantly change the language and therefore 
one would have to rewrite?


I feel that the D website could do more to explain why someone 
should move from C++ or Java to D - and this has to be 
explained in terms of real world benefits in terms of:


* Performance
* Quality of implementation

For someone like me - cool language features don't count that 
much unless they lead to real world benefits.


My post here was triggered after watching a video by Andrei 
where he talked about how D generics are different from C++ 
templates - I think stuff like that needs to be explained in 
the front page of D website.


Regards
Dibyendu

http://ravilang.org
http://simpledbm.org



Are there performance benchmarks comparing D
implementation against C and C++?


C style D code will run the same as C style C++ code and a C 
style C code because they all compile to the same machine code. 
There will be differences if you use higher level language 
features, but then you are trading performance for convenience 
and its up to you to decide if that trade off is worth it.


Also keep in mind that D compilers do not apply all possible 
optimisation and your code next year my become faster.


* How does D's performance compare with Java when it comes to 
concurrent applications or garbage collection?


In this world there are two options:
1. You build language around GC sacrificing flexibility and 
performance if you dont use GC.

2. Or you add simple GC.

D went with second option. D`s GC will never be as good as Java, 
C# or GO because it requires language change, but D can be used 
without GC and reach C level of performance.




You asked a lot about language performance, but application 
performance is mostly dependant on code you write and not the 
language you use. Benchmarking and tuning your code will give way 
more performance than changing languages.


Re: Unclear about the benefits of D over C++ and Java

2016-01-03 Thread Ola Fosheim Grøstad via Digitalmars-d

On Sunday, 3 January 2016 at 04:25:55 UTC, israel wrote:
But maybe its just me, maybe im too young to know the olden 
days of the 80s/90s where C++ was a godsend compared to C. Or 
was it? I dont know, i wasnt alive...


C++ was hyped up in the press and commercial sector because it 
provided abstraction mechanisms on top of the existing C 
infrastructure. But most academics viewed C++ as an ugly hack 
back then, so it was no God send. Many programmers viewed it as 
bloated and inefficient, and it kinda was because compilers could 
not beat hand optimized C code (or: computers were too slow to 
make good compilers practical).  So C++ was more of an 
application level language than system level language.


That is still true, but today CPUs are fast, bottle necks are 
more in the memory system/multi threading, CPU internals are less 
transparent and programmers have less optimization skills... 
Which paves the way for high level programming languages like 
Swift.



Modern C++ is tolerable and fairly decent, but it will take a 
proficient programmer years to master. The big issue with C++ is 
that you also need to learn what _not_ to do, by trail and 
error...


C++ is not a language that one can reasonable select for a 
one-off project, it's a language for experts only. Unlike Python, 
Ruby, Swift or Go.


Maybe D2 is becoming a language for experts too at this point. A 
stronger focus on consistency and ergonomics would be beneficial.




Re: Unclear about the benefits of D over C++ and Java

2016-01-03 Thread Dibyendu Majumdar via Digitalmars-d

Hi,

I am looking to choose between D, Swift and Rust for a project 
that I am currently coding in C++. So far D seems the alternative 
but I guess I won't know until I try out a few things.


Is this the right forum to ask questions or should questions be 
sent to another forum?


Regards
Dibyendu



Re: Unclear about the benefits of D over C++ and Java

2016-01-03 Thread tsbockman via Digitalmars-d
On Sunday, 3 January 2016 at 15:38:18 UTC, Dibyendu Majumdar 
wrote:

Hi,

I am looking to choose between D, Swift and Rust for a project 
that I am currently coding in C++. So far D seems the 
alternative but I guess I won't know until I try out a few 
things.


Is this the right forum to ask questions or should questions be 
sent to another forum?


Regards
Dibyendu


Specific questions about how to program in D belong in the 
"Learn" forum: http://forum.dlang.org/group/learn




Re: Unclear about the benefits of D over C++ and Java

2016-01-03 Thread Ola Fosheim Grøstad via Digitalmars-d
On Sunday, 3 January 2016 at 09:55:14 UTC, Ola Fosheim Grøstad 
wrote:
C++ was hyped up in the press and commercial sector because it 
provided abstraction mechanisms on top of the existing C 
infrastructure.


And just to give some context to this: in the 80s a large number 
of programmers were self-taught and had never been exposed to a 
disciplined language like Java as their first language, many 
started with BASIC and machine language. At best they had some 
experience with ad hoc structured programming in Pascal.


In the 80s it was not uncommon to implement applications or 
portions of applications in assembly, and CISC CPUs like motorola 
68k had a rather high level instruction set so it wasn't as 
unpleasant as it sounds. One guy I knew implemented a full 
fledged BBS system (Amiga BBS) in assembly because he didn't know 
C and thought he might as well do it in machine language rather 
than learning C...


In that context C++/OOP provided a new market for educational 
books and magazine articles and lots of "propaganda". Which in 
turn made C++ fashionable... It created a sense of "you need to 
learn C++", yet in practice many just used it as C with inlining 
and overloading...




Re: Unclear about the benefits of D over C++ and Java

2016-01-03 Thread Shannon via Digitalmars-d
On Sunday, 3 January 2016 at 15:38:18 UTC, Dibyendu Majumdar 
wrote:


I am looking to choose between D, Swift and Rust for a project 
that I am currently coding in C++. So far D seems the 
alternative but I guess I won't know until I try out a few 
things.


Why I now choose D, even for commercial jobs...

C++ had been my primary language (personally and professionally) 
for 20 years, and it was effective and enjoyable for me.  But, I 
was naive.  I didn't realize that what made it enjoyable for me, 
is that I always used effective and complete frameworks/toolsets 
(IBM VisualAgeC++ on OS/2, BeOS standard API, Qt on everything) 
with effective base classes and data structures that all worked 
together.  When forced out of my comfortable space, by a project 
a couple years ago that allowed no dependencies on Qt, I 
discovered the grief of C++.


So, time to give D a try.  I'd watched it through the tumultuous 
years, and saw that it had settled down. I like the pedegree of D 
- a pragmatic approach from a creator of a commercial C++ 
compiler.  Also, I was encouraged to see Alexander jump in to 
contribute to D (even before the D foundation announcement), as 
he's been tirelessly working to improve C++ over the years.


I, like you, wanted to "try out a few things" before committing 
to D on commercial effort. I found myself fantastically 
productive (more than C++, even with Qt) using rdmd to begin 
script-like and refactor as it grew. Easy, like Python that 
produces fast compiled single executables that are easy to deploy 
(even to folks without a Python development environment 
installed), especially with the 'import' feature to embed 
external resources.  It is so easy to keep unit tests current and 
running, and so easy to see testing code coverage, that I felt 
always safe refactoring.  I appreciate the ability to mark any 
scope @safe, and have the compiler keep me honest.


And I found myself using more "esoteric" features that were a 
pain in C++.  I loved the concept of meta-programming in C++, but 
always found myself using features in my framework - which had 
taken the great pains to provide the necessary functionality.  I 
found implementing threads and concurrency in D every bit as 
simple and safe as Qt.


Admittedly, GUI stuff in D is a mixed bag.  I've settled on 
creating D console applications that transmits json data, via 
stdin/stdout, directly into Qt base model classes so the rest of 
the Qt framework works seamlessly.  I quite like the solution, 
and I'm actually glad there was no "standard" gui interface that 
bound me.  But, gtk and sdl bindings seemed to work easy enough 
for simple things, and dlanggui is looking promising.


As for future commercial efforts, I'll continue with D.  I feel 
safe that straight C is relatively easy to integrate.  Having 
access to proven libs like sqlite, redis, libgit2, nanomsg makes 
little incentive to ever feel like replacing them.  Even many of 
the interesting Python libs are just linked to a standard C lib 
underneath.


Anyway, I'm just more productive at producing robust, fast code 
in D.

Best of luck in your efforts.


Re: Unclear about the benefits of D over C++ and Java

2016-01-02 Thread Dibyendu Majumdar via Digitalmars-d
On Saturday, 2 January 2016 at 11:31:24 UTC, Dibyendu Majumdar 
wrote:
I am a long time observer of D but have never done any coding 
in D. I have considered using D several times but have ended up 
either going with C++ or Java.


I feel that for someone like me it is not clear what 
significant advantages D has over C++ or Java to make a switch. 
I cannot afford to experiment with a language unless I know for 
certain the benefits of using it.


My post here was triggered after watching a video by Andrei 
where he talked about how D generics are different from C++ 
templates - I think stuff like that needs to be explained in 
the front page of D website.




To clarify - the reason for my post here is to raise that the 
benefits of D over C++ or Java should be explained right up-front 
on D website in real world terms (i.e. with examples and 
benchmarks) to help people like me.


Regards
Dibyendu



Re: Unclear about the benefits of D over C++ and Java

2016-01-02 Thread Ola Fosheim Grøstad via Digitalmars-d
On Saturday, 2 January 2016 at 11:31:24 UTC, Dibyendu Majumdar 
wrote:
I feel that for someone like me it is not clear what 
significant advantages D has over C++ or Java to make a switch. 
I cannot afford to experiment with a language unless I know for 
certain the benefits of using it.


If you are truly proficient in C++ then you probably are better 
off with C++ at this point than using languages like D, Rust or 
Swift, at least for long term commercial projects.


* Do D compilers generate more efficient code compared to C++ 
compilers?


No. The best D compilers use backends written for C/C++ 
(llvm/gcc).


* Can D generics do everything C++ templates can (are they 
Turing complete for instance) - and what additional 
capabilities does D have that would make a significant 
difference to the way templates are used in C++?


Certain things are more tedious in C++, like adding methods based 
on template parameters. Compile time reflection is also more 
tedious in C++.


Yet again, certain other things look syntactically better in C++ 
and other things look better syntactically in D.


* How does D's performance compare with Java when it comes to 
concurrent applications or garbage collection?


Java has much better garbage collectors. Concurrency frameworks 
have been more thoroughly tested in Java and C++.


* How stable is D? Can one use it without fear that the next 
version will significantly change the language and therefore 
one would have to rewrite?


Java and C++ are more mature and have been more stable.



Unclear about the benefits of D over C++ and Java

2016-01-02 Thread Dibyendu Majumdar via Digitalmars-d

Hi,

I am a long time observer of D but have never done any coding in 
D. I have considered using D several times but have ended up 
either going with C++ or Java.


I feel that for someone like me it is not clear what significant 
advantages D has over C++ or Java to make a switch. I cannot 
afford to experiment with a language unless I know for certain 
the benefits of using it.


For instance I would like to know:

* Do D compilers generate more efficient code compared to C++ 
compilers? Are there performance benchmarks comparing D 
implementation against C and C++?


* Can D generics do everything C++ templates can (are they Turing 
complete for instance) - and what additional capabilities does D 
have that would make a significant difference to the way 
templates are used in C++?


* How does D's performance compare with Java when it comes to 
concurrent applications or garbage collection?


* How stable is D? Can one use it without fear that the next 
version will significantly change the language and therefore one 
would have to rewrite?


I feel that the D website could do more to explain why someone 
should move from C++ or Java to D - and this has to be explained 
in terms of real world benefits in terms of:


* Performance
* Quality of implementation

For someone like me - cool language features don't count that 
much unless they lead to real world benefits.


My post here was triggered after watching a video by Andrei where 
he talked about how D generics are different from C++ templates - 
I think stuff like that needs to be explained in the front page 
of D website.


Regards
Dibyendu

http://ravilang.org
http://simpledbm.org



Re: Unclear about the benefits of D over C++ and Java

2016-01-02 Thread Rikki Cattermole via Digitalmars-d

On 03/01/16 12:31 AM, Dibyendu Majumdar wrote:

Hi,

I am a long time observer of D but have never done any coding in D. I
have considered using D several times but have ended up either going
with C++ or Java.

I feel that for someone like me it is not clear what significant
advantages D has over C++ or Java to make a switch. I cannot afford to
experiment with a language unless I know for certain the benefits of
using it.

For instance I would like to know:

* Do D compilers generate more efficient code compared to C++ compilers?
Are there performance benchmarks comparing D implementation against C
and C++?

* Can D generics do everything C++ templates can (are they Turing
complete for instance) - and what additional capabilities does D have
that would make a significant difference to the way templates are used
in C++?

* How does D's performance compare with Java when it comes to concurrent
applications or garbage collection?

* How stable is D? Can one use it without fear that the next version
will significantly change the language and therefore one would have to
rewrite?

I feel that the D website could do more to explain why someone should
move from C++ or Java to D - and this has to be explained in terms of
real world benefits in terms of:

* Performance
* Quality of implementation

For someone like me - cool language features don't count that much
unless they lead to real world benefits.

My post here was triggered after watching a video by Andrei where he
talked about how D generics are different from C++ templates - I think
stuff like that needs to be explained in the front page of D website.

Regards
Dibyendu

http://ravilang.org
http://simpledbm.org


Okay so lets start with code efficiency.
We can beat in some cases and match C++ code generation using gdc or 
ldc. Which use GCC and LLVM backends.


About D templates. Anything can be executed at compile time can be used 
in templates. You just can't interact with non D code or globals.

Same with e.g. static assert.
Because of this D's meta-programming capabilities beat almost all other 
languages (Lisp in general is the only set of language that we don't).


Okay, now about general performance and the GC.
If you want performant apps you can't use the GC. It's as simple as that.
The Java and .net crowd like to say otherwise but you just can't. No GC 
will work as well for memory management quite as like a developer can.


In terms of language changes, you shouldn't need to worry about it too 
much. Most of the time these days you can go between versions without 
any changes if you're not pushing the language too much.

It's not like what it was a few years ago.


Re: Unclear about the benefits of D over C++ and Java

2016-01-02 Thread Ola Fosheim Grøstad via Digitalmars-d
On Saturday, 2 January 2016 at 12:01:20 UTC, Dibyendu Majumdar 
wrote:
To clarify - the reason for my post here is to raise that the 
benefits of D over C++ or Java should be explained right 
up-front on D website in real world terms (i.e. with examples 
and benchmarks) to help people like me.


Ok, that is not something I can help you with, but would you 
trust information provided by the language creators on 
performance and language feature trade offs?


That said: I really don't think you should consider languages 
like D and Rust as replacements for Java. If you use Java, you 
usually have dependencies on frameworks/infrastructure and also a 
strong preference for garbage collection. Go is closer to being a 
replacement for small Java projects. D's garbage collector is 
comparable to the C++ Boehm collector (I think Inkscape uses 
that).


D is semantically a close cousin of C++, but the standard 
libraries are different, although inspired by C++ libraries and 
has adopted C++ terminology. And the template programming 
semantics are slightly different. Advanced C++ meta programming 
is more painful than in other languages because it came about as 
an accident, and even simple things can be demanding and verbose 
to implement.


D's approach to template programming is pretty straight forward, 
nothing spectacular and with some syntactical annoyances, but 
without the really weird C++ SFINAE and inheritance constructs 
that C++ programmers have to deal with.


D has also implemented some of the features that has been 
proposed for C++, but not adopted in C++ yet.


Some areas where C++ is better:
- number of available template libraries
- does not have modular arithmetics for signed integers
- somewhat more powerful lambdas
- more flexible operator overloading
- Objective-C++ integration
- better platform support (e.g. asm.js)
- C++17 brings stackless concurrency

Overall, C++ is more verbose than D and that means that  C++ 
isn't a good language for testing out ideas. D is more suitable 
for that.




Re: Unclear about the benefits of D over C++ and Java

2016-01-02 Thread Guillaume Piolat via Digitalmars-d
On Saturday, 2 January 2016 at 11:31:24 UTC, Dibyendu Majumdar 
wrote:

Hi,

I am a long time observer of D but have never done any coding 
in D. I have considered using D several times but have ended up 
either going with C++ or Java.


I feel that for someone like me it is not clear what 
significant advantages D has over C++ or Java to make a switch. 
I cannot afford to experiment with a language unless I know for 
certain the benefits of using it.


For instance I would like to know:

* Do D compilers generate more efficient code compared to C++ 
compilers? Are there performance benchmarks comparing D 
implementation against C and C++?


Same efficiency if using LDC or GDC, divided by 2 if you use DMD.
But I've found coding in D is more productive (I'd say 2x on 
small projects vs C++, correct me if you disagree) and you'll be 
more pleased with the results so you'll have more time and energy 
to optimize.
C++ has some overhead to create a program so it may lead you to 
tool less.


* Can D generics do everything C++ templates can (are they 
Turing complete for instance) - and what additional 
capabilities does D have that would make a significant 
difference to the way templates are used in C++?


The difference is mainly in community, most are very confident 
with meta-programming, it's not up to single individual in a team 
to explain static polymorphism to everyone.


To put bluntly, I've never seen a C++ programmer in a team use 
std::enable_if in years of C++, but every D programmer has 
written heaps of "static if".
D lets you use static or runtime polymorphism as easily, in C++ 
it's quite a learning and often people think they don't need it.


That said, it's not all community, there is tangible 
improvements. Syntax for templates, alias this over multiple 
inheritance, string mixin over preprocessor macros, static 
foreach, sane operator overloading and so on.


* How does D's performance compare with Java when it comes to 
concurrent applications or garbage collection?


Java have more concurrency primitives and faster garbage 
collection.

OTOH D runtime is smaller.

* How stable is D? Can one use it without fear that the next 
version will significantly change the language and therefore 
one would have to rewrite?


This won't be a problem. Breaking language changes are rare, and 
are easy to fix.


I feel that the D website could do more to explain why someone 
should move from C++ or Java to D - and this has to be 
explained in terms of real world benefits in terms of:


* Performance
* Quality of implementation



Can't speak with anyone else, but for me the real reasons are:
- it's fun
- D says "yes" to everything and is not a Big Idea language
- I'm happier with the results, to the point I want to maintain 
them
- C++ puts you in learning-mode forever. D also does, but without 
you taking notice :)
- I'm hooked and going back to C++ feels horrible, like for many 
people here. We need a D rehab center!


At the language level D improves things in all directions: 
http://p0nce.github.io/d-idioms/#How-does-D-improve-on-C++17?


For someone like me - cool language features don't count that 
much unless they lead to real world benefits.


Me too, I care more about shared library support and codegen for 
example than any language feature.


Yet in some cases they do matter. For example default 
initialization brings invisible productivity gains you only see 
when going back to C++.








Re: Unclear about the benefits of D over C++ and Java

2016-01-02 Thread JerryR via Digitalmars-d
On Saturday, 2 January 2016 at 11:31:24 UTC, Dibyendu Majumdar 
wrote:

...
* How stable is D? Can one use it without fear that the next 
version will significantly change the language and therefore 
one would have to rewrite?

...


I recently discover a problem with breakage when trying to 
compile using a newer version of DMD: 
http://forum.dlang.org/thread/affaugpppegxuxyoi...@forum.dlang.org


Well I don't know how thing are now in fact, but the above wasn't 
the first time. And to be honest I already get it that using 
languages like D, Rust and Go which "still" are growing is a risk 
when talking about non-breakage.


J.


Re: Unclear about the benefits of D over C++ and Java

2016-01-02 Thread tsbockman via Digitalmars-d

On Saturday, 2 January 2016 at 19:53:04 UTC, JerryR wrote:
On Saturday, 2 January 2016 at 11:31:24 UTC, Dibyendu Majumdar 
wrote:

...
* How stable is D? Can one use it without fear that the next 
version will significantly change the language and therefore 
one would have to rewrite?

...


I recently discover a problem with breakage when trying to 
compile using a newer version of DMD: 
http://forum.dlang.org/thread/affaugpppegxuxyoi...@forum.dlang.org


Well I don't know how thing are now in fact, but the above 
wasn't the first time. And to be honest I already get it that 
using languages like D, Rust and Go which "still" are growing 
is a risk when talking about non-breakage.


J.


To clarify: many projects will fail to compile when a new version 
comes out.


However, you will NOT have to "rewrite" the project. Rather, a 
few lines across the entire project might have to be updated.


Re: Unclear about the benefits of D over C++ and Java

2016-01-02 Thread rsw0x via Digitalmars-d

On Sunday, 3 January 2016 at 04:25:55 UTC, israel wrote:
On Saturday, 2 January 2016 at 11:31:24 UTC, Dibyendu Majumdar 
wrote:

Hi,

I am a long time observer of D but have never done any coding 
in D. I have considered using D several times but have ended 
up either going with C++ or Java.


I feel that for someone like me it is not clear what 
significant advantages D has over C++ or Java to make a 
switch. I cannot afford to experiment with a language unless I 
know for certain the benefits of using it.


You know, from the last 2 years that i have followed D, i have 
come to the conclusion that: If you enjoy programming, use D. 
If its just your job or because its the standard, stay with 
C/C++.


because not once have i heard someone say programming in C++ is 
enjoyable.
But maybe its just me, maybe im too young to know the olden 
days of the 80s/90s where C++ was a godsend compared to C. Or 
was it? I dont know, i wasnt alive...


Ironically, I think C++ has only gotten worse with age and I'm 
speaking compared to back when there were debates over functions 
were worth using. In terms of modern C++... I saw nothing of the 
'beauty' of C++11 that everyone else somehow saw, all I saw was 
more cruft to sift through and more "rules" to learn because the 
language is fundamentally broken.
At some point the C++ committee needs to accept that C++ is 
approaching unusable levels of complexity, but I guess everyone 
needs job security.


Re: Unclear about the benefits of D over C++ and Java

2016-01-02 Thread israel via Digitalmars-d
On Saturday, 2 January 2016 at 11:31:24 UTC, Dibyendu Majumdar 
wrote:

Hi,

I am a long time observer of D but have never done any coding 
in D. I have considered using D several times but have ended up 
either going with C++ or Java.


I feel that for someone like me it is not clear what 
significant advantages D has over C++ or Java to make a switch. 
I cannot afford to experiment with a language unless I know for 
certain the benefits of using it.


You know, from the last 2 years that i have followed D, i have 
come to the conclusion that: If you enjoy programming, use D. If 
its just your job or because its the standard, stay with C/C++.


because not once have i heard someone say programming in C++ is 
enjoyable.
But maybe its just me, maybe im too young to know the olden days 
of the 80s/90s where C++ was a godsend compared to C. Or was it? 
I dont know, i wasnt alive...