suggestion: read-only array-reference

xs0 xs0 at xs0.com
Wed Jul 19 05:59:00 PDT 2006


Hasan Aljudy wrote:

 > [snip]

First, let me just say I'm all for compile-time verification as much as 
possible.

But, your proposal has a problem - it introduces an entirely new type. 
You still can't write one function for both readonly and mutable arrays. 
You still can't know if you need to COW or not. As soon as a function 
takes a readonly parameter, all the functions it calls in turn also need 
to be declared readonly..

At the cost of some verbosity, the same effect can already be achieved 
with a simple array wrapper...


xs0



More information about the Digitalmars-d mailing list