comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Parser interface design
Date: Wed, 6 Apr 2011 14:20:11 +0200
Date: 2011-04-06T14:20:11+02:00	[thread overview]
Message-ID: <1p6q05xtgjspf.7qanu7wlynvi$.dlg@40tude.net> (raw)
In-Reply-To: slrnipof32.2fnq.lithiumcat@sigil.instinctive.eu

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



  parent reply	other threads:[~2011-04-06 12:20 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-06 10:11 Parser interface design Natasha Kerensikova
2011-04-06 12:17 ` Georg Bauhaus
2011-04-07 18:56   ` Natasha Kerensikova
2011-04-08 11:49     ` Stephen Leake
2011-04-06 12:20 ` Dmitry A. Kazakov [this message]
2011-04-07 19:14   ` Natasha Kerensikova
2011-04-07 20:31     ` Dmitry A. Kazakov
2011-04-08 13:51       ` Natasha Kerensikova
2011-04-08 14:21         ` Dmitry A. Kazakov
2011-04-12 15:58           ` Natasha Kerensikova
2011-04-12 17:14             ` Dmitry A. Kazakov
2011-04-06 15:51 ` Georg Bauhaus
2011-04-07 19:44   ` Natasha Kerensikova
2011-04-07 20:52     ` Dmitry A. Kazakov
2011-04-07 22:09     ` Simon Wright
2011-04-08 14:03       ` Natasha Kerensikova
2011-04-08 19:06         ` Jeffrey Carter
2011-04-08 19:59         ` Simon Wright
2011-04-12 16:13           ` Natasha Kerensikova
2011-04-12 17:22             ` Dmitry A. Kazakov
2011-04-12 19:02               ` Simon Wright
2011-04-13  8:20                 ` Natasha Kerensikova
2011-04-13  8:37                   ` Dmitry A. Kazakov
2011-04-13 11:06                     ` Georg Bauhaus
2011-04-13 12:46                       ` Dmitry A. Kazakov
2011-04-13 22:33                   ` Randy Brukardt
2011-04-14  6:55                     ` Natasha Kerensikova
2011-04-15  0:22                       ` Randy Brukardt
2011-04-12 21:54               ` Randy Brukardt
2011-04-07 22:13     ` Georg Bauhaus
2011-04-08 15:30       ` Natasha Kerensikova
2011-04-07  0:36 ` Randy Brukardt
2011-04-08 11:16 ` Brian Drummond
2011-04-19  9:08 ` Natasha Kerensikova
2011-04-19 12:35   ` Ludovic Brenta
2011-04-20 10:44     ` Brian Drummond
2011-04-19 17:28   ` Jeffrey Carter
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox