Which language futures make D overcompicated?

Seb seb at wilzba.ch
Fri Feb 9 16:44:32 UTC 2018


On Friday, 9 February 2018 at 16:05:52 UTC, Ralph Doncaster wrote:
> On Friday, 9 February 2018 at 15:46:56 UTC, Mike Parker wrote:
>> On Friday, 9 February 2018 at 15:37:12 UTC, Ralph Doncaster 
>> wrote:
>>
>>
>>> I think you are proving my point.  You say there is no 
>>> difference between:
>>> const MAX_IN = 20;
>>> vs
>>> immutable MAX_IN = 20;
>>>
>>> So now I have to try both, and look at the generated code to 
>>> be sure.
>>
>> Or read the docs:
>>
>> https://dlang.org/spec/const3.html
>>
>>> p.s. I prefer const since it is easier for C/C++ coders to 
>>> understand.  Using immutable invites the coder to go down the 
>>> whole rat hole of trying to understand how is it different 
>>> than const.
>>
>> It's not a rathole. The document page above explains the 
>> differences rather well. They only happen to be identical when 
>> initialized with compile-time constants.
>
> Well this part of the docs is a rathole to me:
> https://dlang.org/spec/const3.html#implicit_qualifier_conversions
>
> It might be clear and simple to you, but it's not to me.  And 
> I'm a rather advanced developer.
> While there are lots of things I like about D compared to C++ 
> such as getting rid of #include hell, there's too many "messy" 
> things and the learning curve is too steep for me to consider 
> suggesting it for any consulting projects.  I think it could've 
> been better if there was more focus on keeping the language 
> (and standard library) clean and simple instead of making it 
> more like a swiss army knife.

The graphic is way too complicated.
Forget inout, it's seldomly used and there have even attempts to 
remove it from the language.

Without inout:

- any type can be implicitly converted to const X
- shared can't be implicitly removed
- immutable can't be implicitly removed

There's also: https://dlang.org/articles/const-faq.html


More information about the Digitalmars-d mailing list