Possible bug when instantiating template function with nested struct
Alexandru Ermicioi
alexandru.ermicioi at gmail.com
Sun Nov 7 14:38:14 UTC 2021
On Sunday, 7 November 2021 at 14:08:32 UTC, Basile B. wrote:
>
> - `.length` and `.ptr` becomes functions calls.
> - things like `.length++` is not really supported, you have to
> make a `Length` struct for that
That would make sense, since even right now .length is not just a
simple number, otherwise, you wouldn't be able change the size of
an array (i.e. allocate more memory).
> - implicit conversions, templates constraints, would lead to
> plenty of templates instances (things like `if (is(T == U[]))`
> would require to instantiate `U[]` right ?)
No idea about it being instantiated in is template. Are templates
instantiated when doing is expression checks? Question to people
knowledgeable about this.
> - dynamic arrays are part of the type system, being `TypeNext`
> derived they share common methods with pointers and static
> arrays.
That would be a breaking change, if the struct is not treated
specially by compiler (i.e. compiler replacing the type).
> - the internal type is still required (or plenty of special
> cases) so that for example errors message display the type
> representation correctly and not as lowered.
So perhaps the internal type could then be a wrapper over struct
one? Could that solve the issue with internal representation, and
perhaps the type system (previous statement)?
> - CTFE must use the new struct template too?
What do you mean by that?
> - apparently (recently read that elsewhere) control of the
> bound checks cannot be based on `version`
Why can't they?
More information about the Digitalmars-d
mailing list