Bottom Type--Type Theory

Walter Bright newshound2 at digitalmars.com
Thu Jan 17 09:10:15 UTC 2019


On 1/16/2019 5:21 PM, H. S. Teoh wrote:
> You cannot write Derived.method as void, because then it wouldn't
> override Base.method.

Right. The language allowing one to write silly things is one thing, but 
requiring it in certain cases has a certain stench about it. I'm reminded of this:

   https://brevzin.github.io/c++/2019/01/15/if-constexpr-isnt-broken/

where the author notes that C++ requires silly things like "requires requires" 
and ".template".

As far as allowing the programmer to write stupid things, and relying on telling 
him to not do stupid things, endless experience shows that doesn't work very 
well. It's better that the language head off stupid things by design. For example,

     a < b < c

is a valid C expression, but stupid, because it doesn't do what you might think 
it does. D does not allow such expressions, so we don't have to add to the style 
guide "don't do that".

Of course, no language can stop every nut behind the wheel, but we're obliged to 
do what we can.


More information about the Digitalmars-d mailing list