Re: dip1000 return scope dmd v 2.100

2022-05-07 Thread vit via Digitalmars-d-learn
On Friday, 6 May 2022 at 17:17:01 UTC, Dennis wrote: On Friday, 6 May 2022 at 09:24:06 UTC, vit wrote: [...] They were recently updated to match the implementation in 2.100. [...] `return scope` means pointer members (such `this.ptr`, `C.ptr`) may not escape the function, unless they are

Compile delegate with enum into proper function?

2022-05-07 Thread jmh530 via Digitalmars-d-learn
In the code below, there is a two parameter function `foo` and an override of it with only one parameter. In the override case, I force the second one to be 1, but ideally there should be a way to specify it at compile-time. It would be kind of nice to be able to do it with an enum and a

Re: Compile delegate with enum into proper function?

2022-05-07 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 7 May 2022 at 18:36:40 UTC, jmh530 wrote: In the code below, there is a two parameter function `foo` and an override of it with only one parameter. In the override case, I force the second one to be 1, but ideally there should be a way to specify it at compile-time. Have you

Re: Compile delegate with enum into proper function?

2022-05-07 Thread jmh530 via Digitalmars-d-learn
On Saturday, 7 May 2022 at 18:46:03 UTC, Paul Backus wrote: On Saturday, 7 May 2022 at 18:36:40 UTC, jmh530 wrote: In the code below, there is a two parameter function `foo` and an override of it with only one parameter. In the override case, I force the second one to be 1, but ideally there

Re: Compile delegate with enum into proper function?

2022-05-07 Thread Tejas via Digitalmars-d-learn
On Sunday, 8 May 2022 at 01:38:55 UTC, jmh530 wrote: On Saturday, 7 May 2022 at 23:30:37 UTC, Paul Backus wrote: [snip] Worth noting that you *can* write ```d alias foo = partial!(foo, a); ``` ...which will add the partially-applied version to `foo`'s overload set. You sure about that?

Re: Compile delegate with enum into proper function?

2022-05-07 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 7 May 2022 at 20:24:39 UTC, jmh530 wrote: On Saturday, 7 May 2022 at 18:46:03 UTC, Paul Backus wrote: ```d import std.functional: partial; enum int a = 1; alias foo2 = partial!(foo, a); ``` [snip] Thanks. This is basically equivalent to ```d int foo(int a)(int x) { return x +

Re: Compile delegate with enum into proper function?

2022-05-07 Thread jmh530 via Digitalmars-d-learn
On Saturday, 7 May 2022 at 23:30:37 UTC, Paul Backus wrote: [snip] Worth noting that you *can* write ```d alias foo = partial!(foo, a); ``` ...which will add the partially-applied version to `foo`'s overload set. You sure about that? Below fails to compile on godbolt with ldc 1.27.1 [1].