Dynamic language

Boscop nospam at example.com
Fri Mar 16 04:22:06 PDT 2012


On Friday, 16 March 2012 at 09:12:57 UTC, F i L wrote:
> Alright I give up dammit! How do you use opCall() to make 
> a.cool() work?

How would it be possible, the type of the delegate can't be 
typechecked at the call-site, because the type info is lost in 
the variant. And you can't exhaustively test for all function 
types in the opDispatch getter.
opDispatch would have to store the names and types internally at 
compile-time, which isn't possible. But even then it would have 
to be guaranteed that all setter calls are evaluated before the 
getter calls are checked.
Maybe one could manually store the type info in a special struct 
together with the delegate and then cast it to that type in the 
opDispatch getter.


More information about the Digitalmars-d mailing list