Related articles |
---|
Object Oriented Compiler Design Problem mayurnaik@my-dejanews.com (1998-09-05) |
Re: Object Oriented Compiler Design Problem qjackson@wave.home.com (Quinn Tyler Jackson) (1998-09-13) |
Re: Object Oriented Compiler Design Problem qjackson@wave.home.com (Quinn Tyler Jackson) (1998-09-13) |
Re: Object Oriented Compiler Design Problem dwight@pentasoft.com (1998-09-13) |
Object Oriented Compiler Design Problem dboucher@locus.ca (Dominique Boucher) (1998-09-13) |
Re: Object Oriented Compiler Design Problem brueni@ipass.net (Dennis Brueni) (1998-09-13) |
Re: Object Oriented Compiler Design Problem mikee@cetasoft.cog (1998-09-13) |
Re: Object Oriented Compiler Design Problem jucie@uol.com.br (Juciê Dias Andrade) (1998-09-13) |
Re: Object Oriented Compiler Design Problem danwang+news@cs.princeton.edu (Daniel C. Wang) (1998-09-18) |
From: | mikee@cetasoft.cog (Mike Enright) |
Newsgroups: | comp.compilers |
Date: | 13 Sep 1998 22:29:24 -0400 |
Organization: | CetaSoft (com not cog) |
References: | 98-09-019 |
Keywords: | OOP, design |
On 5 Sep 1998 01:20:58 -0400, mayurnaik@my-dejanews.com wrote:
[OO compiler stuff snipped]
>
>The function symbol* add(symbol*, symbol*) cannot be made a virtual function
>of class symbol, since it is a friend function. But, the moment it is a
>friend function, it does not know whether the symbols to be added are
>Constants or Variables
This is a classic case of the need for double-dispatch (choosing a
function based on two types instead of one). A modern approach would
be based on the Visitor pattern. I would take this up at the
comp.object newsgroup or on the OTUG mailing list (go to www.oma.com
to sign up for that). (I'm afraid I don't have much more to offer on
the subject; I'm posting to ensure that these ideas are at least
mentioned.)
>[I suspect a union with a type field is it. RTTI in this case would amount to
>the same thing. -John]
I'm certain that RTTI is not necessary.
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.