www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8372] New: -property is broken

reply d-bugmail puremagic.com writes:
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



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: -------
Jul 10 2012
next sibling parent d-bugmail puremagic.com writes:
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



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.



*** 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: -------
Jul 10 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8372


timon.gehr gmx.ch changed:

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



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: -------
Jul 10 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8372




PDT ---



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







 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: -------
Jul 10 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8372




PDT ---

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

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: -------
Jul 10 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8372


timon.gehr gmx.ch changed:

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





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

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: -------
Jul 10 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8372


Jacob Carlborg <doob me.com> changed:

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



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: -------
Jul 10 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8372




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: -------
Jul 10 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8372





 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: -------
Jul 11 2012