digitalmars.D - Re: Why can't structs be derived from?
- Jesse Phillips <jessekphillips+D gmail.com> Mar 15 2011
Jens Wrote:I didn't ask how to do composition in D. I asked why composition cannot be done via derivation, i.e., the reasoning behind the language design choice. A design faux paus IMO.
Sorry that is a good point. Based on the other threads it seems you feel syntax for composition is not important because the inheritance syntax is cleaner. As syntax is not a indicator of bad design (is definitely a reason not to use a language) let me point out this design benefit. As a someone not familiar with C++ I would not understand the implications, such as the issue with slicing, I would say, "Yeah I know how inheritance works" and use struct inheritance as though it was the same as class. With a completely new construct, as a new user of D, I see that I don't understand what happening and must find out what 'alias this' is doing. You mentioned that we shouldn't cater to those that don't RTFM. Languages like C++ and D are large in the number of features they have. A new user could read about everything in the language, but they will not remember every pitfall for every feature (how the differ in every situation), or every feature in the language (alias this). You do seem to have a very strange taste. The fact that you do not like they syntax is of no interest to the development of D, unless you can provide a good reason on what is wrong with the syntax or why another one is better.
Mar 15 2011