[Issue 15862] Functions that return types with mutable indirections should be weakly pure, not strongly pure

2022-07-18 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15862

--- Comment #18 from Dlang Bot  ---
dlang/phobos pull request #8509 "Remove uses of 'in' on extern(C) functions"
was merged into master:

- 501a3ab35a7b6f826fbf08f3f5eb2bcc96b71202 by Geod24:
  std.typecons: Remove workaround for fixed issue 15862

https://github.com/dlang/phobos/pull/8509

--


[Issue 15862] Functions that return types with mutable indirections should be weakly pure, not strongly pure

2017-01-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15862

--- Comment #17 from github-bugzi...@puremagic.com ---
Commits pushed to stable at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/4dfc9e9252220ef724412a74b3a8caf862d0a95e
fix Issue 15862 - allocating storage in pure functions should not result in
caching return values of them

https://github.com/dlang/dmd/commit/ab9d712ad6b6a2f59e1e4427bf1627968fc65c8c
Merge pull request #6197 from WalterBright/fix15862

--


[Issue 15862] Functions that return types with mutable indirections should be weakly pure, not strongly pure

2016-11-04 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15862

--- Comment #16 from github-bugzi...@puremagic.com ---
Commits pushed to newCTFE at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/4dfc9e9252220ef724412a74b3a8caf862d0a95e
fix Issue 15862 - allocating storage in pure functions should not result in
caching return values of them

https://github.com/dlang/dmd/commit/ab9d712ad6b6a2f59e1e4427bf1627968fc65c8c
Merge pull request #6197 from WalterBright/fix15862

--


[Issue 15862] Functions that return types with mutable indirections should be weakly pure, not strongly pure

2016-11-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15862

--- Comment #15 from github-bugzi...@puremagic.com ---
Commits pushed to scope at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/4dfc9e9252220ef724412a74b3a8caf862d0a95e
fix Issue 15862 - allocating storage in pure functions should not result in
caching return values of them

https://github.com/dlang/dmd/commit/ab9d712ad6b6a2f59e1e4427bf1627968fc65c8c
Merge pull request #6197 from WalterBright/fix15862

--


[Issue 15862] Functions that return types with mutable indirections should be weakly pure, not strongly pure

2016-10-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15862

github-bugzi...@puremagic.com changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |FIXED

--


[Issue 15862] Functions that return types with mutable indirections should be weakly pure, not strongly pure

2016-10-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15862

--- Comment #14 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/4dfc9e9252220ef724412a74b3a8caf862d0a95e
fix Issue 15862 - allocating storage in pure functions should not result in
caching return values of them

https://github.com/dlang/dmd/commit/ab9d712ad6b6a2f59e1e4427bf1627968fc65c8c
Merge pull request #6197 from WalterBright/fix15862

fix Issue 15862 - allocating storage in pure functions should not res…

--


[Issue 15862] Functions that return types with mutable indirections should be weakly pure, not strongly pure

2016-10-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15862

ZombineDev  changed:

   What|Removed |Added

 CC||petar.p.ki...@gmail.com

--


[Issue 15862] Functions that return types with mutable indirections should be weakly pure, not strongly pure

2016-10-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15862

--- Comment #13 from Andrei Alexandrescu  ---
(In reply to Walter Bright from comment #12)
> (In reply to Walter Bright from comment #11)
> > https://github.com/dlang/dmd/pull/6197
> 
> I did this before the other comments were posted. Have to think about this
> some more based on those comments.

Thanks for working on this. It seems we're getting close.

--


[Issue 15862] Functions that return types with mutable indirections should be weakly pure, not strongly pure

2016-10-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15862

--- Comment #12 from Walter Bright  ---
(In reply to Walter Bright from comment #11)
> https://github.com/dlang/dmd/pull/6197

I did this before the other comments were posted. Have to think about this some
more based on those comments.

--


[Issue 15862] Functions that return types with mutable indirections should be weakly pure, not strongly pure

2016-10-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15862

--- Comment #11 from Walter Bright  ---
https://github.com/dlang/dmd/pull/6197

--


[Issue 15862] Functions that return types with mutable indirections should be weakly pure, not strongly pure

2016-10-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15862

--- Comment #10 from ag0ae...@gmail.com ---
(In reply to Walter Bright from comment #7)
> Yeah, my mistake. The compiler should consider @nogc when marking a pure
> function as a common subexpression.

I think approaching this with @nogc would be a mistake. Considering mutable
indirections in the return type seems superior to me.

You can have a function that allocates via the GC but doesn't return any
mutable indirections. Either it allocates for internal use only, or it casts to
immutable when returning. You can reuse the result of such a function for
another identical call.

I'm only rehashing David Nadlinger's article on this matter, of course.
http://klickverbot.at/blog/2012/05/purity-in-d/

Considering the indirections in the return type would also leave the door open
for other allocators to be used in `pure` code. Tying this to @nogc would only
add to the arbitrary divide between the GC and others. As far as I see, the GC
isn't actually more pure than other allocators, it's just recognized by the
language which makes it seem natural to special case it.

--


[Issue 15862] Functions that return types with mutable indirections should be weakly pure, not strongly pure

2016-10-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15862

--- Comment #9 from Andrei Alexandrescu  ---
(In reply to Walter Bright from comment #7)
> Yeah, my mistake. The compiler should consider @nogc when marking a pure
> function as a common subexpression.

Nononononono, @nogc has nothing to do with it. Think malloc and allocators. The
compiler should consider functions that return data with mutable indirections
weakly pure, regardless. Then they won't be subject to CSE and everything will
work well.

--


[Issue 15862] Functions that return types with mutable indirections should be weakly pure, not strongly pure

2016-10-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15862

Andrei Alexandrescu  changed:

   What|Removed |Added

Summary|allocating storage in pure  |Functions that return types
   |functions should not result |with mutable indirections
   |in caching return values of |should be weakly pure, not
   |them|strongly pure

--