classes structs

Steven Schveighoffer schveiguy at yahoo.com
Tue Sep 18 05:03:14 PDT 2012


On Tue, 18 Sep 2012 01:07:43 -0400, David Currie <curriedr at iinet.net.au>  
wrote:

> On Saturday, 15 September 2012 at 10:58:07 UTC, Jonathan M Davis wrote:
>
> I haven't announced to regular viewers that I STARTED these issues by  
> writing direct to Walter (twice) that I had some language extension  
> IDEAS I thought would be VALUABLE to ALL. Such Ideas would make a  
> welcome addition to ANY language but for me D comes closest.
> (A C like language with NO header files alone is worth 50%).
> Naturally all he could really do was to send me along to the forums.
>
> However, I can see that if I am to receive the usual polite refusal,
> and I really wish to make a POINT I'd better be armed.
>
> I would need to be able to speak your language (learn D)
> before I should expect you to speak mine (implement My Ideas).
> I can see here that my best bet is to learn D.
>
> Can one learn it all online?  What is the best D book?

"The D Programming Language" is the official book for D, written by one of  
the main contributors, Andrei Alexandrescu.

http://www.amazon.com/The-Programming-Language-Andrei-Alexandrescu/dp/0321635361/ref=sr_1_1?ie=UTF8&qid=1347967853&sr=8-1&keywords=the+d+programming+language

Note, this only covers the core language, and a bit of the library.  The  
standard library is very much in flux, and so writing a book at this point  
would be a bit premature.  If you want to learn the language as quickly as  
possible, this is probably the best way, the book is very good.  I should  
note that many of the concepts in the book are not yet implemented, but  
the book is considered to be more official than the reference  
implementation.  In other words, TDPL is what the language *should* be on  
official release.  So you may run into several features that are described  
in the book, but don't work.

You can, of course, learn very very much by reading the documentation,  
online at dlang.org.  The documentation is more of a specification, but it  
should be quite possible to learn it that way (I did).  The dlang.org  
documentation more closely follows the reference compiler, and is in fact,  
released along with the compiler.

I will warn you, that there will very likely be no point at which you will  
be able to convince Walter to abandon his core beliefs and fundamentally  
modify D.  There are certainly areas which are not yet set in stone, and  
in the library is probably the best place you will be able to influence  
the language.  But I would advise you right now, do not expect to *ever*  
see D change it's policy towards class allocation on the stack.

As you alluded to, we already have a way to allocate classes on the stack,  
and that way is being deprecated, due to the dangers it poses.  That  
should give you a clue that the language designers are not really keen on  
introducing something similar, even if you feel it is better (I have  
first-hand experience with this, try convincing Walter that we need  
tail-const...).  It's like trying to sell an iPhone to someone who had one  
and hated it.  "Yeah, but this iPhone is even better than the last one!"  
doesn't really cut it (I'm looking at you, Nick :)

I don't want to sound harsh, or build a strawman for your ideas (of which  
you likely have many that haven't been expressed here), but if they are of  
the same grain, you will likely be disappointed.

However, I am fairly confident that you will enjoy D, even if it doesn't  
do things exactly the way you want.  And D might even be able to do things  
the way you want, there are some incredibly smart people here who can use  
D's immense code generation power to build types that do exactly what you  
want without adding language features.

There are so many things I wish D did differently, but it is still far and  
above better than any other language I use.  And I also hope that you can  
contribute ideas that *are* able to be included in the language.  I think  
everyone here is interested in improving D!

Hope this helps.

-Steve


More information about the Digitalmars-d mailing list