Three Unlikely Successful Features of D

Don nospam at nospam.com
Tue Mar 20 13:57:25 PDT 2012


On 20.03.2012 21:33, Don wrote:
> On 20.03.2012 20:02, Andrei Alexandrescu wrote:
>> I plan to give a talk at Lang.NEXT
>> (http://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2012) with the
>> subject above. There are a few features of D that turned out to be
>> successful, in spite of them being seemingly unimportant or diverging
>> from related consecrated approaches.
>>
>> What are your faves? I have a few in mind, but wouldn't want to
>> influence answers.
>>
>>
>> Thanks,
>>
>> Andrei
>
> There's one huge one.
>
> Strings as built-in types, including concatenation and slicing. This
> meant that they could be constant-folded. Together with 'static if',
> this was the basis of metaprogramming in D. Pretty much all the rest was
> a natural consequence of that foundation.
> It was *completely* unexpected. When, as a D newbie, I posted some of my
> initial exploration of the language, Walter wrote "I had no idea this
> was even possible."
>
> Probably not what you have in mind, though -- it *was* expected to be a
> success, just not to anything like this extent.
>
> * pragma(msg) is something that's been used 100X as often as anticipated.

Note that because it was so successful, it was incorporated into static 
assert.

>
> * Builtin properties of types, eg int.max. Doesn't sound like much of an
> improvement over a header file of constants, but it's had a huge impact.
> It really encourages you to write correct code, (I especially notice it
> for floating point, but I bet if you grep for "int.max" in D code,
> you'll get far more hits than for "MAXINT" in C code).

And is(typeof()), even though the syntax is really horrible. Brilliant 
concept.


More information about the Digitalmars-d mailing list