[dmd-beta] dmd 2.063 beta 3

Nick Sabalausky bus_dmdbeta at semitwist.com
Sat May 18 12:47:47 PDT 2013


On Sat, 18 May 2013 21:28:55 +0200
Andrej Mitrovic <andrej.mitrovich at gmail.com> wrote:

> On 5/18/13, Walter Bright <walter at digitalmars.com> wrote:
> > I don't agree. A base class's scope must override the top level
> > module scope.
> >
> > Also, a base class can always override what a derived class does.
> > This is not hijacking.
> 
> Don't you see that this change in behavior is going to surprise a lot
> of people? It's intuitive to me that this is going to cause trouble
> down the road. A base class could be in another file, in another
> library, and if the library writer decides to introduce a scoped
> import, suddenly the user's code might end up calling the wrong
> function (if the type signatures are the same the user will have *no
> idea* what happened). This is the definition of function hijacking.

Wouldn't it just generate a "function call matches multiple functions"
error? If not, it definitely *should*, at least assuming that
inheriting imports should even be allowed at all. I can see how
inheriting imports *might* be considered potentially useful (inherit a
class and everything you need to deal with it is already imported), but
the usefulness does still seem questionable to me, and it does seem
counter-intuitive.


More information about the dmd-beta mailing list