Jump to page: 1 2
Thread overview
[Issue 17934] [scope] scopeness entrypoint for unique/ref-counted missing
Oct 24, 2017
Martin Nowak
Oct 27, 2017
Walter Bright
Nov 04, 2017
Walter Bright
Jun 18, 2018
Walter Bright
Jun 18, 2018
Walter Bright
Aug 31, 2018
Mike Franklin
Mar 30, 2022
Dlang Bot
Mar 30, 2022
Nick Treleaven
Mar 31, 2022
Dlang Bot
Dec 17, 2022
Iain Buclaw
May 29, 2023
Paul Backus
May 31, 2023
Nick Treleaven
May 31, 2023
Dlang Bot
Jul 14
Dlang Bot
October 24, 2017
https://issues.dlang.org/show_bug.cgi?id=17934

--- Comment #1 from Martin Nowak <code@dawg.eu> ---
Even if `l` is not inferred as scope, it should be a local with limited
lifetime.
The return value `l.front` should have that same lifetime b/c of `return
scope`.
Both of them should be shorter as `elem`, hence assignment should fail.

--
October 27, 2017
https://issues.dlang.org/show_bug.cgi?id=17934

--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> ---
It sounds like the solution is to infer 'scope' for a struct instance on the stack if it has a destructor.

--
November 04, 2017
https://issues.dlang.org/show_bug.cgi?id=17934

--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> ---
https://github.com/dlang/dmd/pull/7284

--
November 10, 2017
https://issues.dlang.org/show_bug.cgi?id=17934

--- Comment #4 from github-bugzilla@puremagic.com ---
Commit pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/18ad1685dcdca65070f7a1d89efa4410a5936895 fix Issue 17934 - [scope] scopeness entrypoint for unique/ref-counted missing

--
November 10, 2017
https://issues.dlang.org/show_bug.cgi?id=17934

github-bugzilla@puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--
December 18, 2017
https://issues.dlang.org/show_bug.cgi?id=17934

--- Comment #5 from github-bugzilla@puremagic.com ---
Commit pushed to stable at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/18ad1685dcdca65070f7a1d89efa4410a5936895 fix Issue 17934 - [scope] scopeness entrypoint for unique/ref-counted missing

--
June 18, 2018
https://issues.dlang.org/show_bug.cgi?id=17934

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--
June 18, 2018
https://issues.dlang.org/show_bug.cgi?id=17934

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

--- Comment #6 from Walter Bright <bugzilla@digitalmars.com> ---
New fix:

https://github.com/dlang/dmd/pull/8369

done by adding 'scope' to struct declaration.

--
August 31, 2018
https://issues.dlang.org/show_bug.cgi?id=17934

Mike Franklin <slavo5150@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |slavo5150@yahoo.com

--- Comment #7 from Mike Franklin <slavo5150@yahoo.com> ---
(In reply to Martin Nowak from comment #0)

> /**
>   There seems to be now way to write this functions so
>   that the compiler infers the return value as scope.
>  */
> List list() @trusted
> {
>     return List(malloc(1));
> }
> 
> void test() @safe
> {
>     Elem elem;
>     {
>         //scope l = list(); // works with explicit scope
>         auto l = list(); // not inferred as scope
>         elem = l.front; // escapes, b/c l isn't scoped
>     }
> }

Why does `scope` need to be inferred?  What's wrong with the user being required to attribute `scope` to the declaration.

What about having `scope` apply to return values of functions, so `list()`
could be written as `scope List list() @trusted`?

--
March 30, 2022
https://issues.dlang.org/show_bug.cgi?id=17934

--- Comment #8 from Dlang Bot <dlang-bot@dlang.rocks> ---
@dkorpel created dlang/dmd pull request #13926 "Revert "fix Issue 17934 - [scope] scopeness entrypoint for unique/ref…" mentioning this issue:

- Revert "fix Issue 17934 - [scope] scopeness entrypoint for unique/ref-counted missing"

  This reverts commit 18ad1685dcdca65070f7a1d89efa4410a5936895.

https://github.com/dlang/dmd/pull/13926

--
« First   ‹ Prev
1 2