www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - moving from c++ to D is easy?

reply "ayush" <thedeveloper.ayush gmail.com> writes:
Is D a lot like c++ ? I am currently midway through learning c++ 
and I also want to learn D . So should i focus on one or learn 
both together? Will I find learning D easy if I already know c++ ?
Mar 12 2015
next sibling parent reply "Dennis Ritchie" <dennis.ritchie mail.ru> writes:
On Thursday, 12 March 2015 at 13:01:31 UTC, ayush wrote:
 Is D a lot like c++?
Enough.
 So should i focus on one or learn both together?
You can study both together, although it is better to focus on one.
 Will I find learning D easy if I already know c++?
Yes.
Mar 12 2015
parent reply "ayush" <thedeveloper.ayush gmail.com> writes:
On Thursday, 12 March 2015 at 13:13:40 UTC, Dennis Ritchie wrote:
 On Thursday, 12 March 2015 at 13:01:31 UTC, ayush wrote:
 Is D a lot like c++?
Enough.
 So should i focus on one or learn both together?
You can study both together, although it is better to focus on one.
 Will I find learning D easy if I already know c++?
Yes.
So on which language should I focus(learn) first
Mar 12 2015
parent reply Daniel =?UTF-8?B?S296w6Fr?= via Digitalmars-d-learn writes:
On Thu, 12 Mar 2015 13:35:18 +0000
ayush via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> wrote:

 On Thursday, 12 March 2015 at 13:13:40 UTC, Dennis Ritchie wrote:
 On Thursday, 12 March 2015 at 13:01:31 UTC, ayush wrote:
 Is D a lot like c++?
Enough.
 So should i focus on one or learn both together?
You can study both together, although it is better to focus on one.
 Will I find learning D easy if I already know c++?
Yes.
So on which language should I focus(learn) first
D is much easier to learn so I will start with it. And then you can try learn C++ if you still want and need it.
Mar 12 2015
parent reply "Dennis Ritchie" <dennis.ritchie mail.ru> writes:
On Thursday, 12 March 2015 at 13:44:50 UTC, Daniel Kozák wrote:
 D is much easier to learn so I will start with it. And then you 
 can
 try learn C++ if you still want and need it.
Yes, but in D for beginners little literature, so I would recommend starting with C++.
Mar 12 2015
next sibling parent "Jacques =?UTF-8?B?TcO8bGxlciI=?= <jacques.mueller gmx.de> writes:
On Thursday, 12 March 2015 at 13:56:29 UTC, Dennis Ritchie wrote:
 On Thursday, 12 March 2015 at 13:44:50 UTC, Daniel Kozák wrote:
 D is much easier to learn so I will start with it. And then 
 you can
 try learn C++ if you still want and need it.
Yes, but in D for beginners little literature, so I would recommend starting with C++.
There is no need for dozens of books. I would even go as far as to say that the existing ones are more than enough. http://wiki.dlang.org/Books
Mar 12 2015
prev sibling parent reply ketmar <ketmar ketmar.no-ip.org> writes:
On Thu, 12 Mar 2015 13:56:28 +0000, Dennis Ritchie wrote:

 On Thursday, 12 March 2015 at 13:44:50 UTC, Daniel Koz=C3=A1k wrote:
 D is much easier to learn so I will start with it. And then you can try
 learn C++ if you still want and need it.
=20 Yes, but in D for beginners little literature, so I would recommend starting with C++.
there are alot of books on C++ 'cause C++ is insanely complicated and=20 inconsistend. D design is *MUCH* better, so D doesn't need so many books=20 teaching arcane art of programming.=
Mar 12 2015
parent "Dennis Ritchie" <dennis.ritchie mail.ru> writes:
On Thursday, 12 March 2015 at 14:47:22 UTC, ketmar wrote:
 there are alot of books on C++ 'cause C++ is insanely 
 complicated and
 inconsistend. D design is *MUCH* better, so D doesn't need so 
 many books
 teaching arcane art of programming.
Well, in principle, can be started with a D, but personally, I started actually with ANSI C.
Mar 12 2015
prev sibling next sibling parent "weaselcat" <weaselcat gmail.com> writes:
On Thursday, 12 March 2015 at 13:01:31 UTC, ayush wrote:
 Is D a lot like c++ ? I am currently midway through learning 
 c++ and I also want to learn D . So should i focus on one or 
 learn both together? Will I find learning D easy if I already 
 know c++ ?
D is very much like C++, but the biggest issue I found moving from C++ to D was trying to apply C++ idioms that only existed to work around ugly C++ warts(i.e, CRTP)
Mar 12 2015
prev sibling next sibling parent ketmar <ketmar ketmar.no-ip.org> writes:
On Thu, 12 Mar 2015 13:01:29 +0000, ayush wrote:

 Is D a lot like c++ ? I am currently midway through learning c++ and I
 also want to learn D . So should i focus on one or learn both together?
 Will I find learning D easy if I already know c++ ?
D is like C++, but made by human beings for human beings. and C++ is made=20 by martians for monkeys.=
Mar 12 2015
prev sibling parent reply =?UTF-8?B?QWxpIMOHZWhyZWxp?= <acehreli yahoo.com> writes:
On 03/12/2015 06:01 AM, ayush wrote:

 Is D a lot like c++ ?
I came to D from C++. I remember the following being notable differences: - In D, classes have reference semantics. I quickly realized that this is not an issue because so many of my C++ types were hand-reference-typified :p by this idiom, almost everywhere: class C { /* ... */ }; typedef boost::shared_ptr<C> CPtr; void foo(CPtr c); - Garbage collector took longer to get used to. There are some issues with the spec or implementation that some objects may never be destructed (or is it finalized?). Other than issues like that, everything in D feels like a fresh air.
 I am currently midway through learning c++
If you are a mortal like myself, you may find out years later that you are still at the midway point. Happened to me several times when I was learning C++. :)
 and I also want to learn D . So should i focus on one or learn
 both together?
Economically, C++ may make more sense. But if you are learning just for yourself, perhaps for fun, then I recommend D.
 Will I find learning D easy if I already know c++ ?
I think so. Ali
Mar 12 2015
next sibling parent "Dennis Ritchie" <dennis.ritchie mail.ru> writes:
On Thursday, 12 March 2015 at 18:57:51 UTC, Ali Çehreli wrote:
If you are a mortal like myself, you may find out years later 
that you are still at the midway point. Happened to me several 
times when I was learning C++. :)
О, yeah.
Mar 12 2015
prev sibling parent reply "Namespace" <rswhite4 gmail.com> writes:
On Thursday, 12 March 2015 at 18:57:51 UTC, Ali Çehreli wrote:
 On 03/12/2015 06:01 AM, ayush wrote:

 Is D a lot like c++ ?
I came to D from C++. I remember the following being notable differences: - In D, classes have reference semantics. I quickly realized that this is not an issue because so many of my C++ types were hand-reference-typified :p by this idiom, almost everywhere: class C { /* ... */ }; typedef boost::shared_ptr<C> CPtr; void foo(CPtr c);
This is a common mistake. In 99 percent of cases you want to use a std::unique_ptr. std::shared_ptr is rarely common and often an indication of an error in design. In general, there is exactly one owner only. But I think you know that already. :)
Mar 12 2015
parent reply =?UTF-8?B?QWxpIMOHZWhyZWxp?= <acehreli yahoo.com> writes:
On 03/12/2015 01:19 PM, Namespace wrote:

 On Thursday, 12 March 2015 at 18:57:51 UTC, Ali Çehreli wrote:
 On 03/12/2015 06:01 AM, ayush wrote:

 Is D a lot like c++ ?
I came to D from C++. I remember the following being notable
differences:
 - In D, classes have reference semantics. I quickly realized that this
 is not an issue because so many of my C++ types were
 hand-reference-typified :p by this idiom, almost everywhere:

 class C { /* ... */ };
 typedef boost::shared_ptr<C> CPtr;
 void foo(CPtr c);
This is a common mistake. In 99 percent of cases you want to use a std::unique_ptr.
Agreed. Here is an excerpt from a comment from one of our header files: "We could not use boost::unique_ptr because the version of the Boost library that we currently use does not include it."
 std::shared_ptr is rarely common and often an indication of an
 error in design. In general, there is exactly one owner only.
Of course. We had definitions like the following as well, where the C objects are stored in: typedef vector<CPtr> MyCs;
 But I think you know that already. :)
I think so. :) Maybe we should pass weak_ptrs around instead of shared_ptr. Anyway... That's old code and this is a D newsgroup. Ali
Mar 12 2015
parent "Namespace" <rswhite4 gmail.com> writes:
On Thursday, 12 March 2015 at 21:41:07 UTC, Ali Çehreli wrote:
 On 03/12/2015 01:19 PM, Namespace wrote:

 On Thursday, 12 March 2015 at 18:57:51 UTC, Ali Çehreli wrote:
 On 03/12/2015 06:01 AM, ayush wrote:

 Is D a lot like c++ ?
I came to D from C++. I remember the following being notable
differences:
 - In D, classes have reference semantics. I quickly realized
that this
 is not an issue because so many of my C++ types were
 hand-reference-typified :p by this idiom, almost everywhere:

 class C { /* ... */ };
 typedef boost::shared_ptr<C> CPtr;
 void foo(CPtr c);
This is a common mistake. In 99 percent of cases you want to
use a
 std::unique_ptr.
Agreed. Here is an excerpt from a comment from one of our header files: "We could not use boost::unique_ptr because the version of the Boost library that we currently use does not include it."
 std::shared_ptr is rarely common and often an indication of an
 error in design. In general, there is exactly one owner only.
Of course. We had definitions like the following as well, where the C objects are stored in: typedef vector<CPtr> MyCs;
 But I think you know that already. :)
I think so. :) Maybe we should pass weak_ptrs around instead of shared_ptr.
You could also pass raw pointers around. Since they have no owner it's fine. Or references.
 Anyway... That's old code and this is a D newsgroup.

 Ali
Agreed.
Mar 12 2015