digitalmars.D - Today's weird D edge case
- Ethan (4/4) Jul 13 2019 https://run.dlang.io/is/l5Vyn4
- Ethan (3/7) Jul 13 2019 https://run.dlang.io/is/rR5UCA
- Les De Ridder (8/16) Jul 14 2019 I realise this doesn't work for all template constraints, but for
- Basile B. (3/21) Jul 14 2019 took note of the ICE :
- Petar Kirov [ZombineDev] (4/8) Jul 14 2019 I hit the exact same limitation yesterday. It turns out it is a
- Walter Bright (12/17) Jul 14 2019 URLs to those sand boxes tend to be ephemeral. Much better to just quote...
https://run.dlang.io/is/l5Vyn4 Using an is statement inside a template constraint doesn't propagate the is results in to a function. You have to static if with the same is statement to make it work.
Jul 13 2019
On Sunday, 14 July 2019 at 00:22:10 UTC, Ethan wrote:https://run.dlang.io/is/l5Vyn4 Using an is statement inside a template constraint doesn't propagate the is results in to a function. You have to static if with the same is statement to make it work.https://run.dlang.io/is/rR5UCA And now with the full example. Derp.
Jul 13 2019
On Sunday, 14 July 2019 at 00:23:49 UTC, Ethan wrote:On Sunday, 14 July 2019 at 00:22:10 UTC, Ethan wrote:I realise this doesn't work for all template constraints, but for some cases there's a workaround using normal type specialisation. ... and as I was about to show it, I hit an ICE (goes away when you uncomment the second line in the !compiles): https://run.dlang.io/is/aWkOOohttps://run.dlang.io/is/l5Vyn4 Using an is statement inside a template constraint doesn't propagate the is results in to a function. You have to static if with the same is statement to make it work.https://run.dlang.io/is/rR5UCA And now with the full example. Derp.
Jul 14 2019
On Sunday, 14 July 2019 at 19:58:20 UTC, Les De Ridder wrote:On Sunday, 14 July 2019 at 00:23:49 UTC, Ethan wrote:took note of the ICE : https://issues.dlang.org/show_bug.cgi?id=20051On Sunday, 14 July 2019 at 00:22:10 UTC, Ethan wrote:I realise this doesn't work for all template constraints, but for some cases there's a workaround using normal type specialisation. ... and as I was about to show it, I hit an ICE (goes away when you uncomment the second line in the !compiles): https://run.dlang.io/is/aWkOOohttps://run.dlang.io/is/l5Vyn4 Using an is statement inside a template constraint doesn't propagate the is results in to a function. You have to static if with the same is statement to make it work.https://run.dlang.io/is/rR5UCA And now with the full example. Derp.
Jul 14 2019
On Sunday, 14 July 2019 at 00:22:10 UTC, Ethan wrote:https://run.dlang.io/is/l5Vyn4 Using an is statement inside a template constraint doesn't propagate the is results in to a function. You have to static if with the same is statement to make it work.I hit the exact same limitation yesterday. It turns out it is a known thing from 2011: https://issues.dlang.org/show_bug.cgi?id=6269
Jul 14 2019
On 7/13/2019 5:22 PM, Ethan wrote:https://run.dlang.io/is/l5Vyn4 Using an is statement inside a template constraint doesn't propagate the is results in to a function. You have to static if with the same is statement to make it work.URLs to those sand boxes tend to be ephemeral. Much better to just quote the text in the email, like this: import std.stdio; string SomeFunc( T )() if( is( T : AT[], AT ) ) { return AT.stringof; } void main() { writeln(SomeFunc!( int[] )); }
Jul 14 2019
On Sunday, 14 July 2019 at 23:10:33 UTC, Walter Bright wrote:On 7/13/2019 5:22 PM, Ethan wrote:I think that's an opinion. Since I use the web interface mainly then it's much more convenient to me at least that there is a link I can just click and run the example instead of having to copy-paste it.https://run.dlang.io/is/l5Vyn4 Using an is statement inside a template constraint doesn't propagate the is results in to a function. You have to static if with the same is statement to make it work.URLs to those sand boxes tend to be ephemeral. Much better to just quote the text in the email, like this: import std.stdio; string SomeFunc( T )() if( is( T : AT[], AT ) ) { return AT.stringof; } void main() { writeln(SomeFunc!( int[] )); }
Jul 16 2019
On Tuesday, 16 July 2019 at 14:09:05 UTC, bauss wrote:I think that's an opinion. Since I use the web interface mainly then it's much more convenient to me at least that there is a link I can just click and run the example instead of having to copy-paste it.That's not at all what Walter meant by saying it's ephemeral. His point is that when reading this thread in a year, the link may have expired. Thus, the correct solution is to paste the code and provide the link for convenience.
Jul 17 2019