On Tue, 01 Dec 2009 03:15:12 -0800, Walter Bright <newshou...@digitalmars.com> wrote:
>Max Samukha wrote: >> On Mon, 30 Nov 2009 22:33:40 -0800, Walter Bright >> <newshou...@digitalmars.com> wrote: >> >>> I agree. While the compiler currently doesn't check for mixing up >>> properties and methods, I intend to make it do so. I can't see any >>> justification for allowing it. >> >> Bill rightfully mentioned that it would be impossible to dynamically >> dispatch to both properties and methods even if those properties and >> methods don't have conflicting names. And that may really be an >> unfortunate limitation. For example, it would be problematic to >> implement a generic wrapper for IDispatch: > >Is there any reason not to just make the IDispatch properties have a >function interface? I don't know. It looks like IDispatch::Invoke requires the invokation flag to be explicitly specified. The wrapper can try to determine the flag using IDispatch::GetTypeInfo. However, objects implementing IDispatch are not required to provide any type information. Denis has suggested a convention-based approach (constraint for names starting with "prop_"). It is not great but may work.