May 29, 2014 Re: Adam D. Ruppe's "D Cookbook" now available! | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Thursday, 29 May 2014 at 14:42:02 UTC, Steven Schveighoffer wrote:
> The GC never has called struct destructors for arrays of structs or individual structs allocated on the heap.
Hmm, that's some weird behavior.
|
May 29, 2014 Re: Adam D. Ruppe's "D Cookbook" now available! | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On 5/29/2014 8:45 AM, Adam D. Ruppe wrote:
>
> One of the sections there talks about emulating random access on a
> structure that doesn't really support it (a linked list) and focuses on
> the hidden performance. That's the range-writer side of the same
> range-consumer rule: don't try to get fancy and support something the
> underlying data doesn't natively do because then you'll introduce bugs
> and slowdowns that might be hard to find.
FWIW, and in the spirit of "maybe others could benefit too" (not sure whether your book touches on this or not):
I *used to be* strongly opposed to what you suggest there, deliberately not emulating accesses the data doesn't support. Even had a big long debate over it with Andrei. My reasoning was that you should be able to swap different data structures in and out to find the best performance, because *even if* you're relying on an operation the underlying data doesn't support, it could still be such a *small* and infrequent reliance that the localized performance hit is overshadowed by improved performance in the rest of your code.
Seemed a perfectly sound argument to be, but then I realized: It's trivial to write an adapter to emulate features on ranges or containers that don't support them. Not only is this more re-usable (ex: only need to write a particular method of "emulate random access" once), but far more importantly, this makes the feature-emulation EXPLICIT instead of hidden.
The upshot of that is, if a range or container doesn't support some feature, you can *still* trivially have an emulated drop-in-replacement, and it's equally easy (or even easier still) but BETTER because it's explicit, not hidden.
|
May 29, 2014 Re: Adam D. Ruppe's "D Cookbook" now available! | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | Packt made an excerpt from the range chapter available too: https://www.packtpub.com/article/ranges That's from the tail end of the chapter where I started talking about emulation performance (relevant to this little convo) and how to put some stuff together. |
May 30, 2014 Re: Adam D. Ruppe's "D Cookbook" now available! | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Thu, May 29, 2014 at 2:31 PM, Jacob Carlborg wrote:
> Amazon has a version for their Kindle [1]. I have not seen any mentioning of other formats.
>
> [1] http://www.amazon.com/D-Cookbook-Adam-D-Ruppe-ebook/dp/B00KLAJ62M/ref=sr_1_1_title_1_kin?s=books&ie=UTF8&qid=1401366690&sr=1-1
But the paper edition does not come with the electronic version, contrary to a buy through Packt. Anyway, I'm already throwing far too much money at Amazon all year long :-)
Now for some time to read this book...
|
May 30, 2014 Re: Adam D. Ruppe's "D Cookbook" now available! | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | "Walter Bright" <newshound2@digitalmars.com> wrote in message news:lm5924$7r8$1@digitalmars.com... > http://www.packtpub.com/discover-advantages-of-programming-in-d-cookbook/book > > http://www.amazon.com/D-Cookbook-Adam-D-Ruppe/dp/1783287217 > > http://www.reddit.com/r/programming/comments/26pn00/d_cookbook_officially_published_consists_of_d/ > > After watching Adam's most excellent presentation at Dconf, I'm sure the book will be great! My copy gets here on Friday. Just got a copy - now I need the time to read it... :-) -=mike=- |
May 30, 2014 Re: Adam D. Ruppe's "D Cookbook" now available! | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike James | On Friday, 30 May 2014 at 09:07:54 UTC, Mike James wrote:
> "Walter Bright" <newshound2@digitalmars.com> wrote in message news:lm5924$7r8$1@digitalmars.com...
>> http://www.packtpub.com/discover-advantages-of-programming-in-d-cookbook/book
>>
>> http://www.amazon.com/D-Cookbook-Adam-D-Ruppe/dp/1783287217
>>
>> http://www.reddit.com/r/programming/comments/26pn00/d_cookbook_officially_published_consists_of_d/
>>
>> After watching Adam's most excellent presentation at Dconf, I'm sure the book will be great! My copy gets here on Friday.
>
> Just got a copy - now I need the time to read it... :-)
>
> -=mike=-
If you already know D, you don't need to read it cover-to-cover. Just read the sexy bits :)
(Although I will read it thoroughly one day when I find the time. The good thing is, you don't need to read it c-t-c to make it work for you, like, errr, a cookbook.)
|
May 30, 2014 Re: Adam D. Ruppe's "D Cookbook" now available! | ||||
---|---|---|---|---|
| ||||
Posted in reply to Chris | I received my copy this morning, earlier than I thought I would. I shall check it out over the weekend. I suspect I'll probably know a lot of the things in the book, but I'm the type who likes to watch introductory lectures because there's always something I didn't see before. |
May 30, 2014 Re: Adam D. Ruppe's "D Cookbook" now available! | ||||
---|---|---|---|---|
| ||||
Posted in reply to w0rp | On Friday, 30 May 2014 at 11:46:35 UTC, w0rp wrote:
> I received my copy this morning, earlier than I thought I would. I shall check it out over the weekend. I suspect I'll probably know a lot of the things in the book, but I'm the type who likes to watch introductory lectures because there's always something I didn't see before.
You're right, of course. There's _always_ something you can learn, even if you think you know it all.
|
May 30, 2014 Re: Adam D. Ruppe's "D Cookbook" now available! | ||||
---|---|---|---|---|
| ||||
Posted in reply to Chris | On Friday, 30 May 2014 at 11:25:45 UTC, Chris wrote:
> If you already know D, you don't need to read it cover-to-cover. Just read the sexy bits :)
Yea, I also tried to keep the dependencies on previous content to a minimum or at the least, explicit to make jumping around that much easier.
That said though, after the first few pages, I tried to say things that are at least interesting to the target intermediate+ audience; like page one talks about installing dmd, boring, but by page 4 I tried to answer a FAQ about modules and also worked my agenda to clear up the directory structure common misconception "Modules have logical names that do not need to match the filename." which is something you can get work done without knowing; it might be new even to someone who has used D before and understanding this can make sense of a number of compile/link errors that come up.
So, while I feel chapters one and two are the weakest links (and I definitely dropped the ball on editing the code on chapter one), hopefully none of the stuff is outright useless even if you've seen it before and have read the website documentation.
|
May 30, 2014 Re: Adam D. Ruppe's "D Cookbook" now available! | ||||
---|---|---|---|---|
| ||||
Posted in reply to w0rp | On Friday, 30 May 2014 at 11:46:35 UTC, w0rp wrote: > I received my copy this morning, earlier than I thought I would. I still haven't gotten my copies! Hopefully will be here today though. > I suspect I'll probably know a lot of the things in the book Yea, especially if you're a regular on the ng or irc, though you never know :P BTW if any of you who has read it want to write amazon reviews, make it so! |
Copyright © 1999-2021 by the D Language Foundation