D library projects

Michel Fortin michel.fortin at michelf.com
Sun Nov 15 06:39:07 PST 2009


On 2009-11-15 00:09:43 -0500, "Steven Schveighoffer" 
<schveiguy at yahoo.com> said:

> I agree -- it should be possible with the metaprogramming power of D to 
>  allow for the user to choose his weapon -- power and speed vs. safe.  
> I  think simplicity is a given.
> 
> For example, it could be a version statement that decides whether 
> ranges  of a container do runtime checks for safety.

Interesting, although you'll probably want better granularity than a 
version statement. If your containers are going to be used with SafeD 
perhaps you'll want a safe and an unsafe variant of some accessor 
functions (one with bound checks being called for safe code, the other 
without).


> I think shoehorning containers that are graph based into value types 
> might  be a little strenuous.  All the builtin D container types are 
> essentially  reference types (arrays are not exactly reference types 
> but behave mostly  like reference types), I don't see why we should 
> change that.
> 
> Making them classes allows for interfaces which helps allow runtime  
> decisions for things like copying data between containers that are of  
> different types.  See dcollections and how easy it is to copy data from 
>  one type to another.

I'm of the same opinion. That said, I'm wondering if the container 
classes shouldn't also be made final (unlike dcollections). Being 
classes would make them easy to pass as interfaces, but them being 
final would help skip the virtual calls whenever you don't pass them as 
interfaces.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list