Gavin--

I think that your analogy is way off.  The ANTLR 3 composition looks much more 
like Python's "import module" than it does OO  inheritance.  In an OO setting, 
A inheriting from B2, B3 with B2 and B3 each inheriting from C has the problem 
that data duplication is either essential or a big problem; ANTLR composites 
can safely avoid that (at least, for the most part).

--Loring



----- Original Message ----
> From: Gavin Lambert <[EMAIL PROTECTED]>
> To: Loring Craymer <[EMAIL PROTECTED] oo.com>; Terence Parr <[EMAIL 
> PROTECTED]>; Laurent Caillette <[EMAIL PROTECTED]>
> Cc: antlr-interest Interest <[EMAIL PROTECTED]>
> Sent: Monday, October 27, 2008 5:05:28 PM
> Subject: Re: [antlr-interest] Duplicate members when generating code with 2 
> import levels in Java with ANTLR-3.1.1
> 
> At 12:04 28/10/2008, Loring Craymer wrote:
> >Just my 2 cents, but shouldn't duplicate imports be supported at 
> 
> >the language level, as is true for Java, C#, and even C/C++ with 
> 
> >the usual #ifdef wrapping?  It seems to me that leaving 
> dependency
> >management to the user limits the convenience of composition.
> 
> If you think of grammar imports as class inheritance (which is 
> what they behave most like), then I think you'll find that those 
> other languages don't really support it all that well either :)
> 
> In C#, multiple inheritance of interfaces is supported cleanly, 
> but interfaces carry no implementation.  Since the 
> implementation-inheritance model is single-inheritance, there's no 
> possibility of a serious clash.  I'm not sure about Java exactly, 
> but I believe it's similar.
> 
> In C++, if you try to make class C inherit from both B1 and B2 
> (where B2 inherits from B1), then it will indeed include an extra 
> copy of B1 (in what's known as a "deadly diamond"), unless B1 is a 
> virtual base class.  This seems like the same behaviour as what 
> ANTLR exhibits, except that (currently at least) ANTLR provides no 
> means to make it a virtual base :)



      

List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to