Rant after trying Rust a bit

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 23 11:01:00 PDT 2015


On Thursday, 23 July 2015 at 17:43:49 UTC, jmh530 wrote:
> I actually just had your D Cookbook delivered a few days ago. 
> Beyond a few cases of extra semi-colons

That gets better! I didn't realize how the editing process worked 
when I turned in chapter one so it is embarrassingly bad in 
places, absolutely horrible start, but I figured it out after 
that so the code will get a lot prettier.

> one of the things that really stood out were where you took 
> something I would find very complicated, describe the few key 
> steps to accomplish the complicated task, and then follow up 
> with a bunch of code that does those steps. I like that 
> teaching method.

I think a strong foundation - knowing the basics really well - is 
the key to being a good programmer. Most hard things can be 
broken down into a combination of a few basic things. Andrei's 
"design by introspection" hits this same principle: looking at 
pieces and just working with them, knowing what they can and 
can't do one part at a time, is easier than trying to name and 
master all the various combinations of them.

So that was what I wanted to do in my book: start with something 
bigger, but focus on the building blocks with the hope that 
you'll be able to reassemble them into something new for yourself 
in the end.



A concrete example, consider std.typecons.Typedef. I think that 
is totally useless because if you understand what it does, it is 
trivial to do your own with various customizations specific to 
you (like allowing or disallowing implicit conversions, disabling 
individual operators, etc).

Or to just do the basics is easy if you know how it is built (it 
is really just a plain struct!).


Whereas if you don't understand the building blocks, you're lost 
when you need to customize it somehow (and there's too many 
options to reasonably name each of them in Phobos)... and you are 
also likely to be surprised by bugs when they come up, like with 
the Typedef cookie parameter.

So knowing structs is IMO far more valuable knowledge than 
knowing Typedef.


But at the same time, having pre-made kits is helpful too, 
especially as starting points, so when i get to my tutorial 
series, I want to get more of that.


More information about the Digitalmars-d mailing list