|
Boost : |
From: Seweryn Habdank-Wojewódzki (shw_at_[hidden])
Date: 2007-06-22 03:43:00
Hi!
Thanks for reply.
# piÄ
tek 22 czerwca 2007 06:18, @ David Abrahams:
>
> I'm sorry, I can't understand what you're saying. Examples might help.
I try :-).
Let's consider such a hiphotetical situation. We have a classes:
template < typename T >
struct Bar
{
T t_;
}
class Foo {
public:
typedef int A;
typedef Bar<A> BA;
// ...
};
Above order of definitions is important, due to language demand and compiler
functionality, But ... let's make a hypothesis, that compiler can make a map
of "symbols" in one translation unit, and sort topologically symbols.
So without any _loss_ of functionality, we can write:
class Foo {
public:
// ...
typedef Bar<A> BA;
typedef int A;
};
template < typename T >
struct Bar
{
T t_;
}
The hypothetical compiler can make a map, that will mark which symbol is known
and what is just used by the programmer. So let's try to analyse such a
recognition of symbols process.
The first step is topological sorting of the graph of the dependencies of
symbols. The second step we can go through compilation normally.
But topological sorting can change something in the code what is reached, by
that typical assumption that definitions and declarations are in proper
order.
So I am looking for the example where e.g. topological sorting of symbols can
destroy functionality. The example above is no that case.
Below is an example where sequence _is_ important:
typedef int A;
namespace B {
struct C { A a; };
typedef double A;
struct D { A a; };
}
But this code is an example of the bad design. So am looking the code where
design is good, and any sorting of symbols will change functionality.
Regards.
-- |\/\/| Seweryn Habdank-Wojewódzki \/\/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk