Fully dynamic d by opDotExp overloading

Don nospam at nospam.com
Fri Apr 17 22:39:50 PDT 2009


Steven Schveighoffer wrote:
> On Fri, 17 Apr 2009 21:54:52 -0400, Steven Schveighoffer 
> <schveiguy at yahoo.com> wrote:
> 
>> Andrei wrote:
>>> We are discussing a language extension. That language extension will 
>>> allow a type to choose flexibility in defining methods dynamically, 
>>> while being otherwise integrated syntactically with the current 
>>> values. This has advantages, but also alters the expectations.
>>
>> As long as it identifies what can be dynamic and what cannot.  I can't 
>> imagine Walter will go for this with his strict view of hijacking.
> 
> Let me add that if there was a way for syntax to easily allow for 
> unintentional calls to be translated to compile-time errors, I think 
> this would be a workable solution.

There is. Just mark opDot as nothrow.

> 
> For example, I don't have any problem with your Pascalize example, 
> because you have not removed any static typing from the code (i.e. no 
> unexpected noops or exceptions are built in).  If there were some way to 
> enforce this, then I think it would be a usable idea.  For instance, if 
> you only allow CTFE to specify a function that is called when certain 
> strings are passed in, I don't have a problem with that, because you are 
> simply dispatching the data to strongly typed functions at compile time, 
> which provide compile-time errors when you mess up.
> 
> -Steve



More information about the Digitalmars-d mailing list