Jump to page: 1 2
Thread overview
[Issue 16037] assigning delegate to a scope variable shouldn't allocate closure
[Issue 16037] Closure allocation despite scope variable for ternary operator / CondExp
May 18, 2016
Sobirari Muhomori
May 19, 2016
Leandro Lucarella
Dec 12, 2016
Walter Bright
Jan 24, 2018
anonymous4
Jan 24, 2018
anonymous4
Mar 04, 2018
Walter Bright
Mar 04, 2018
Carsten Blüggel
Mar 09, 2018
anonymous4
Mar 09, 2018
Mathias Lang
Mar 20, 2018
anonymous4
Mar 20, 2018
anonymous4
Mar 20, 2018
Mathias Lang
Mar 21, 2018
anonymous4
Mar 30, 2018
anonymous4
Jun 06, 2018
anonymous4
Aug 16, 2018
anonymous4
Sep 01, 2022
Walter Bright
Nov 09, 2022
RazvanN
May 18, 2016
https://issues.dlang.org/show_bug.cgi?id=16037

--- Comment #1 from Sobirari Muhomori <dfj1esp02@sneakemail.com> ---
workaround?

T assumeScoped(T)(scope T t){ return t; }
void testXXX () @nogc
{
    Object o;
    scope bool delegate (Object) alwaysFalse = (Object y) { return false; };
    scope c1 = o !is null ? assumeScoped((Object y) { return o is y; }) :
alwaysFalse;
}

--
May 19, 2016
https://issues.dlang.org/show_bug.cgi?id=16037

Leandro Lucarella <leandro.lucarella@sociomantic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |leandro.lucarella@sociomant
                   |                            |ic.com

--
December 12, 2016
https://issues.dlang.org/show_bug.cgi?id=16037

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |safe
                 CC|                            |bugzilla@digitalmars.com

--
January 24, 2018
https://issues.dlang.org/show_bug.cgi?id=16037

anonymous4 <dfj1esp02@sneakemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|safe                        |performance
            Summary|Closure allocation despite  |assigning delegate to a
                   |scope variable for ternary  |scope variable shouldn't
                   |operator / CondExp          |allocate closure
           Severity|major                       |enhancement

--- Comment #2 from anonymous4 <dfj1esp02@sneakemail.com> ---
I've run into this myself :)
Simpler example:
---
void f() //@nogc
{
    int a;
    void g(){ a=1; }
    scope h=&g;
    h();
}
---
This shouldn't allocate closure because the delegate is assigned to a scope variable.

--
January 24, 2018
https://issues.dlang.org/show_bug.cgi?id=16037

anonymous4 <dfj1esp02@sneakemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |safe

--
March 04, 2018
https://issues.dlang.org/show_bug.cgi?id=16037

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

--
March 04, 2018
https://issues.dlang.org/show_bug.cgi?id=16037

Carsten Blüggel <chilli@posteo.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |chilli@posteo.net

--
March 08, 2018
https://issues.dlang.org/show_bug.cgi?id=16037

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

https://github.com/dlang/dmd/commit/4b93ddef41508453c6e83b11e62f97ae870c8c98 fix Issue 16037 - assigning delegate to a scope variable shouldn't allocate closure

https://github.com/dlang/dmd/commit/81283694ce96174fe854b975d68384da7cbc66b7 Merge pull request #7981 from WalterBright/fix16037

fix Issue 16037 - assigning delegate to a scope variable shouldn't al…

--
March 08, 2018
https://issues.dlang.org/show_bug.cgi?id=16037

github-bugzilla@puremagic.com changed:

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

--
March 09, 2018
https://issues.dlang.org/show_bug.cgi?id=16037

anonymous4 <dfj1esp02@sneakemail.com> changed:

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

--- Comment #5 from anonymous4 <dfj1esp02@sneakemail.com> ---
Should work the same is @system code; "don't break working code" only applies to valid code; if code advertizes scoping, but doesn't respect it, it's invalid and there shouldn't be any guarantee for it to work.

--
« First   ‹ Prev
1 2