ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Wannheden" <knut.wannhe...@paranor.ch>
Subject Re: override
Date Thu, 07 Aug 2003 14:13:51 GMT
> >>
> >>>Just to get you up to speed, the current issue is about multiple
> >>>inheritance, and how the current system allows cross-import (unwanted?)
> >>>side-effects, as Conor has brilliantly shown.
> >>
> >> What I'm not sure I understand is what import has to do with multiple
> >> inheritance :-)
> >
> > Because we can import two targets with the same name from different
> > files. Making them work together is conceptually similar.
>
> You could try to import 2 classes with the same name in java.
> It's a syntax error - and if it happen, you must use qualified names.
>
> Yes, most build files have a target named "build" - but I don't know why
> would you think about inheritance and OO instead of just qualified names.
>
> I don't know _any_ programming language where import is used for
> inheritance.
>

Maybe it would be better to think in the term of "mixin" as some languages
(e.g. some Lisp flavours and Ruby) use.  The following two exerpts are from
the Modules chapter of the free book "Programming Ruby: The Pragmatic
Programmer's Guide" (http://www.rubycentral.com/book/tut_modules.html):

 o Modules are a way of grouping together methods, classes, and constants.
Modules give you two major benefits:
   1. Modules provide a namespace and prevent name clashes.
   2. Modules implement the mixin facility.
 o Modules have another, wonderful use. At a stroke, they pretty much
eliminate the need for multiple inheritance, providing a facility called a
'mixin'.

Ruby uses an "include" statement (not "import") to "mix in" another module.
And as such the included modules effectively behave as superclasses.

Maybe it would be possible to borrow some ideas and concepts from Ruby...

--
knut




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message