www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4991] New: Make 'nothrow', other function attributes, accessible (via traits?)

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

           Summary: Make 'nothrow', other function attributes, accessible
                    (via traits?)
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: ah08010-d yahoo.com



PDT ---
In a template, I'd like to declare a mathematical function as pure/nothrow. The
problem is that I am using a traits template to specify behavior for some edge
conditions, and the caller may reasonably want the edge case to throw an
exception.

So I would like to be able to statically detect the nothrow status of the trait
class' behavior handler, and reflect that in the declaration of the template
function.

At the very least, this means providing a boolean query for nothrow. But in
fact, propagating the attribute would benefit from additional capabilities.

Declaring a function "conditionally nothrow" presently seems to require a
conditional re-declaration of the entire function either with or without the
nothrow added. There seems to be no way to mixin("nothrow") or { alias nothrow
NT } to add in the attribute.

Perhaps this kind of "attribute propagation" needs some kind of special tuple?
Or is this a reason to support prototypes?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 04 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4991


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich gmail.com
         Resolution|                            |FIXED



12:56:09 PST ---
Please see std.traits.functionAttributes.

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