D seems interesting, but...
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Mon Oct 15 13:55:36 PDT 2012
On 10/15/12 4:12 PM, bearophile wrote:
> Andrei Alexandrescu:
>
>> Well there's a tension here: good language design generally aims at
>> providing few general features applicable to many use cases. Encoding
>> particular use cases in the language is warranted by either
>> disproportionate frequency in use or disproportionate difficulty in
>> implementing them within the language. I don't think this particular
>> feature scores very highly in either category.
>
> It's a feature that I use about in every Python module/package I've
> written, and it's about as equally used in code you see in Python
> repositories. So it's a common need in Python. I'm asking for it for
> more than three years or so.
I don't think that compares apples to apples, as the entire feature
combination present into either language must be taken into account.
> And regarding the implementation my "hack" means having a single
> compile-time constant (plus a switch to be used when you want partial
> compilation?). Better designs are possible, but it's a matter of how
> much you want to work for it.
I think for someone coming from Python, something akin to
if __name__ == "__main__":
main()
makes good sense. In my opinion that's not a design we should copy.
Andrei
More information about the Digitalmars-d
mailing list