Is instantiabilty of templated types decidable?
David Nadlinger
see at klickverbot.at
Sun Nov 11 04:43:12 PST 2012
On Sunday, 11 November 2012 at 12:33:25 UTC, Manfred Nowak wrote:
> a) Instantiability is decidable
> Why does the compiler stop with the evaluation at that randomly
> choosen and apparently hard coded value of 500 recursive
> expansions?
You are right, it is just an arbitrary limit, but useful to give
the user at least somewhat useful diagnostics instead of just
hitting a stack overflow eventually.
> b) Instantiability is not decidable
> Why does the compiler even try to instantiate more than the
> indeed needed type `Elem!0'?
The other types _are_ needed to be known (e.g. for TypeInfo
generation, and generally because the fields are always typed
internally). You might be confusing this with knowing the _size_
of Elem!(n + 1) when calculating the size of Elem!(n) due to the
recent discussion, which is indeed not necessary.
David
More information about the Digitalmars-d
mailing list