www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - What was so crazy about IFTI for parent agregate via ctor call ?

reply user1234 <user1234 12.de> writes:
For reference it's the old DIP 40 [0] so a thing like

```d
struct IPersonallyPresentYouDip40(T)
{
     this(T t){}
}

void main()
{
     auto v = IPersonallyPresentYouDip40(0); // infer `int` for `T`
}
```

should work.

[0]: https://wiki.dlang.org/DIP40
Sep 30
next sibling parent reply Steven Schveighoffer <schveiguy gmail.com> writes:
On Monday, 30 September 2024 at 12:50:49 UTC, user1234 wrote:
 For reference it's the old DIP 40 [0] so a thing like

 ```d
 struct IPersonallyPresentYouDip40(T)
 {
     this(T t){}
 }

 void main()
 {
     auto v = IPersonallyPresentYouDip40(0); // infer `int` for 
 `T`
 }
 ```

 should work.
I've wanted this forever. https://issues.dlang.org/show_bug.cgi?id=6082 -Steve
Sep 30
next sibling parent reply Daniel N <no public.email> writes:
On Monday, 30 September 2024 at 15:15:54 UTC, Steven 
Schveighoffer wrote:
 On Monday, 30 September 2024 at 12:50:49 UTC, user1234 wrote:
 For reference it's the old DIP 40 [0] so a thing like

 ```d
 struct IPersonallyPresentYouDip40(T)
 {
     this(T t){}
 }

 void main()
 {
     auto v = IPersonallyPresentYouDip40(0); // infer `int` for 
 `T`
 }
 ```

 should work.
I've wanted this forever. https://issues.dlang.org/show_bug.cgi?id=6082 -Steve
C++17 got this already... D used to leave C++ in the dust. https://en.cppreference.com/w/cpp/language/class_template_argument_deduction Since they sorted it out in C++, many of the potential risks should already be understood.
Sep 30
parent user1234 <user1234 12.de> writes:
On Monday, 30 September 2024 at 15:20:59 UTC, Daniel N wrote:
 [...]
 C++17 got this already... D used to leave C++ in the dust.
 https://en.cppreference.com/w/cpp/language/class_template_argument_deduction

 Since they sorted it out in C++, many of the potential risks 
 should already be understood.
If any.
Oct 01
prev sibling parent user1234 <user1234 12.de> writes:
On Monday, 30 September 2024 at 15:15:54 UTC, Steven 
Schveighoffer wrote:
 On Monday, 30 September 2024 at 12:50:49 UTC, user1234 wrote:
 [...]
 I've wanted this forever.

 https://issues.dlang.org/show_bug.cgi?id=6082

 -Steve
That old ;) Can this ER be pre-approved ? It's a pure semantics change, plus for now it's an error. I dont think this error is ever involved during the rare time D does SFINAE. I think there's a real value added by this feature, many simplifications. I'm sure you (Steven) know that already but for the others: imagine that the `tuple()` function is not required anymore.
Oct 01
prev sibling parent reply Dennis <dkorpel gmail.com> writes:
On Monday, 30 September 2024 at 12:50:49 UTC, user1234 wrote:
 [0]: https://wiki.dlang.org/DIP40
Prototype implementation: https://github.com/dlang/dmd/pull/16910 It currently fails if it gets slightly more complicated than your example, but it works as a proof of concept.
Oct 02
parent user1234 <user1234 12.de> writes:
On Wednesday, 2 October 2024 at 15:35:40 UTC, Dennis wrote:
 On Monday, 30 September 2024 at 12:50:49 UTC, user1234 wrote:
 [0]: https://wiki.dlang.org/DIP40
Prototype implementation: https://github.com/dlang/dmd/pull/16910 It currently fails if it gets slightly more complicated than your example, but it works as a proof of concept.
Thnaks, that's a good news. Impressive also to see how simple the change finally is.
Oct 02