Hello, folks! Newbie to D, have some questions!

sarn via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Feb 18 13:27:55 PST 2017


On Saturday, 18 February 2017 at 20:15:55 UTC, timmyjose wrote:
> Hello folks,

Hi :)

> 2. I am more interested in learning D as a pure systems 
> programming language so that I can develop my own tools (not 
> looking to develop an OS, just some grep-scale tools to start 
> off with). In that regard, I have a few concerns about the GC. 
> My rudimentary knowledge of the D ecosystem tells me that there 
> is a GC in D, but that can be turned off. Is this correct? 
> Also, some threads online mention that if we do turn off GC, 
> some of the core std libraries may not fully work. Is this 
> presumption also correct?

Okay, yes, it's easy to turn off or control the GC.  It's also 
easy to control memory allocation in general (unlike, say, Java, 
where it's practically impossible to do anything without writing 
"new").

Also, yes, a lot of the standard library doesn't work if you do 
that.  A lot does work, but a lot doesn't.  The biggest blocker 
is the use of exceptions, which currently rely on GC (though 
there's interest in changing that).

But I think the real answer to your question is in this thread:
https://forum.dlang.org/thread/o6c9tj$2bdp$1@digitalmars.com
(Silicon Valley D Meetup - January 26, 2017 - "High Performance 
Tools in D" by Jon Degenhardt)

> In this regard, I am curious to know if I would face any issues 
> (with my intent in mind), or will I do just fine? If you could 
> share your experiences and domains of use, that would also be 
> very helpful for me. Secondly, how stable is the language and 
> how fast is the pace of development on D?

When I first started using D about four years ago, it was easy to 
hit compiler bugs and basic things that didn't work.  It don't 
find that happens much nowadays when I'm doing everyday 
programming.

There's plenty of new stuff happening, like escape analysis, but 
the foundation is getting pretty good.  I think the biggest gap 
is the number of libraries compared to, say, Python, but 
personally I'm happy binding to C libraries, and there are plenty 
of them.

> 2. I am also curious as to what would be the best path for a 
> complete beginner to D to learn it effectively? I am a 
> relatively fast learner (and I learn better by context, as in, 
> some core unifying idea described and then elucidated through 
> big examples instead of learning in bits and pieces). How did 
> you folks learn D? I'm sure hearing your experiences would be 
> helpful too. Are there any books/video tutorials that you would 
> recommend (aside from this site itself).

Some people have written tutorials.  It sounds like you're 
already experienced with programming, so the fastest way is 
probably to just dive in.  Get the basics from a small tutorial, 
then pick a small project (or some practice programming problems) 
and start coding with the standard library docs on hand :)

> 4. I have heard good reports of D's metaprogramming 
> capabilities (ironically enough, primarily from a thread on the 
> Rust user group), and coming from a Common Lisp (and some 
> Racket) background, I am deeply interested in this aspect. Are 
> D macros as powerful as Lisp macros? Are they semantically 
> similar (for instance, I found Rust's macros are quite similar 
> to Racket's)?

Lisp macros let you rewrite features at the interpreter level.  
Walter Bright has explicitly said he doesn't like that kind of 
macro (I don't think he even likes the C preprocessor's macros).

D's metaprogramming is more constrained in that sense, but it's 
powerful at code generation (see templates and the "mixin" 
keyword), compile-time code execution, and compile-time 
introspection.  Compile-time introspection is one of my favourite 
features.  If, for example, you need an array of all the names of 
single argument methods (or whatever) from a class, you can get 
it.

Take a look at ctRegex in the standard library for a great 
example of what can be done.

> 5. Supposing I devote the time and energy and get up to speed 
> on D, would the core language team be welcoming if I feel like 
> I can contribute?

I'm not the core team, but I'm confident the answer is yes :)


More information about the Digitalmars-d-learn mailing list