Thread overview
[Issue 8372] New: -property is broken
Jul 10, 2012
timon.gehr@gmx.ch
Jul 10, 2012
Jonathan M Davis
Jul 10, 2012
timon.gehr@gmx.ch
Jul 10, 2012
Jonathan M Davis
Jul 10, 2012
timon.gehr@gmx.ch
Jul 10, 2012
Jonathan M Davis
Jul 10, 2012
timon.gehr@gmx.ch
Jul 11, 2012
Jacob Carlborg
Jul 11, 2012
Jonathan M Davis
Jul 11, 2012
Jacob Carlborg
July 10, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8372

           Summary: -property is broken
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: timon.gehr@gmx.ch


--- Comment #0 from timon.gehr@gmx.ch 2012-07-10 13:13:45 PDT ---
The following code fails to compile with DMD 2.059 -property:

@property int delegate() foo(){ return ()=>2; }
@property int bar(){ return 2; }
int baz(){ return 2; }

static assert(foo()==2);
static assert(!is(typeof(bar())));
static assert(baz==2);

All static assertions should compile and pass.

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


Jonathan M Davis <jmdavisProg@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |jmdavisProg@gmx.com
         Resolution|                            |DUPLICATE


--- Comment #1 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-07-10 13:23:33 PDT ---
If -property does strict property enforcement like it's supposed to,

static assert(baz==2);

should fail to compile, because baz is not a property. The others should indeed pass as they are.

Regardless, this is a duplicate of two bugs: bug# 4183 and bug# 8162

*** This issue has been marked as a duplicate of issue 4183 ***

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


timon.gehr@gmx.ch changed:

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


--- Comment #2 from timon.gehr@gmx.ch 2012-07-10 13:25:44 PDT ---
This is not a dup of issue 4183

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



--- Comment #3 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-07-10 13:26:47 PDT ---
How so? Your first example is the same as bug# 4183, the second one is an example of bug# 8162, and your third example is invalid.

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



--- Comment #4 from timon.gehr@gmx.ch 2012-07-10 13:33:51 PDT ---
(In reply to comment #3)
> How so? Your first example is the same as bug# 4183,

bug# 4183 does not mention the -property flag.

> the second one is an example of bug# 8162,

bug# 8162 does not mention the -property flag.

> and your third example is invalid.

The third example is valid.

I assume -property is supposed to implement the correct @property semantics
without breaking old code. If I'm wrong I can close this issue and re-submit
the
third example.

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



--- Comment #5 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-07-10 13:46:37 PDT ---
> bug# 4183 does not mention the -property flag.

On re-reading, I see that you're right on that, but it's really the same bug.


> bug# 8162 does not mention the -property flag.

Yes it does. It's even in the title.

> The third example is valid.

No, it's not, because baz is being used as a property when it's not. -property should flag that as an error, and it does.

> I assume -property is supposed to implement the correct @property semantics
without breaking old code.

-property was introduced precisely because introducing strict property enforcement _would_ break code. Otherwise, it would have just been put straight into the compiler. The whole idea is to introduce -property first so that people have a chance to fix their code before it becomes normal functionality and to also give the compiler a chance to iron out any bugs with property enforcement. It's the same with override except that it was introduced with -w rather than with its own flag.

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


timon.gehr@gmx.ch changed:

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


--- Comment #6 from timon.gehr@gmx.ch 2012-07-10 13:49:59 PDT ---
(In reply to comment #5)
> > bug# 4183 does not mention the -property flag.
> 
> On re-reading, I see that you're right on that, but it's really the same bug.
> 
> 
> > bug# 8162 does not mention the -property flag.
> 
> Yes it does. It's even in the title.
> 

You are right, it actually mentions it. My bad.

> > The third example is valid.
> 
> No, it's not, because baz is being used as a property when it's not. -property should flag that as an error, and it does.
> 

It is not used as a property. Anyway, let's continue that discussion on the NG.

*** This issue has been marked as a duplicate of issue 8162 ***

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


Jacob Carlborg <doob@me.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |doob@me.com


--- Comment #7 from Jacob Carlborg <doob@me.com> 2012-07-10 23:33:09 PDT ---
I would like the third example to be legal.

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



--- Comment #8 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-07-10 23:36:15 PDT ---
> I would like the third example to be legal.

That would not be strict property enforcement, which is what -property is designed to test for.

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



--- Comment #9 from Jacob Carlborg <doob@me.com> 2012-07-11 02:51:28 PDT ---
(In reply to comment #8)
> That would not be strict property enforcement, which is what -property is designed to test for.

Then I don't want strict property enforcement.

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