Does D have too many features?
Paulo Pinto
pjmlp at progtools.org
Sun Apr 29 05:41:36 PDT 2012
Am 29.04.2012 10:42, schrieb Timon Gehr:
> On 04/29/2012 08:31 AM, Paulo Pinto wrote:
>> Am 28.04.2012 20:47, schrieb Walter Bright:
>>> Andrei and I had a fun discussion last night about this question. The
>>> idea was which features in D are redundant and/or do not add significant
>>> value?
>>>
>>> A couple already agreed upon ones are typedef and the cfloat, cdouble
>>> and creal types.
>>>
>>> What's your list?
>>
>> - two different ways of creating function pointers is confusing
>> (function and delegate)
>>
>> I understand the reasoning, but makes one think all the time when
>> to use what.
>>
>
> 'delegate' is more powerful, 'function' is more efficient. If you don't
> want to think about it, just use 'delegate'. I'd rather see 'function'
> implicitly convert to 'delegate' than to have it gone. D can be used for
> systems programming after all!
That is what I mean. The compiler could make the distinction between
function and delegate itself.
I am not arguing to remove the feature, rather to have the compiler
check it for me. Surely it can see if I am passing the delegate to D
code or extern C/C++ code and act accordingly.
>
>> - sometimes D code looks like template and mixins gone mad
>> While I do appreciate the power, it can be quite confusing to try
>> to understand what the code does. Specially with the lack of support
>> in mixin's debugging
>>
>
> pragma(msg, ...) ?
Too low level?
>
>>
>> - misuse of enum to declare constants
>> I prefer that the use of const would be possible
>>
>
> const infects the type and const-qualified data can exist at runtime, so
> it is not possible.
Yeah, but it brings me back bad memories from the early days, when C++
compilers did not fully support C++98, and we had to resort to the enum
trick to create constants.
>
>> - conditional compilation is hard to follow without syntax highlighting
>> Other languages with conditional compilation make it easier to follow
>> what is what. e.g. Turbo Pascal/Delphi, C#, Modula-3, Ada
>>
>
> That is not a language issue.
How come?
In the languages mentioned above, the conditional compilation stands out
in clear text that is doing something at compile time.
In D you need to be aware which statements are compile time and which
are not.
Not a big deal to argue about, but easy trap for D newbies.
--
Paulo
More information about the Digitalmars-d
mailing list