www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8121] New: "scope ref" is perfectly OK

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8121

           Summary: "scope ref" is perfectly OK
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: wfunction hotmail.com



void test(scope ref int) { }
void main() { }

There is nothing wrong with passing something by reference with 'scope', so DMD
should compile this.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 19 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8121




Also, "scope out" (and even "scope lazy") should also work, since it is
perfectly valid for both of them to say, "this parameter will not be escaped".

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8121


Matthias Walter <xammy xammy.info> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xammy xammy.info



---
Does this bug report also cover the case of *returning* scope ref in order to
make the following possible:

scope ref T opIndex(...);

For example in std.container.Array this is helpful in order to write

array[0].method()

because for by-value opIndex the method() is called on a *copy* of the first
element!

On the other hand returning by (the usual) ref prevents the container from
being a 'sealed container' and hence the restriction would say:

"opIndex returns by reference but this reference may not be escaped but only be
used to call a method (including operators) on the returned object."

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8121




That doesn't make much sense to me... I mean, I agree we need to be able to
return scoped values, but given that scope is a storage class, I don't think
applying it to a return type makes sense.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 20 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8121


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com



15:31:50 PDT ---
*** Issue 10917 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 28 2013