A little Py Vs C++

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Nov 2 06:04:43 PDT 2012


On 11/1/12 6:51 PM, Walter Bright wrote:
> On 11/1/2012 2:20 PM, bearophile wrote:
>> Some complexity comes from the
>> desire to do more and more. As example see this recent request from Manu,
>
> What about all your feature requests? I think you've made more than
> anyone, by a factor of 10 at least!
>
> :-)
>
> As for Manu's request
>
> http://d.puremagic.com/issues/show_bug.cgi?id=8108
>
> I've gone over with him why he needs it, and there's no other reasonable
> way. He needs it for real code in a real application.

I'd argue this actually is part of a category of features that does not 
increase the complexity of the language (quite the contrary in fact). 
This is because stating that declaration+definition in the same file 
won't work takes actually more cognitive load than just allowing it.

By the consistency principle, one should infer unknown parts of a 
complex system from knowing the others. Consider then this setup:

* Declarations (without definition) of functions are allowed.

* Definitions are allowed.

* Declarations and definitions are allowed in distinct files in the same 
project as long as they match.

At this point, it is more tenuous to argue that "same file" is a special 
case that should prevent declarations and definitions to coexist, than 
to just let it happen and let the consistency principle take care of 
explaining it.


Andrei


More information about the Digitalmars-d mailing list