shouting versus dotting

Simen Kjaeraas simen.kjaras at gmail.com
Wed Oct 8 14:01:30 PDT 2008


Benji Smith <dlanguage at benjismith.net> wrote:

> This idea first occurred to me when CTFE was introduced. I thought to  
> myself "if we can have compile-time function exectuion", why can't we  
> also have "runtime template instantiation"? Why is it only possible to  
> define a new type (or to choose which type) at compile time?
>
> In languages like Ruby, you can attach new methods to an object at  
> runtime. In .NET, you can generate, compile, and load new bytecode  
> instructions on the fly.
>
> It's hard to think of cases where you'd really want to construct a new  
> type at runtime. But maybe....automatically generating a library of  
> types by querying a database schema?
>
> --benji

The reasons for such things are to be found in the compiler. Optimizing
an expression whose types you do not know, and allocating space for a
type that may change its size under your feet - sounds to me like tricky
business.

-- 
Simen



More information about the Digitalmars-d mailing list