restructuring name hiding around the notion of hijacking

Michel Fortin michel.fortin at michelf.com
Wed Sep 30 20:15:43 PDT 2009


On 2009-09-30 22:01:54 -0400, Andrei Alexandrescu 
<SeeWebsiteForEmail at erdani.org> said:

> 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?

I think it's a good idea, but there should be a way to *override* 
static functions.

In fact I sometime wonder if it'd be a good idea to disallow hijacking 
of global variables with local variables inside functions too, but 
that's more triky to do.


-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list