If you had money to place for a bounty, what would you choose?

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Wed Dec 4 05:46:59 PST 2013


On 04/12/13 14:22, Dicebot wrote:
> Can you address proposal to move all such functions into UFCS instead? What are
> possible issues in your opinion as compared to declaring them as final inside
> class?

This was discussed at length previously, so it may be an idea to search the 
archives for the original debate.

The killer argument really came down to two points -- of which I'd say the 
second was the one that really swung it:

     * Performance -- with virtual-by-default, we also have slower performance
       by default.  Users who casually try out D will probably be put off by this
       and not bother to explore far enough to realize they have to use "final"
       to get better performance.

     * Breaking changes -- with final by default, if you accidentally forget to
       mark a method as virtual, you can correct this without affecting
       downstream users.  By contrast with virtual by default, if you incorrectly
       forget to mark a method as final, you can't correct it later without
       potentially breaking downstream code.

The latter argument is explained in some detail in an interview with one of the 
main C# designers, discussing why they went for final-by-default in their class 
design.


More information about the Digitalmars-d mailing list