Fully dynamic d by opDotExp overloading

Yigal Chripun yigal100 at gmail.com
Sat Apr 18 00:05:52 PDT 2009


On 18/04/2009 04:54, Steven Schveighoffer wrote:

> I'm all for expanding runtime introspection that remains within the type
> system, I'm even for adding some possibility to create dynamically
> dispatched functions, as long as those functions are called differently
> from normal functions.
>
> -Steve

Here's an idea:
Allow the use of this feature _only_ for appropriately marked types.
dynamic class A {... opDotExp ...} //compiles
dynamic struct B {... opDotExp ...} //compiles

class A {... opDotExp ...} // compile-error: "please mark class as dynamic"
struct B {... opDotExp ...} // as above

now you have an easy way to know if a type is dynamic without changing 
the method invocation syntax. A proper IDE can easily mark those Types 
as different, for example, using a different color.



More information about the Digitalmars-d mailing list