From: Jim Blandy <jimb@redhat.com>
To: gdb@sources.redhat.com
Cc: Benjamin Kosnik <bkoz@redhat.com>, Daniel Berlin <dan@dberlin.org>
Subject: Re: C++ nested classes, namespaces, structs, and compound statements
Date: Mon, 08 Apr 2002 16:29:00 -0000 [thread overview]
Message-ID: <np7knhsra6.fsf@zwingli.cygnus.com> (raw)
In-Reply-To: <20020406044204.245E45EA11@zwingli.cygnus.com>
Jim Blandy <jimb@redhat.com> writes:
> As a half-baked idea, perhaps a `struct environment' object would have
> a list of other `struct environment' objects you should search, too,
> if you didn't find what you were looking for. We could use this to
> search a compound statement's enclosing scopes to find bindings
> further out, find members inherited from base classes, and resolve C++
> `using' declarations.
From the discussion, it's pretty clear that this idea is, indeed,
half-baked. While the general idea of "stuff from over there is
visible here, too" does recur in the different contexts, there are so
many subtle differences in exactly what it means that I'm
uncomfortable having generic code try to handle it. I have the
feeling that it would become populated with "if we're doing C++
inheritance, do this; but if we're stepping out to an enclosing
compound statement, do this; ..." garbage. It's better to let the
context implement the right semantics itself.
However, it would be possible, at least, to provide generic code to do
lookups within a single environment. We could conceal symbol table
indexing techniques behind this interface (linear search for
environments binding few identifiers, as compound statements often
are; hash tables for big environments; and so on), which would allow
us to change the representation without breaking the consumers
(... but maybe skip lists would be fine for all the above).
We could then use that to write code for more specific cases:
- The code that looks up member names in a struct type (for example)
would call this generic code to search the immediate struct's
members, and then recurse on the struct's base classes, making the
appropriate adjustments (qualifying names, adjusting the base
address, and so on).
- The code that searches compound statement scopes, from the innermost
enclosing statement out (eventually) to the global scope, would know
that inner declarations simply shadow outer declarations, rather
than introducing ambiguities (as inheritance does). If GDB were to
support nested functions, some steps outward might note that a
static link needs to be traversed.
And so on. The generic code would only search one level; deeper
searches would be left to code that knows how they're supposed to
behave.
next prev parent reply other threads:[~2002-04-08 23:29 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-05 20:42 Jim Blandy
2002-04-05 22:05 ` Daniel Berlin
2002-04-05 22:34 ` Daniel Jacobowitz
2002-04-05 23:49 ` Daniel Berlin
2002-04-06 7:18 ` Dan Kegel
2002-04-06 9:26 ` Gianni Mariani
2002-04-06 11:57 ` Daniel Berlin
2002-04-08 17:24 ` Jim Blandy
2002-04-08 17:03 ` Jim Blandy
2002-04-08 18:59 ` Daniel Jacobowitz
2002-04-09 18:35 ` Jim Blandy
2002-04-09 20:56 ` Daniel Jacobowitz
2002-04-12 15:08 ` Jim Blandy
2002-04-12 16:32 ` Daniel Jacobowitz
2002-04-08 17:19 ` Jim Blandy
2002-04-08 18:49 ` Daniel Jacobowitz
2002-04-10 10:31 ` Jim Blandy
2002-04-10 12:08 ` Daniel Jacobowitz
2002-04-12 13:58 ` Jim Blandy
2002-04-12 16:56 ` Daniel Jacobowitz
2002-04-16 12:08 ` Jim Blandy
2002-04-16 14:01 ` Daniel Jacobowitz
2002-04-16 14:52 ` Jim Blandy
2002-04-16 14:58 ` Daniel Jacobowitz
2002-04-06 6:31 ` Andrew Cagney
2002-04-06 7:58 ` Daniel Berlin
2002-04-08 0:59 ` Joel Brobecker
2002-04-08 2:01 ` Doubt in GDB SathisKanna k
2002-04-06 8:49 ` C++ nested classes, namespaces, structs, and compound statements Per Bothner
2002-04-08 16:29 ` Jim Blandy [this message]
2002-04-08 16:48 ` Daniel Jacobowitz
2002-04-09 6:55 ` Petr Sorfa
2002-04-10 10:34 ` Jim Blandy
2002-04-10 12:31 ` Daniel Berlin
2002-04-10 12:53 ` Petr Sorfa
2002-04-05 22:02 Michael Elizabeth Chastain
2002-04-05 22:13 ` Daniel Berlin
2002-04-05 22:30 ` Daniel Berlin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=np7knhsra6.fsf@zwingli.cygnus.com \
--to=jimb@redhat.com \
--cc=bkoz@redhat.com \
--cc=dan@dberlin.org \
--cc=gdb@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox