digitalmars.D - newCTFE report July
- Stefan Koch (24/24) Jul 18 2018 Hi Guys, last month I did the work make this snippet compile and
- H. S. Teoh (7/7) Jul 18 2018 On Wed, Jul 18, 2018 at 06:28:30PM +0000, Stefan Koch via Digitalmars-d ...
- Stefan Koch (3/9) Jul 18 2018 I am going to give the same conservative answer I gave a Dconf:
- H. S. Teoh (7/10) Jul 18 2018 [...]
- =?UTF-8?Q?Ali_=c3=87ehreli?= (5/9) Jul 18 2018 Without knowing much about the compiler, could that be solved by
Hi Guys, last month I did the work make this snippet compile and execute correctly: static immutable four = [1, 2, 3, 4]; int fn(int idx = 2) { int fn2(const int* x) { return x[idx]; } return fn2(&four[0]) + *(&four[0]); } static assert(fn() == 4); There where two major problems with this one. 1. There was the circular initialization-detected which would object to referencing `&four` twice in the same expression. 2. there was the problem of the IndexExp being unaware of being inside an AddrExp which would cause it to first evaluate four[0] to 1, and then trying to take the address of literal one (which is zero as the marker for an invalid address). Fixing this involved adding a special case to how &x[y] is handled. This solution does complicate the internals of newCTFE a bit, and I hope to simplify it once other blocking problems are out of the way.
Jul 18 2018
On Wed, Jul 18, 2018 at 06:28:30PM +0000, Stefan Koch via Digitalmars-d wrote: [...] Good to hear that progress on newCTFE is still being made. What's your current estimate on when it will be production-ready? T -- Democracy: The triumph of popularity over principle. -- C.Bond
Jul 18 2018
On Wednesday, 18 July 2018 at 18:36:37 UTC, H. S. Teoh wrote:On Wed, Jul 18, 2018 at 06:28:30PM +0000, Stefan Koch via Digitalmars-d wrote: [...] Good to hear that progress on newCTFE is still being made. What's your current estimate on when it will be production-ready? TI am going to give the same conservative answer I gave a Dconf: 2020
Jul 18 2018
On Wed, Jul 18, 2018 at 07:18:52PM +0000, Stefan Koch via Digitalmars-d wrote:On Wednesday, 18 July 2018 at 18:36:37 UTC, H. S. Teoh wrote:[...][...]What's your current estimate on when it will be production-ready?I am going to give the same conservative answer I gave a Dconf: 2020Can't wait for 2020 to arrive! :-D T -- Doubt is a self-fulfilling prophecy.
Jul 18 2018
On 07/18/2018 11:28 AM, Stefan Koch wrote:2. there was the problem of the IndexExp being unaware of being inside an AddrExp which would cause it to first evaluate four[0] to 1, and then trying to take the address of literal one (which is zero as the marker for an invalid address).Without knowing much about the compiler, could that be solved by changing four[0] to a reference expression? Is there even such a concept in the compiler? How does the non-CTFE compilation deal with that case? Ali
Jul 18 2018