Re: DIP 1016 should use expression lowering, not statement lowering

2019-01-30 Thread Steven Schveighoffer via Digitalmars-d-announce
On 1/30/19 10:03 PM, Nicholas Wilson wrote: On Thursday, 31 January 2019 at 02:29:47 UTC, Steven Schveighoffer wrote: I came up with this idea based on tempCString, but it doesn't work: So I don't get why it doesn't work. But if that was fixed, could be a potential workaround without

Re: DIP 1016 should use expression lowering, not statement lowering

2019-01-30 Thread Nicholas Wilson via Digitalmars-d-announce
On Thursday, 31 January 2019 at 02:29:47 UTC, Steven Schveighoffer wrote: I came up with this idea based on tempCString, but it doesn't work: So I don't get why it doesn't work. But if that was fixed, could be a potential workaround without requiring a DIP. Thats nice! But it doesn't fix

Re: DIP 1016 should use expression lowering, not statement lowering

2019-01-30 Thread Steven Schveighoffer via Digitalmars-d-announce
On 1/29/19 6:52 AM, Andrei Alexandrescu wrote: While writing this example: int[] a = cast(int[]) alloc.allocate(100 * int.sizeof); if (alloc.reallocate(a, 200 * int.sizeof)) {     assert(a.length == 200); } => int[] a = cast(int[]) alloc.allocate(100 * int.sizeof); void[] __temp0 = a; if

Re: DIP 1016 should use expression lowering, not statement lowering

2019-01-30 Thread Andrei Alexandrescu via Digitalmars-d-announce
On 1/30/19 3:34 AM, Kagamin wrote: On Tuesday, 29 January 2019 at 11:52:40 UTC, Andrei Alexandrescu wrote: Where should the temporary go? Doesn't D already specify allocation and lifetime of temporaries? AIU the DIP doesn't invent the notion of a temporary. My bad, I overloaded the term

Re: DIP 1016 should use expression lowering, not statement lowering

2019-01-30 Thread Kagamin via Digitalmars-d-announce
On Tuesday, 29 January 2019 at 11:52:40 UTC, Andrei Alexandrescu wrote: Where should the temporary go? Doesn't D already specify allocation and lifetime of temporaries? AIU the DIP doesn't invent the notion of a temporary.

Re: DIP 1016 should use expression lowering, not statement lowering

2019-01-29 Thread Rubn via Digitalmars-d-announce
On Tuesday, 29 January 2019 at 15:44:02 UTC, Nicholas Wilson wrote: On Tuesday, 29 January 2019 at 11:52:40 UTC, Andrei Alexandrescu wrote: While writing this example: int[] a = cast(int[]) alloc.allocate(100 * int.sizeof); if (alloc.reallocate(a, 200 * int.sizeof)) { assert(a.length ==

Re: DIP 1016 should use expression lowering, not statement lowering

2019-01-29 Thread Andrei Alexandrescu via Digitalmars-d-announce
On 1/29/19 10:57 AM, Adam D. Ruppe wrote: On Tuesday, 29 January 2019 at 15:48:23 UTC, Andrei Alexandrescu wrote: On 1/29/19 10:44 AM, Nicholas Wilson wrote:   if (auto val = expr(); val) { ... }, Since we don't have these constructs, lowering would need to explain what happens here.

Re: DIP 1016 should use expression lowering, not statement lowering

2019-01-29 Thread Adam D. Ruppe via Digitalmars-d-announce
On Tuesday, 29 January 2019 at 15:48:23 UTC, Andrei Alexandrescu wrote: On 1/29/19 10:44 AM, Nicholas Wilson wrote:  if (auto val = expr(); val) { ... }, Since we don't have these constructs, lowering would need to explain what happens here. Nitpick, but D has something very similar to

Re: DIP 1016 should use expression lowering, not statement lowering

2019-01-29 Thread Andrei Alexandrescu via Digitalmars-d-announce
On 1/29/19 10:44 AM, Nicholas Wilson wrote: On Tuesday, 29 January 2019 at 11:52:40 UTC, Andrei Alexandrescu wrote: While writing this example: int[] a = cast(int[]) alloc.allocate(100 * int.sizeof); if (alloc.reallocate(a, 200 * int.sizeof)) {     assert(a.length == 200); } => int[] a =

Re: DIP 1016 should use expression lowering, not statement lowering

2019-01-29 Thread Nicholas Wilson via Digitalmars-d-announce
On Tuesday, 29 January 2019 at 11:52:40 UTC, Andrei Alexandrescu wrote: While writing this example: int[] a = cast(int[]) alloc.allocate(100 * int.sizeof); if (alloc.reallocate(a, 200 * int.sizeof)) { assert(a.length == 200); } => int[] a = cast(int[]) alloc.allocate(100 *