Why not finally allow bracket-less top-level keywords?

F i L witte2008 at gmail.com
Mon Mar 19 13:39:24 PDT 2012


deadalnix wrote:
> That is totally broken design. The fact that mothership inherit 
> from ship is a pretty good example of misusing inheritance. The 
> fireMissle is useless unless you KNOW that you are manipulating 
> a MotherShip, so you totally break all the abstraction the OOP 
> could provide.

Other objects can contain references to MotherShip types 
directly, while the main update loop works with the base type. 
Or, perhaps more relevant, an object could execute "fire()" on a 
list of Ships, which MotherShip can be a part of because it IS a 
Ship, regardless if weather it can overwrite Ship's functions or 
not. I can't imagine a different way of defining this 
relationship short of inheriting from a common interface which 
would require duplicating the fire() function in both types 
(given that fire() is designed to ensure common behavior among 
all Ship types).

This is not a broken concept at all. I'm always open to different 
ideas, but I'm fairly surprised you're arguing this case. Being 
able to extend a type, even when the extensions are entirely 
additive, is a fundamental principle of OOP design.


More information about the Digitalmars-d mailing list