www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8661] New: typeof not an attribute, doesn't work with UFCS

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

           Summary: typeof not an attribute, doesn't work with UFCS
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: monarchdodra gmail.com



In the title: Because "typeof" is a keyword,it does not have the same semantics
as the other properties (http://dlang.org/property.html), such as stringof,
sizeof etc..

For example:
--------
void main()
{
    int a;
    writeln(int.stringof);
    writeln(a.typeof.stringof); //This
    writeln(typeof(a).stringof);
}
--------
The syntax "a.typeof.stringof" should be made to work.

UFCS should not have a different behavior because typeof is a keyword.

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


Jonathan M Davis <jmdavisProg gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg gmx.com



PDT ---
typeof isn't a function, nor is it a property. It's a built-in construct like
is-expressions are. Would you want is-expressions to work with UFCS as well?

No, I think that this is trying to take UFCS too far.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 14 2012
parent "ixid" <nuaccount gmail.com> writes:
Why is this taking it too far? In the duplicate you also 
expressed reservations about it without explaining why it's a bad 
idea. UFCS seems very much like the natural evolution of D's 
syntax and once (if) that's accepted it should be as consistent 
and general as possible.
Sep 14 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8661


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc




 typeof isn't a function, nor is it a property. It's a built-in construct like
 is-expressions are. Would you want is-expressions to work with UFCS as well?
 
 No, I think that this is trying to take UFCS too far.
See my Issue 4272 I think "a.typeof" is a nice syntax to have, similar to "a.sizeof". But this isn't an example of UFCS. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 14 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8661


monarchdodra gmail.com changed:

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



Yeah... I should have opened it as ER, not Bug.

You are right, "nice to have". I searched if it existed before, but did not
find your issue. Closing as duplicate.

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

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