www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10557] New: __traits(== __parameters) should accept function pointer/delegate type

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

           Summary: __traits(== __parameters) should accept function
                    pointer/delegate type
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: k.hara.pg gmail.com



Recent function type and default argument improvement:
https://github.com/D-Programming-Language/dmd/pull/1102

changes default arguments and parameter identifiers "volatile" on function
type.

The change itself makes sense, but after all, we cannot take the information
from function pointer/delegate variable and function literal symbol anymore.

void function(int arg = 10) fp;
pragma(msg, typeof(fp));  // prints void function(int arg = 10)

static if (is(typeof(fp) FP == F*, F)) {
  pragma(msg, F);         // print void(int)
  static if (is(F PT == __parameters)) {
    // Right now here, PT does not contain any def-arg and param-id
informations.
    pragma(msg, PT);      // prints (int)
  }
}

This is expected behavior, but it is also inconvenient for some
meta-programming.

To get the volatile information, I'd like to propose that is(F PT ==
__parameters) accepts function pointer type and delegate type directly.

void function(int a = 10) fp;
static if (is(typeof(fp) PT1 == __parameters)) {
  // Currently this always fails, but will pass after this ER is implemented
  pragma(msg, PT1);  // will print (int a = 10)
}
void delegate(int b = 20) dg;
static if (is(typeof(dg) PT2 == __parameters)) {
  // Currently this always fails, but will pass after this ER is implemented
  pragma(msg, PT2);  // will print (int b = 20)
}

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


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull



https://github.com/D-Programming-Language/dmd/pull/2308

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


Kenji Hara <k.hara.pg gmail.com> changed:

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



After bug 10548 fixed, this ER would become unnecessary. So I withdraw this.

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