Re: std.algorithm and immutable arrays

2010-06-15 Thread Bruno Medeiros
On 10/06/2010 01:41, Andrei Alexandrescu wrote: (b) Promote a change in the compiler to convert immutable(T[]) to immutable(T)[] when passed by value into a function. This is safe and sensible. tailconst strikes back? :] -- Bruno Medeiros - Software Engineer

Re: std.algorithm and immutable arrays

2010-06-10 Thread Steven Schveighoffer
On Wed, 09 Jun 2010 20:41:48 -0400, Andrei Alexandrescu wrote: (b) Promote a change in the compiler to convert immutable(T[]) to immutable(T)[] when passed by value into a function. This is safe and sensible. I think this works well. Same goes for const and shared. -Steve

Re: std.algorithm and immutable arrays

2010-06-10 Thread Simen kjaeraas
Andrei Alexandrescu wrote: (b) Promote a change in the compiler to convert immutable(T[]) to immutable(T)[] when passed by value into a function. This is safe and sensible. This absolutely seems sensiblest. Vote++; -- Simen

Re: std.algorithm and immutable arrays

2010-06-10 Thread Simen kjaeraas
Andrei Alexandrescu wrote: (b) Promote a change in the compiler to convert immutable(T[]) to immutable(T)[] when passed by value into a function. This is safe and sensible. This absolutely seems sensiblest. Vote++; -- Simen

Re: std.algorithm and immutable arrays

2010-06-09 Thread BCS
Hello Andrei, (b) Promote a change in the compiler to convert immutable(T[]) to immutable(T)[] when passed by value into a function. This is safe and sensible. What say you? b.vote++ Making that an implicit conversion on any copy should be safe. But would it have any side effects? Also, w

Re: std.algorithm and immutable arrays

2010-06-09 Thread Michel Fortin
On 2010-06-09 20:41:48 -0400, Andrei Alexandrescu said: (b) Promote a change in the compiler to convert immutable(T[]) to immutable(T)[] when passed by value into a function. This is safe and sensible. This looks good to me. Although I wonder what happens if that range is a class, will you

std.algorithm and immutable arrays

2010-06-09 Thread Andrei Alexandrescu
I'm thinking of the recently discussed problem and it seems that immutable arrays are an issue not only for find(), but for all functions that need ranges. To fix things I'd need to add code for detecting immutable(T[]) and converting it to immutable(T)[] for _every_ algorithm using ranges out