I wish I could use D for everything

Christopher Wright dhasenan at gmail.com
Fri May 1 04:14:28 PDT 2009


dsimcha wrote:
> == Quote from Brad Roberts (braddr at puremagic.com)'s article
>> dsimcha wrote:
>>>  D2 is a complex language, but it's not complex in a haphazard way.  It's complex
>>> because it statically proves stuff about your code (const, etc), and allows
>>> extremely powerful, generic user-defined types.  These are the kinds of things
>>> that most people only dream about.
>> I'd like to drill into this 'd2 is a complex language' assertion more.  Can we
>> build a factual list of the delta of complexity between d1 and d2?
>> The primary area is the type system:
>>   1) introduction of const
>>       -- optional and doesn't affect callers of api's that declare const params
>>   2) introduction of immutable
>>       -- less optional since it's not as coercable, but also less frequently
>> used in apis.
>>   3) introduction of pure
>>       -- optional, will not affect callers of apis
>>   4) introduction of nothrow
>>       -- optional, will not affect callers of apis
>> Others:
>> 5) template if clause
>> I'm specifically leaving out Phobos and other library layer issues, though feel
>> free to count the runtime as part of the language when adding to this list.
>> -- Brad
> 
> Template alias parameters, ref returns, shared (even though it's not implemented,
> it's on its way, so it still counts), closures, alias this, template literals,
> struct ctors and dtors (and in general structs becoming more like classes) to name
> a few.  I love all of these, and I personally think the complexity is justified.
> It's just that I don't know how easy it would be to convince someone coming from
> Java of this, so I'm playing devil's advocate a little.

Specifically for closures, they are less surprising than d1 delegate 
literals for people coming from most other languages (besides C++0x, maybe).

Most everything else works to eliminate surprises.



More information about the Digitalmars-d mailing list