|
Boost : |
From: Jason Shirk (jasonsh_at_[hidden])
Date: 2002-02-15 13:39:57
> -----Original Message-----
> From: Geurt Vos [mailto:G.Vos_at_[hidden]]
>
> It should work fine for at least GCC 2.95.3, Borland
> C++ 5.5.1 and Intel C++ 5.0. It simply can't be done
> for Visual C++ 6.0 & 7.0.
>
> Geurt
>
Famous last words: "can't be done". Loki was ported to VC6, so I'm sure
it's possible.
While I love the idea of a language only implementation of properties,
you really need compiler support for the complete solution.
First, I find it unacceptable to store a pointer to the self in the
property object. If I wanted all data members to have corresponding
properties, I have quite likely doubled the size of my object.
Second, it won't work with bitfields.
I would think you want to provide the ability to have a "virtual"
property not backed by any data member (perhaps the value is stored in a
dictionary.) You may already have that support, but I didn't see it.
Last, I'll point out VC6 and beyond has full compiler support for
properties. I don't like the syntax, but it looks like this:
struct S {
int __declspec(property(get=get_foo,put=put_foo)) foo;
int get_foo();
void put_foo(int value);
};
The compiler simply maps s.foo into the appropriate get or put function,
depending on the context.
Jason Shirk
VC++ Compiler Team
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk