restructuring name hiding around the notion of hijacking

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Sep 30 19:01:54 PDT 2009


Today's D has a very strong, principled notion of hijacking: for any 
given function call, if the call candidates are found in different 
modules, the call is invalid. I think that works great.

Lately I've been thinking of using the same notion of hijacking as a 
replacement for symbol hiding in inheritance hierarchies. Right now, if 
a derived class defines a symbol, that symbol simply hides whatever 
homonym symbol (unless it overrides it). There are some warnings about 
hiding sometimes, but it's all kind of fuzzy.

How about just using hijacking? The basic idea is that a use of a symbol 
in a class should not hijack a homonym symbol defined in a different module.


What do you think?

Andrei



More information about the Digitalmars-d mailing list