From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Parser interface design
Date: Tue, 12 Apr 2011 19:14:04 +0200
Date: 2011-04-12T19:14:01+02:00 [thread overview]
Message-ID: <13y1h61pwdjtg$.1k2pl0l7sry9s.dlg@40tude.net> (raw)
In-Reply-To: slrniq8tkc.2fnq.lithiumcat@sigil.instinctive.eu
On Tue, 12 Apr 2011 15:58:04 +0000 (UTC), Natasha Kerensikova wrote:
> On 2011-04-08, Dmitry A. Kazakov <mailbox@dmitry-kazakov.de> wrote:
>> On Fri, 8 Apr 2011 13:51:51 +0000 (UTC), Natasha Kerensikova wrote:
>>> Then, it so happens that the set of features matches exactly the set of
>>> callbacks.
>>
>> If the property is one of the callback, it is the callback's responsibility
>> to check it. Moving it to the parser is fragile design.
>
> I don't think whether the access-to-subprogram provided to the parser
> being null or not is actually a property of the callback itself.
No, it is not. This is what makes such design fragile.
>> When your parser sums two numbers it does not have + as a primitive
>> operation. Does it? If numbers may have a hierarchy of their own, why
>> renderer cannot?
>
> I'm actually not sure what a "primitive operation" actually is. I've
> actually never heard of OOP-style class hierarchy among numbers in Ada,
> so I might be missing something big.
Nevertheless you are successfully using numbers with things which are not
numbers. Which is the point. Why a renderer cannot be used independently on
parser? At least for testing purpose?
> I didn't have the impression of gluing several states together in my
> first design.
Renderer, source/input, parser have logically independent states.
I haven't never looked at infix expressions, and
> fortunately Markdown doesn't contain any. And on top of that, I'm not
> sure exactly what you are referring to with "standard stack"; is it a
> special Ada concept, or is it the standard x86 stack where function
> return information and parameters are stored?
Let's call it local stack.
>> In Ada you lose nothing making it tagged. Differently to C++ where
>> "virtual" has non-zero overhead, in Ada making a procedure primitive has
>> zero performance cost, because the target will be resolved statically.
>
> Interesting to know. But it still makes sense to not tag types that
> don't need it, right?
No. IMO there are only three reasons why something is not tagged:
1. [premature] Optimization: tagged types are by-reference and have stored
tag.
2. Language problem: in Ada some types cannot be tagged.
3. Class-wide behavior, i.e. T'Class.
> It seems to boil down to a matter of extensibility.
Rather to the least constraint. You should not introduce constraints
without a reason.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2011-04-12 17:14 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
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 [this message]
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