Re: `recursive template expansion` error msg isn't informative

2018-05-08 Thread drug via Digitalmars-d-learn
07.05.2018 17:22, Timoses пишет: On Monday, 7 May 2018 at 10:28:14 UTC, drug wrote: I get the error like: ``` ./foo/bar/baz/builder.d(57,23): Error: template instance `staticMap!(DebugTypeMapper, BaseDebuggerTypes)` recursive template expansion ``` That's all. It doesn's print instantiations

Re: `recursive template expansion` error msg isn't informative

2018-05-07 Thread Timoses via Digitalmars-d-learn
On Monday, 7 May 2018 at 10:28:14 UTC, drug wrote: I get the error like: ``` ./foo/bar/baz/builder.d(57,23): Error: template instance `staticMap!(DebugTypeMapper, BaseDebuggerTypes)` recursive template expansion ``` That's all. It doesn's print instantiations stack so I can't track back the r

Re: recursive template expansion: Why does this not compile?

2018-03-22 Thread Ontonator via Digitalmars-d-learn
On Wednesday, 21 March 2018 at 23:05:22 UTC, Jonathan M Davis wrote: On Wednesday, March 21, 2018 22:50:32 Ontonator via Digitalmars-d-learn wrote: On Wednesday, 21 March 2018 at 06:39:22 UTC, ag0aep6g wrote: > On 03/21/2018 01:47 AM, Ontonator wrote: >> The following code does not compile: >>>

Re: recursive template expansion: Why does this not compile?

2018-03-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, March 21, 2018 22:50:32 Ontonator via Digitalmars-d-learn wrote: > On Wednesday, 21 March 2018 at 06:39:22 UTC, ag0aep6g wrote: > > On 03/21/2018 01:47 AM, Ontonator wrote: > >> The following code does not compile: > >>> [...] > >> > >> It gives the error: > >>> [...] > >> > >> The a

Re: recursive template expansion: Why does this not compile?

2018-03-21 Thread Ontonator via Digitalmars-d-learn
On Wednesday, 21 March 2018 at 06:39:22 UTC, ag0aep6g wrote: On 03/21/2018 01:47 AM, Ontonator wrote: The following code does not compile: [...] It gives the error: [...] The aliases do not have to be aliases, as long as there is some reference to the class (e.g. method and variable decl

Re: recursive template expansion: Why does this not compile?

2018-03-20 Thread ag0aep6g via Digitalmars-d-learn
On 03/21/2018 01:47 AM, Ontonator wrote: The following code does not compile: void main() {} class SuperClass {} class TemplatedClass(T : SuperClass) {} class A : SuperClass {     alias T = TemplatedClass!B; } class B : SuperClass {     alias T = TemplatedClass!C; } class C : SuperClass {}

Re: recursive template expansion: Why does this not compile?

2018-03-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, March 21, 2018 00:47:18 Ontonator via Digitalmars-d-learn wrote: > The following code does not compile: > > void main() {} > > > > class SuperClass {} > > > > class TemplatedClass(T : SuperClass) {} > > > > class A : SuperClass { > > > > alias T = TemplatedClass!B; > > > > } > >

Re: Recursive template instantiation

2017-03-13 Thread ag0aep6g via Digitalmars-d-learn
On 03/13/2017 11:58 PM, Stefan Koch wrote: On Monday, 13 March 2017 at 22:05:24 UTC, Jack Applegame wrote: Is this a bug? No it's not struct C { B!C; } is an error. Howto compute C ? <--\ let's check the members; | The member needs a template. | Howto compute the template

Re: Recursive template instantiation

2017-03-13 Thread ag0aep6g via Digitalmars-d-learn
On 03/14/2017 12:02 AM, Stefan Koch wrote: On Monday, 13 March 2017 at 22:59:36 UTC, ag0aep6g wrote: [...] struct A(T) { void m() { char[T.sizeof] data; } } /* ... rest as above ... */ I don't see how the destructor makes a difference. Soo, bug? Try to use m. Work

Re: Recursive template instantiation

2017-03-13 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 13 March 2017 at 22:59:36 UTC, ag0aep6g wrote: On 03/13/2017 03:26 PM, Jack Applegame wrote: I'm pretty sure that this code should compile (https://dpaste.dzfl.pl/cf1e1ee6ef4b): struct A(T) { ~this() { char[T.sizeof] data; } } struct B(T) { A!T foo; } struct C {

Re: Recursive template instantiation

2017-03-13 Thread ag0aep6g via Digitalmars-d-learn
On 03/13/2017 03:26 PM, Jack Applegame wrote: I'm pretty sure that this code should compile (https://dpaste.dzfl.pl/cf1e1ee6ef4b): struct A(T) { ~this() { char[T.sizeof] data; } } struct B(T) { A!T foo; } struct C { B!C bar; } void main() { C c; } But it doesn't:

Re: Recursive template instantiation

2017-03-13 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 13 March 2017 at 22:05:24 UTC, Jack Applegame wrote: Is this a bug? No it's not struct C { B!C; } is an error. Howto compute C ? <--\ let's check the members; | The member needs a template. | Howto compute the template ? | let's compute the parameters. | What

Re: Recursive template instantiation

2017-03-13 Thread Jack Applegame via Digitalmars-d-learn
Is this a bug?

Re: Recursive template

2014-11-15 Thread Chris Nicholson-Sauls via Digitalmars-d-learn
Slightly simpler: struct SomeType(K, V) {} alias X(V) = V; alias X(V, K...) = SomeType!(K[0], X!(V, K[1 .. $])); That's a recurring pattern to get used to: aliasing away to one of the parameters in a terminal and/or degenerate case. Also: that an empty tuple matches no parameter "m

Re: Recursive template

2014-11-15 Thread Eric via Digitalmars-d-learn
Thanks! -Eric On Saturday, 15 November 2014 at 18:49:32 UTC, anonymous wrote: On Saturday, 15 November 2014 at 18:30:00 UTC, Eric wrote: Hi - I've never designed a recursive template before, but I think that would solve my problem. What I would like is someting like this: class X(V, K...)

Re: Recursive template

2014-11-15 Thread anonymous via Digitalmars-d-learn
On Saturday, 15 November 2014 at 18:30:00 UTC, Eric wrote: Hi - I've never designed a recursive template before, but I think that would solve my problem. What I would like is someting like this: class X(V, K...) { // I want to declare a type based on K and V such // that for X!(V, int,

Re: recursive template at ctfe

2013-11-26 Thread Shammah Chancellor
On 2013-11-26 21:31:55 +, bioinfornatics said: On Tuesday, 26 November 2013 at 21:18:29 UTC, Shammah Chancellor wrote: On 2013-11-26 21:00:56 +, bioinfornatics said: On Tuesday, 26 November 2013 at 20:50:13 UTC, bioinfornatics wrote: On Tuesday, 26 November 2013 at 20:29:00 UTC, bear

Re: recursive template at ctfe

2013-11-26 Thread bioinfornatics
On Tuesday, 26 November 2013 at 21:18:29 UTC, Shammah Chancellor wrote: On 2013-11-26 21:00:56 +, bioinfornatics said: On Tuesday, 26 November 2013 at 20:50:13 UTC, bioinfornatics wrote: On Tuesday, 26 November 2013 at 20:29:00 UTC, bearophile wrote: bioinfornatics: I wrote some template

Re: recursive template at ctfe

2013-11-26 Thread Shammah Chancellor
On 2013-11-26 21:00:56 +, bioinfornatics said: On Tuesday, 26 November 2013 at 20:50:13 UTC, bioinfornatics wrote: On Tuesday, 26 November 2013 at 20:29:00 UTC, bearophile wrote: bioinfornatics: I wrote some template to compute at compile time how many bits is need for a number x. http:/

Re: recursive template at ctfe

2013-11-26 Thread bioinfornatics
On Tuesday, 26 November 2013 at 20:50:13 UTC, bioinfornatics wrote: On Tuesday, 26 November 2013 at 20:29:00 UTC, bearophile wrote: bioinfornatics: I wrote some template to compute at compile time how many bits is need for a number x. http://www.dpaste.dzfl.pl/99a842fd That works for small

Re: recursive template at ctfe

2013-11-26 Thread bioinfornatics
On Tuesday, 26 November 2013 at 20:29:00 UTC, bearophile wrote: bioinfornatics: I wrote some template to compute at compile time how many bits is need for a number x. http://www.dpaste.dzfl.pl/99a842fd That works for small number but after i got an error about limit recursion Instead of te

Re: recursive template at ctfe

2013-11-26 Thread bearophile
bioinfornatics: I wrote some template to compute at compile time how many bits is need for a number x. http://www.dpaste.dzfl.pl/99a842fd That works for small number but after i got an error about limit recursion Instead of template recursion, have you tried regular code run at compile tim