Eloquently sums up my feelings about the disadvantages of dynamic typing

simendsjo simendsjo at gmail.com
Wed Oct 16 04:13:11 PDT 2013


On Wednesday, 16 October 2013 at 11:05:25 UTC, PauloPinto wrote:
> On Wednesday, 16 October 2013 at 10:52:47 UTC, simendsjo wrote:
>> On Wednesday, 16 October 2013 at 10:37:28 UTC, Timon Gehr 
>> wrote:
>>> On 10/16/2013 08:46 AM, simendsjo wrote:
>>>>
>>>> No.. Give me a language that catches obvious bugs at 
>>>> compile-time, makes
>>>> code self-documenting and doesn't let me worry about 
>>>> performance.
>>>> ...
>>>
>>> Why just obvious bugs?
>>
>> Hehe. Sure - let the compiler catch *all* my bugs!
>>
>> scope, const, immutable, pure, nothrow, safe, ... D makes it 
>> harder to shoot yourself in the foot, but you are aiming at 
>> your foot by default..
>>
>> Too bad I have to add a lot of annotations
>>  void f(Class i) {}
>> to
>>  void f(in Class i) const pure nothrow @safe {}
>>
>> I would rather have to write
>>  void f(@(mutable, escapes) Class i) @(impure mutable throws 
>> unsafe) {}
>>
>> If @mutable and @impure existed, I could just add some 
>> annotations at the top of each module, but it wouldn't help on 
>> parameters.
>
>
> The problem, which I know well from other languages with 
> annotations, is that eventually you reach annotation hell, 
> specially in the enterprise world.

I don't have any enterprise experience, but with UDAs, this can 
already happen.
What I think is bad is that I have to add a lot of built-in 
annotations to get help from the compiler catching bugs.
But there would be fewer annotations if you were able to negate 
some annotations.
If 95% of your functions are pure, why should you have to say 
pure for all those rather than impure for 5%?


More information about the Digitalmars-d mailing list