Defining some stuff for each class in turn

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Oct 1 18:05:41 PDT 2009


Christopher Wright wrote:
> Andrei Alexandrescu wrote:
>> I am becoming increasingly aware that we need to provide some means to 
>> define certain members (data and functions) for each class as if they 
>> were pasted there.
> 
> Most of the examples given would be well served by decent builtin 
> reflection. Walter thinks reflection is too expensive to be active by 
> default. Find a cheaper way to provide runtime reflection. It's not as 
> sexy as using templates, but it's DRY and easier to use. Slower, but you 
> don't pay the cost of reflection multiple times if you have multiple 
> libraries requiring reflection.

What cheaper way would be than allowing a base class to prescribe 
reflection for its hierarchy? Where do templates even enter the mix? 
What's slower and why? Why do reflection as a language feature 
(increases base language size, buggy, rigid) instead of allowing it as a 
library if we so can? I'm totally against that.

Andrei



More information about the Digitalmars-d mailing list