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.

Reply via email to