CTFE is getting too powerful :o)

2013-03-27 Thread Andrei Alexandrescu
Found this: http://stackoverflow.com/questions/15652718/object-error-access-violation-when-printing-result-of-std-algorithm-cartesianpr Soon we'll need to clearly define the limits of CTFE, and what happens when it fails. Andrei

Re: CTFE is getting too powerful :o)

2013-03-27 Thread bearophile
Andrei Alexandrescu: Soon we'll need to clearly define the limits of CTFE, and what happens when it fails. It seems a bug, this is a reduction: struct MapResult(alias fun) { int[] _input; @property bool empty() { return _input.length == 0; } void popFront() {

Re: CTFE is getting too powerful :o)

2013-03-27 Thread Timon Gehr
On 03/27/2013 04:44 PM, bearophile wrote: Andrei Alexandrescu: Soon we'll need to clearly define the limits of CTFE, and what happens when it fails. It seems a bug, this is a reduction: ... You might want to add it to the report, which is at: http://d.puremagic.com/issues/show_bug.cgi?id=98

Re: CTFE is getting too powerful :o)

2013-03-27 Thread Dicebot
On Wednesday, 27 March 2013 at 14:48:32 UTC, Andrei Alexandrescu wrote: Found this: http://stackoverflow.com/questions/15652718/object-error-access-violation-when-printing-result-of-std-algorithm-cartesianpr Soon we'll need to clearly define the limits of CTFE, and what happens when it fails.

Re: CTFE is getting too powerful :o)

2013-03-27 Thread bearophile
Timon Gehr: You might want to add it to the report, which is at: http://d.puremagic.com/issues/show_bug.cgi?id=9822 I will, later. Bye, bearophile

Re: CTFE is getting too powerful :o)

2013-03-27 Thread Jesse Phillips
On Wednesday, 27 March 2013 at 14:48:32 UTC, Andrei Alexandrescu wrote: Found this: http://stackoverflow.com/questions/15652718/object-error-access-violation-when-printing-result-of-std-algorithm-cartesianpr Soon we'll need to clearly define the limits of CTFE, and what happens when it fails.

Re: CTFE is getting too powerful :o)

2013-03-27 Thread Timon Gehr
On 03/27/2013 03:48 PM, Andrei Alexandrescu wrote: Found this: http://stackoverflow.com/questions/15652718/object-error-access-violation-when-printing-result-of-std-algorithm-cartesianpr Soon we'll need to clearly define the limits of CTFE, and what happens when it fails. ... Attempt 1: CTFE

Re: CTFE is getting too powerful :o)

2013-03-27 Thread H. S. Teoh
On Wed, Mar 27, 2013 at 10:48:31AM -0400, Andrei Alexandrescu wrote: > Found this: > http://stackoverflow.com/questions/15652718/object-error-access-violation-when-printing-result-of-std-algorithm-cartesianpr IMO, this is a compiler bug. If the compiler can't correctly generate code for something

Re: CTFE is getting too powerful :o)

2013-03-27 Thread H. S. Teoh
On Wed, Mar 27, 2013 at 05:55:54PM +0100, Timon Gehr wrote: [...] > If CTFE does not terminate, compilation is not allowed to succeed. Heh, I think this one is unimplementable, as it amounts to solving the halting problem. :) > If CTFE fails because the above criteria are not met, the evaluated

Re: CTFE is getting too powerful :o)

2013-03-27 Thread Timon Gehr
On 03/27/2013 06:20 PM, H. S. Teoh wrote: On Wed, Mar 27, 2013 at 05:55:54PM +0100, Timon Gehr wrote: [...] If CTFE does not terminate, compilation is not allowed to succeed. Heh, I think this one is unimplementable, as it amounts to solving the halting problem. :) ... Actually it does not.

Re: CTFE is getting too powerful :o)

2013-03-27 Thread H. S. Teoh
On Wed, Mar 27, 2013 at 06:29:59PM +0100, Timon Gehr wrote: > On 03/27/2013 06:20 PM, H. S. Teoh wrote: > >On Wed, Mar 27, 2013 at 05:55:54PM +0100, Timon Gehr wrote: > >[...] > >>If CTFE does not terminate, compilation is not allowed to succeed. > > > >Heh, I think this one is unimplementable, as

Re: CTFE is getting too powerful :o)

2013-03-27 Thread deadalnix
On Wednesday, 27 March 2013 at 17:19:40 UTC, H. S. Teoh wrote: On Wed, Mar 27, 2013 at 10:48:31AM -0400, Andrei Alexandrescu wrote: Found this: http://stackoverflow.com/questions/15652718/object-error-access-violation-when-printing-result-of-std-algorithm-cartesianpr IMO, this is a compiler bu

Re: CTFE is getting too powerful :o)

2013-03-27 Thread Andrei Alexandrescu
On 3/27/13 1:17 PM, H. S. Teoh wrote: On Wed, Mar 27, 2013 at 10:48:31AM -0400, Andrei Alexandrescu wrote: Found this: http://stackoverflow.com/questions/15652718/object-error-access-violation-when-printing-result-of-std-algorithm-cartesianpr IMO, this is a compiler bug. If the compiler can't

Re: CTFE is getting too powerful :o)

2013-03-27 Thread Peter Alexander
On Wednesday, 27 March 2013 at 14:48:32 UTC, Andrei Alexandrescu wrote: Found this: http://stackoverflow.com/questions/15652718/object-error-access-violation-when-printing-result-of-std-algorithm-cartesianpr Soon we'll need to clearly define the limits of CTFE, and what happens when it fails.

Re: CTFE is getting too powerful :o)

2013-03-27 Thread Dmitry Olshansky
27-Mar-2013 23:14, Peter Alexander пишет: On Wednesday, 27 March 2013 at 14:48:32 UTC, Andrei Alexandrescu wrote: Found this: http://stackoverflow.com/questions/15652718/object-error-access-violation-when-printing-result-of-std-algorithm-cartesianpr Soon we'll need to clearly define the limits

Re: CTFE is getting too powerful :o)

2013-03-27 Thread Nick Sabalausky
On Wed, 27 Mar 2013 23:43:07 +0400 Dmitry Olshansky wrote: > 27-Mar-2013 23:14, Peter Alexander пишет: > > On Wednesday, 27 March 2013 at 14:48:32 UTC, Andrei Alexandrescu > > wrote: > >> Found this: > >> http://stackoverflow.com/questions/15652718/object-error-access-violation-when-printing-resu

Re: CTFE is getting too powerful :o)

2013-03-27 Thread Dmitry Olshansky
27-Mar-2013 23:50, Nick Sabalausky пишет: On Wed, 27 Mar 2013 23:43:07 +0400 Dmitry Olshansky wrote: 27-Mar-2013 23:14, Peter Alexander пишет: On Wednesday, 27 March 2013 at 14:48:32 UTC, Andrei Alexandrescu wrote: Found this: http://stackoverflow.com/questions/15652718/object-error-access-v

Re: CTFE is getting too powerful :o)

2013-03-27 Thread Timon Gehr
On 03/27/2013 06:50 PM, H. S. Teoh wrote: On Wed, Mar 27, 2013 at 06:29:59PM +0100, Timon Gehr wrote: On 03/27/2013 06:20 PM, H. S. Teoh wrote: On Wed, Mar 27, 2013 at 05:55:54PM +0100, Timon Gehr wrote: [...] If CTFE does not terminate, compilation is not allowed to succeed. Heh, I think th

Re: CTFE is getting too powerful :o)

2013-03-27 Thread H. S. Teoh
On Wed, Mar 27, 2013 at 10:19:12PM +0100, Timon Gehr wrote: > On 03/27/2013 06:50 PM, H. S. Teoh wrote: > >On Wed, Mar 27, 2013 at 06:29:59PM +0100, Timon Gehr wrote: > >>On 03/27/2013 06:20 PM, H. S. Teoh wrote: > >>>On Wed, Mar 27, 2013 at 05:55:54PM +0100, Timon Gehr wrote: > >>>[...] > If C

Re: CTFE is getting too powerful :o)

2013-03-27 Thread Dmitry Olshansky
27-Mar-2013 21:50, H. S. Teoh пишет: On Wed, Mar 27, 2013 at 06:29:59PM +0100, Timon Gehr wrote: On 03/27/2013 06:20 PM, H. S. Teoh wrote: On Wed, Mar 27, 2013 at 05:55:54PM +0100, Timon Gehr wrote: [...] If CTFE does not terminate, compilation is not allowed to succeed. Heh, I think this on

Re: CTFE is getting too powerful :o)

2013-03-27 Thread Timon Gehr
On 03/27/2013 10:37 PM, H. S. Teoh wrote: On Wed, Mar 27, 2013 at 10:19:12PM +0100, Timon Gehr wrote: On 03/27/2013 06:50 PM, H. S. Teoh wrote: On Wed, Mar 27, 2013 at 06:29:59PM +0100, Timon Gehr wrote: On 03/27/2013 06:20 PM, H. S. Teoh wrote: On Wed, Mar 27, 2013 at 05:55:54PM +0100, Timon

Re: CTFE is getting too powerful :o)

2013-03-27 Thread Timon Gehr
On 03/27/2013 05:55 PM, Timon Gehr wrote: ... - No mutable variables/fields are loaded or stored that were not allocated during the same CTFE execution. ... On second thought, probably loading of the value of initialized mutable static variables should be allowed, so that it is easy to

Re: CTFE is getting too powerful :o)

2013-03-27 Thread Timon Gehr
On 03/27/2013 05:55 PM, Timon Gehr wrote: ... - Only type casts are evaluated whose kind may not harm type safety. ... This could easily be lifted as well by doing a more "runtime" checks (in such a way that there is no additional overhead for the interpreter except when there is an out-of

Re: CTFE is getting too powerful :o)

2013-03-28 Thread Don
On Wednesday, 27 March 2013 at 19:43:13 UTC, Dmitry Olshansky wrote: 27-Mar-2013 23:14, Peter Alexander пишет: On Wednesday, 27 March 2013 at 14:48:32 UTC, Andrei Alexandrescu wrote: Found this: http://stackoverflow.com/questions/15652718/object-error-access-violation-when-printing-result-of-st