Fully dynamic d by opDotExp overloading
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sat Apr 18 00:24:39 PDT 2009
Yigal Chripun wrote:
> 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.
The dynamic behavior is indicated by the use of opDotExp. The redundancy
of the two notations doesn't quite sit well.
Andrei
More information about the Digitalmars-d
mailing list