www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - best practices tutorial needed (for function signature, class vs

reply "timotheecour" <thelastmammoth gmail.com> writes:
Is there a "best practices" page on this site to use as reference 
for those FAQ, that AFAIK are not in the docs:

* when to use class vs struct
(eg 
http://stackoverflow.com/questions/11058906/struct-vs-class-for-writing-d-wrappers-around-foreign-languages)

* what's the standard signature for opEquals ()
(ef 
http://forum.dlang.org/thread/ewhhutwupqxbepqyzhlr forum.dlang.org#post-mailman.1402.1345925314.31962.digitalmars-d:40puremagic.com)

* same for toString(), this(), etc.

* to use or not to use  property

etc..

I understand it's on a case by case but I would hope there are 
certain rules one can follow in 99% cases.
Aug 25 2012
next sibling parent reply notna <notna.remove.this ist-einmalig.de> writes:
You may want to try/read this:

http://ddili.org/ders/d.en/

Thanks to Ali for this fantastic book!!! Looking forward for the next 
translations.

On 25.08.2012 22:37, timotheecour wrote:
 Is there a "best practices" page on this site to use as reference for
 those FAQ, that AFAIK are not in the docs:

 * when to use class vs struct
 (eg
 http://stackoverflow.com/questions/11058906/struct-vs-class-for-writing-d-wrappers-around-foreign-languages)


 * what's the standard signature for opEquals ()
 (ef
 http://forum.dlang.org/thread/ewhhutwupqxbepqyzhlr forum.dlang.org#post-mailman.1402.1345925314.31962.digitalmars-d:40puremagic.com)


 * same for toString(), this(), etc.

 * to use or not to use  property

 etc..

 I understand it's on a case by case but I would hope there are certain
 rules one can follow in 99% cases.
Aug 29 2012
parent reply =?UTF-8?B?QWxpIMOHZWhyZWxp?= <acehreli yahoo.com> writes:
On 08/29/2012 01:53 PM, notna wrote:
 You may want to try/read this:

 http://ddili.org/ders/d.en/

 Thanks to Ali for this fantastic book!!! Looking forward for the next
 translations.
Thank you notna. :) Although, I don't have the exact answers that timotheecour is looking for. I have been slow in translation recently partly because of summer and partly because of improvements to existing chapters. Actually I have another chapter translated but it needs to mature a little before public consumption. :) Ali
Aug 29 2012
next sibling parent reply notna <notna.remove.this ist-einmalig.de> writes:
Ali, I've to thank YOU!

As a "part-time-programmer", I've to say, your book helped me a 
mountain.. and actually is a reason why I'm kind of "back2D" ;)
I've all the D books money can buy, so I claim the same statement could 
be true for other non-professional-programmers, too.

Anyhow, an Index within the PDF/book and a change log would be great. I 
try to follow the RSS feed, but for changes within existing capitals, 
its not easy for me to identify them... I always have to run a "PDF 
diff" tool and then read the newly added or changed lines.

Enjoy the rest of the summer, hope you will find more time for the next 
translations soon and looking forward for the long cold winter evenings 
and a good read ;)


On 29.08.2012 23:02, Ali Çehreli wrote:
 Thank you notna. :) Although, I don't have the exact answers that
 timotheecour is looking for.

 I have been slow in translation recently partly because of summer and
 partly because of improvements to existing chapters. Actually I have
 another chapter translated but it needs to mature a little before public
 consumption. :)

 Ali
Sep 01 2012
parent reply =?UTF-8?B?QWxpIMOHZWhyZWxp?= <acehreli yahoo.com> writes:
On 09/01/2012 08:18 AM, notna wrote:

 Anyhow, an Index within the PDF/book and a change log would be great.
Well, I have finally started a crude change log. The final entry bunches up seven chapters in the change log for r514: http://ddili.org/ders/d.en/pdf_indir.html It will be more granular in the future. :) Ali
Nov 02 2012
parent Jordi Sayol <g.sayol yahoo.es> writes:
Congratulations for these new seven chapters translated into English!

http://ddili.org/ders/d.en/index.html

Many thanks for the well done work!

-- 
Jordi Sayol
Nov 04 2012
prev sibling parent "deed" <nomail nomail.no> writes:
I would also like to thank you for your great tutorials, which I 
find very concise and at the point.

Looking forward to see more of them getting translated!
Sep 02 2012
prev sibling parent "Nathan M. Swan" <nathanmswan gmail.com> writes:
On Saturday, 25 August 2012 at 20:37:27 UTC, timotheecour wrote:
 Is there a "best practices" page on this site to use as 
 reference for those FAQ, that AFAIK are not in the docs:

 * when to use class vs struct
 (eg 
 http://stackoverflow.com/questions/11058906/struct-vs-class-for-writing-d-wrappers-around-foreign-languages)
General rule I follow (don't know if this is common): use `struct` unless you are using pointers a lot: that's a sign you need classes.
 * what's the standard signature for opEquals ()
 (ef 
 http://forum.dlang.org/thread/ewhhutwupqxbepqyzhlr forum.dlang.org#post-mailman.1402.1345925314.31962.digitalmars-d:40puremagic.com)

 * same for toString(), this(), etc.
IDK
 * to use or not to use  property
property is semantically a fake field. Thus, use it to get an attribute that doesn't have side effects (except for setters) and runs in constant time.
 etc..

 I understand it's on a case by case but I would hope there are 
 certain rules one can follow in 99% cases.
My 0.02 dollars, NMS
Aug 29 2012