Thread overview
[Issue 3787] New: clarification: assigment to 'this'
Feb 09, 2010
Johannes Pfau
Feb 09, 2010
Johannes Pfau
Jan 22, 2012
Walter Bright
Jan 22, 2012
Walter Bright
February 09, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3787

           Summary: clarification: assigment to 'this'
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: www.digitalmars.com
        AssignedTo: nobody@puremagic.com
        ReportedBy: johannespfau@gmail.com


--- Comment #0 from Johannes Pfau <johannespfau@gmail.com> 2010-02-09 08:02:26 PST ---
Created an attachment (id=564)
Example of assignment to this

Assigning to 'this' is currently not documented anywhere. Still assigning to this, at least in constructors, works and is used by some code (gtkd, for example). I think assigning to this should either work in constructors as it does right now, but it then should be documented, or it should be disallowed. If it will stay implementation specific, that should still be noted in the docs.

see also: http://d.puremagic.com/issues/show_bug.cgi?id=780 The assignment of 'this' is allowed

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 09, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3787


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei@metalanguage.com


--- Comment #1 from Andrei Alexandrescu <andrei@metalanguage.com> 2010-02-09 08:42:34 PST ---
This doesn't look major.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 09, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3787


Johannes Pfau <johannespfau@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P3
           Severity|major                       |normal


--- Comment #2 from Johannes Pfau <johannespfau@gmail.com> 2010-02-09 10:54:37 PST ---
I just thought if you'd disallow assignment to this completely as the poster in bug 780 suggests, you might want to discuss that in the newsgroup. As this is quite late for d2 I flagged it major. Also I think completely undocumented and undefined features being already used in production code (gtkd) is a bad thing. However, I hadn't seen the bugzilla fields explanation, sorry. I'll change the priority.

Btw, what is most likely to happen in the end?
1: make current behavior part of specification
2: disallow assignment to this completely
3: leave this as implementation specific behavior

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 22, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=3787


Walter Bright <bugzilla@digitalmars.com> changed:

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


--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> 2012-01-22 13:34:48 PST ---
Assignment to this and super should not be allowed.

The gtkd code can be fixed by making a 'factory' method to create a new object. However, this is not a trivial fix, and so having the compiler disallow the current code should be a long time in coming.

In the meantime, I've updated the spec.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 22, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=3787



--- Comment #4 from github-bugzilla@puremagic.com 2012-01-22 13:35:35 PST ---
Commit pushed to https://github.com/D-Programming-Language/d-programming-language.org

https://github.com/D-Programming-Language/d-programming-language.org/commit/83763c15e1ecd9fbf527fa1e9e979855cabc5a81 fix Issue 3787 - clarification: assigment to 'this'

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 22, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=3787


Walter Bright <bugzilla@digitalmars.com> changed:

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


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