Pulling some builtin logic out

Simen Kjaeraas simen.kjaras at gmail.com
Mon Mar 31 11:16:53 PDT 2008


On Mon, 31 Mar 2008 19:36:59 +0200, Koroskin Denis <2korden+dmd at gmail.com>  
wrote:

> Yes, it's a good idea, but your solution introduces virtual function  
> calls that could kill performance.
> Much better approch would be the following:
>
> - Provide an "interface" that built-in AAs implement.
> - Allow user-defined types to implement this interface.
> - Allow these derived types to benefit from all the syntax sugar, used  
> by built-in containers.
> - Allow users to replace built-in containers with user-defined ones.  
> (arguable)
>
> Third point is necessary since there are still some tricks that can't be  
> used by programmer like 'in' operator in AAs.
> This way containers could be replaced by user-defined types partially or  
> completely.p

The in operator is overloadable via opIn and opIn_r, so that wouldn't  
really be
a problem, I think. As for the other stuff, it sounds like a pleasant idea.

-Simen



More information about the Digitalmars-d mailing list