Thread overview
[Issue 2855] New: __traits: no way to get overloads and information for non-instance methods
Apr 19, 2009
d-bugmail
Apr 19, 2009
d-bugmail
Apr 19, 2009
d-bugmail
Apr 19, 2009
d-bugmail
Apr 19, 2009
d-bugmail
Apr 21, 2009
d-bugmail
Apr 21, 2009
Denis Koroskin
Apr 21, 2009
d-bugmail
April 19, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2855

           Summary: __traits: no way to get overloads and information for
                    non-instance methods
           Product: D
           Version: 2.027
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: dhasenan@gmail.com


Given a UDT and a constructor or a static method, I want to use __traits to access overloads of that constructor or static method.

__traits provides allMembers, which returns static and non-static functions and non-static constructors. It also provides getVirtualFunctions, which provides overloads for non-static functions. There is no equivalent to getVirtualFunctions for constructors or static functions.


-- 

April 19, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2855





------- Comment #1 from dhasenan@gmail.com  2009-04-19 10:43 -------
Created an attachment (id=327)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=327&action=view)
patch to add traits for dealing with static methods


-- 

April 19, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2855


dhasenan@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch




------- Comment #2 from dhasenan@gmail.com  2009-04-19 10:45 -------
This patch adds traits:
isStaticFunction
getStaticFunctions
getOverloads

This doesn't handle constructors, but it does handle static functions.


-- 

April 19, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2855





------- Comment #3 from dhasenan@gmail.com  2009-04-19 11:22 -------
Created an attachment (id=328)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=328&action=view)
fixed patch


-- 

April 19, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2855





------- Comment #4 from dhasenan@gmail.com  2009-04-19 11:25 -------
Created an attachment (id=329)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=329&action=view)
test cases

I don't know what the preferred format is for the DMD test suite. (Hint hint.) So I did something reasonable.


-- 

April 21, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2855





------- Comment #5 from dhasenan@gmail.com  2009-04-20 19:21 -------
Created an attachment (id=331)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=331&action=view)
attempt 3

HA HA DISREGARD THAT, I CAN'T DIFF
(But thankfully, git can.)


-- 

April 21, 2009
On Tue, 21 Apr 2009 04:21:29 +0400, <d-bugmail@puremagic.com> wrote:

> http://d.puremagic.com/issues/show_bug.cgi?id=2855
>
>
>
>
>
> ------- Comment #5 from dhasenan@gmail.com  2009-04-20 19:21 -------
> Created an attachment (id=331)
>  --> (http://d.puremagic.com/issues/attachment.cgi?id=331&action=view)
> attempt 3
>
> HA HA DISREGARD THAT, I CAN'T DIFF
> (But thankfully, git can.)
>
>

bash.org?

April 21, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2855





------- Comment #6 from dhasenan@gmail.com  2009-04-21 18:35 -------
In point of fact, this does handle constructors:
__traits(getOverloads, T, "__ctor")


--