On Oct 28, 2008, at 1:35 AM, Loring Craymer wrote:
> Ter-- > > Indirect execution is a very weak form of polymorphism, and the > mechanism you describe depends on compiler type awareness. > > Assume that you have two versions of rule b, defined in separate but > included grammars > > b[int foo] : a b c ; // version 1 > > b returns int : d e f ; // version 2 > > These have different type signatures; in an OO system, b[int x] > would translate to version 1, and z = b would imply version 2. isn't that overloading rather than overwriting? nothing to do with object-oriented programming if I remember correctly. > As you mention, interpretation depends on the message sent, and part > of the message are the data type expectations. but unless you are using ML and so on, most languages are not polymorphic on the argument types or the return signatures. > On another note, ANTLR lacks the data abstractions that go with the > OO idea of inheritance. The mechanism implemented in ANTLR 3 looks > much more like Python's module import facility than it does > inheritance. Can you give an example of what you can't do with antlr's grammar composition that you could do with an ordinary object oriented language? *the* quintessential example of polymorphism is the one I gave where you inherit method that calls a method overridden in the subclass. If your language doesn't do that, it's not polymorphic. what you're talking about is something totally different: parameter-based polymorphism or simple overloading as you describe above. Ter 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 -~----------~----~----~----~------~----~------~--~---
