Thread overview | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
September 07, 2022 [Issue 13732] Regular templates can use "template this", and they allow any type to be passed | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13732 Nick Treleaven <nick@geany.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nick@geany.org --- Comment #1 from Nick Treleaven <nick@geany.org> --- What's the advantage over a normal template type parameter? -- |
September 09, 2022 [Issue 13732] Regular templates can use "template this", and they allow any type to be passed | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13732 --- Comment #2 from Meta <monkeyworks12@hotmail.com> --- import std.stdio; class Base { void test1(T = typeof(this))() { writeln("test1: ", T.stringof); } void test2(this T)() { writeln("test2: ", T.stringof); } } class Derived: Base { } void main() { new Base().test1(); //test1: Base new Base().test2(); //test2: Base new Derived().test1(); //test1: Base new Derived().test2(); //test1: Derived } -- |
September 09, 2022 [Issue 13732] Regular templates can use "template this", and they allow any type to be passed | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13732 --- Comment #3 from Nick Treleaven <nick@geany.org> --- Isn't comment 2 what we have already? The title says 'allow any type to be passed' and the example uses int. -- |
September 09, 2022 [Issue 13732] Regular templates can use "template this", and they allow any type to be passed | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13732 --- Comment #4 from Meta <monkeyworks12@hotmail.com> --- > Isn't comment 2 what we have already? Ya, I created this issue because any template allows you to use the `this T` syntax, and it will accept any type (which seemed like a bug at the time). I still think it's confusing, and it does nothing in a template that's not nested in an aggregate, but might not necessarily be behaviour that needs to be fixed. -- |
September 09, 2022 [Issue 13732] Regular templates can use "template this", and they allow any type to be passed | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13732 --- Comment #5 from Nick Treleaven <nick@geany.org> --- Oh I see, it should only be allowed for methods. -- |
September 14, 2022 [Issue 13732] Regular templates can use "template this", and they allow any type to be passed | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13732 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> --- @ntrel created dlang/dmd pull request #14434 "Fix Issue 13732 - non-member templates can use "template this"" fixing this issue: - Fix Issue 13732 - non-member templates can use "template this" https://github.com/dlang/dmd/pull/14434 -- |
September 16, 2022 [Issue 13732] Regular templates can use "template this", and they allow any type to be passed | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13732 --- Comment #7 from Dlang Bot <dlang-bot@dlang.rocks> --- @ntrel created dlang/dmd pull request #14447 "Fix Issue 13732 - non-member templates can use "template this"" fixing this issue: - Fix Issue 13732 - non-member templates can use "template this" Error if a TemplateThisParameter is declared where `typeof(this)` would be an error. Error if a TemplateThisParameter is passed a type that doesn't convert to `const typeof(this)`. Note: This is done with a dummy specialization, which causes the correct semantic error messages even for mixin and may be more efficient than checking this in dtemplate.d. https://github.com/dlang/dmd/pull/14447 -- |
October 04, 2022 [Issue 13732] Regular templates can use "template this", and they allow any type to be passed | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13732 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #8 from Dlang Bot <dlang-bot@dlang.rocks> --- dlang/dmd pull request #14434 "Fix Issue 13732 - non-member templates can use "template this"" was merged into master: - c22f40bb47b98a0a18ffca0a6766047e81784d35 by Nick Treleaven: Fix Issue 13732 - non-member templates can use "template this" https://github.com/dlang/dmd/pull/14434 -- |
Copyright © 1999-2021 by the D Language Foundation