Re: Two cases showing imperfection of the const system

2012-02-17 Thread Steven Schveighoffer
On Thu, 16 Feb 2012 16:48:27 -0500, SiegeLord wrote: Firstly, let me preface this... if you use templates to get around the const system's imperfections, you are admitting that the const system is broken. Now, on with the program. My unique experience in using D2 without Phobos lead me to

Re: Two cases showing imperfection of the const system

2012-02-17 Thread Timon Gehr
On 02/17/2012 06:54 AM, SiegeLord wrote: On Friday, 17 February 2012 at 02:39:29 UTC, Andrei Alexandrescu wrote: That's a given. But that doesn't confer them infinite powers otherwise inaccessible; you seem to require any flexibility that seems reasonable within a context, and that's simply put

Re: Two cases showing imperfection of the const system

2012-02-16 Thread Daniel Murphy
"Jonathan M Davis" wrote in message news:mailman.457.1329458451.20196.digitalmar...@puremagic.com... > there is a pull request (which has been around a while and may never get > merged in) It or something like it will most likely get merged in eventually.

Re: Two cases showing imperfection of the const system

2012-02-16 Thread Jonathan M Davis
On Friday, February 17, 2012 06:54:44 SiegeLord wrote: > On Friday, 17 February 2012 at 02:39:29 UTC, Andrei Alexandrescu > > wrote: > > That's a given. But that doesn't confer them infinite powers > > otherwise inaccessible; you seem to require any flexibility > > that seems reasonable within a c

Re: Two cases showing imperfection of the const system

2012-02-16 Thread SiegeLord
On Friday, 17 February 2012 at 02:39:29 UTC, Andrei Alexandrescu wrote: That's a given. But that doesn't confer them infinite powers otherwise inaccessible; you seem to require any flexibility that seems reasonable within a context, and that's simply put impossible. There is a point where inout

Re: Two cases showing imperfection of the const system

2012-02-16 Thread Andrei Alexandrescu
On 2/16/12 6:49 PM, SiegeLord wrote: On Thursday, 16 February 2012 at 23:14:54 UTC, Andrei Alexandrescu wrote: Hold them horses. I disagree. You're just saying it, but what's your basis? Because some cases (as shown below) trivially work within the const system, while some closely related ones

Re: Two cases showing imperfection of the const system

2012-02-16 Thread SiegeLord
On Friday, 17 February 2012 at 00:34:41 UTC, Timon Gehr wrote: This compiles with DMD 2.057 and DMD 2.058: import std.stdio; inout(char)[] test(inout(char)[] x){ inout(char)[][int] a; a[1]=x; return a[1]; } void main(){ writeln(test(['a'])); } Whoops, nevermind then on it not work

Re: Two cases showing imperfection of the const system

2012-02-16 Thread SiegeLord
On Thursday, 16 February 2012 at 23:14:54 UTC, Andrei Alexandrescu wrote: Hold them horses. I disagree. You're just saying it, but what's your basis? Because some cases (as shown below) trivially work within the const system, while some closely related ones don't. You're not going to be able

Re: Two cases showing imperfection of the const system

2012-02-16 Thread Timon Gehr
On 02/17/2012 01:19 AM, SiegeLord wrote: It does. The problem is that your function is missing a return statement. Try it with the return statement, it doesn't compile anyway. -SiegeLord This compiles with DMD 2.057 and DMD 2.058: import std.stdio; inout(char)[] test(inout(char)[] x){

Re: Two cases showing imperfection of the const system

2012-02-16 Thread SiegeLord
It does. The problem is that your function is missing a return statement. Try it with the return statement, it doesn't compile anyway. -SiegeLord

Re: Two cases showing imperfection of the const system

2012-02-16 Thread Timon Gehr
On 02/17/2012 12:36 AM, Timon Gehr wrote: On 02/17/2012 12:08 AM, James Miller wrote: The first problem is trivial, solving the second one in a type safe way would require adding parametric polymorphism to D. (Which I'd love to have!) Can't you emulate type-safe parametric polymorphism with t

Re: Two cases showing imperfection of the const system

2012-02-16 Thread Timon Gehr
On 02/17/2012 12:08 AM, James Miller wrote: The first problem is trivial, solving the second one in a type safe way would require adding parametric polymorphism to D. (Which I'd love to have!) Can't you emulate type-safe parametric polymorphism with template constraints? In general, no. cla

Re: Two cases showing imperfection of the const system

2012-02-16 Thread Andrei Alexandrescu
On 2/16/12 3:48 PM, SiegeLord wrote: Firstly, let me preface this... if you use templates to get around the const system's imperfections, you are admitting that the const system is broken. Now, on with the program. Hold them horses. I disagree. You're just saying it, but what's your basis? My

Re: Two cases showing imperfection of the const system

2012-02-16 Thread James Miller
> The first problem is trivial, solving the second one in a type safe way > would require adding parametric polymorphism to D. (Which I'd love to have!) > Can't you emulate type-safe parametric polymorphism with template constraints?

Re: Two cases showing imperfection of the const system

2012-02-16 Thread Timon Gehr
On 02/16/2012 10:48 PM, SiegeLord wrote: Firstly, let me preface this... if you use templates to get around the const system's imperfections, you are admitting that the const system is broken. Now, on with the program. My unique experience in using D2 without Phobos lead me to encounter two case

Two cases showing imperfection of the const system

2012-02-16 Thread SiegeLord
Firstly, let me preface this... if you use templates to get around the const system's imperfections, you are admitting that the const system is broken. Now, on with the program. My unique experience in using D2 without Phobos lead me to encounter two cases that show how the D2 const system is