dmd 2.063 released with 260 bugfixes and enhancements
    Jonathan M Davis 
    jmdavisProg at gmx.com
       
    Thu May 30 11:09:08 PDT 2013
    
    
  
On Thursday, May 30, 2013 20:00:24 Mafi wrote:
> What a great release! Great work!
> 
> I really like the new langugage changes. One change caught my
> attention: #10 "The Template This Parameter now changes the
> member function qualifier". Does this mean that const/immutable
> ranges can implement a useful opSlice? Like
> 
> struct MyRange!T {
> T[] data;
> 
> MyRange!(ElementType!data) opSlice(this T)() {
> return MyRange(data);
> }
> }
> 
> So that given the other range primitves this will work:
> 
> const myConstRange = MyRange([5, 6, 7, 8]);
> foreach(x; myConstRange) {}
> 
> Could this be made work with 2.063?
No, because you still have the fundamental problem that MyRange!T and MyRange!
(const T) are different types which potentially have no relation to one another 
aside from the fact that they were generated by the same template. In the 
general case, you can't just convert MyRange!T to MyRange!(const T). It only
works with arrays because the compiler understands them.
- Jonathan M Davis
    
    
More information about the Digitalmars-d-announce
mailing list