From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,50e705cdf2767cc6 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Parser interface design Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: Date: Wed, 6 Apr 2011 14:20:11 +0200 Message-ID: <1p6q05xtgjspf.7qanu7wlynvi$.dlg@40tude.net> NNTP-Posting-Date: 06 Apr 2011 14:20:11 CEST NNTP-Posting-Host: 0d003d43.newsspool1.arcor-online.net X-Trace: DXC=LP2WT<_[7Sl;iVb[J9ZZP`ic==]BZ:afn4Fo<]lROoRa<`=YMgDjhgbZFm4oJHSm]j[6LHn;2LCVn7enW;^6ZC`d\`mfM[68DCcb?A6djaXnNj X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:18694 Date: 2011-04-06T14:20:11+02:00 List-Id: On Wed, 6 Apr 2011 10:11:46 +0000 (UTC), Natasha Kerensikova wrote: > I thought the most idiomatic way of putting together a bunch of > callbacks in Ada would be to use an Interface, and then rely on dynamic > dispatch. It also can be an abstract base type with primitive operations defined null. The advantage is that you can have a "null function" and non-null implementations with a type, which you cannot with an interface. > The approach using tagged types implementing an interface seems heavier. You should not try to pack everything onto one types hierarchy. The parser and renderer should likely be two different hierarchies glued together through a mix-in in a third object aggregating both implementation. > So what would be the best approach to interface a parser and a renderer? The parsers I implemented used primitive operations as sematic callbacks. As for the renderer, I did one built upon GtkSourceView buffer. But that had its own parser, so there was no interaction between them. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de