override '.' member access

spir denis.spir at gmail.com
Tue Jan 25 15:05:15 PST 2011


On 01/25/2011 10:29 PM, Simen kjaeraas wrote:
> spir <denis.spir at gmail.com> wrote:
>
>> Hello,
>>
>> Cannot find corresponding opSomething method, if any. (opDispatch seems to
>> specialise for method call.)
>> Else, how to catch obj.member?
>
> opDispatch is likely what you want. with the @property annotation, it
> will readily support obj.member; and obj.member = foo; syntax.

Thank you, Simen, i'll try using opDispatch with @property. But I'm not sure 
how to write that concretely. My use case is of a type holding a 
string[AnyThing] AA called symbols. Then, I wish to map
	obj.id
to
	obj.symbols["id"]
(hope I'm clear)

Denis
-- 
_________________
vita es estrany
spir.wikidot.com



More information about the Digitalmars-d-learn mailing list