Pure Factory Functions 💔 `inout`
ag0aep6g
anonymous at example.com
Fri Feb 10 16:27:59 UTC 2023
On Friday, 10 February 2023 at 15:23:04 UTC, Kagamin wrote:
> This doesn't work:
>
> ```d
> struct A
> {
> const int[] a;
> }
> pure A a(const int[] b)
> {
> return A(b);
> }
> void e()
> {
> int[] b;
> immutable A c=a(b);
> }
> ```
The spec currently says that the result of a pure factory
function "has mutable indirections". It should probably say that
the result "has *only* mutable indirections".
Then it would be clear that `a` is not a pure factory function.
More information about the Digitalmars-d
mailing list