Module bolts.experimental.refraction
This module helps building functions from other functions.
It is sometimes necessary to create a function which is an exact copy of another function. Or sometimes it is necessary to introduce a few variations, while carrying all the other aspects. Because of function attributes, parameter storage classes and user-defined attributes, this requires building a string mixin. In addition, the mixed-in code must refer only to local names, if it is to work across module boundaires. This problem and its solution are by Adam D. Ruppe in a Tip of the Week, available here:
https
//stackoverflow.com/questions/32615733/struct-composition-with-mixin-and-templates/32621854#32621854
This module facilitates the creation of such mixins.
Functions
Name | Description |
---|---|
functionsOf()
|
Return an array of Function objects, refracting the functions in Scope
for which IncludePredicate evaluates to true , using the value of
localName to represent Scope . IncludePredicate is optional; if not
specified, refract all the functions. The overloadIndex property of each
Function is set to the index of the function in its *entire* overload set
(i.e. including the overloads that may have been excluded by
IncludePredicate ).
|
refract()
|
Return a Function object that captures all the aspects of fun , using the
value of localName to represent the return and parameter types, and the
UDAs. Set the Function 's overloadIndex property to index , or to -1 if
it is not specified.
|
Structs
Name | Description |
---|---|
Function
|
A struct capturing all the aspects of a function necessary to produce a string mixin that re-creates the function (excepting the body). |
Parameter
|
A struct capturing all the properties of a function parameter. |
Aliases
Name | Type | Description |
---|---|---|
ParameterAttribute
|
Alias!(__traits(getAttributes,P[i..i+1])[j])
|
Return an alias to the j -th user-define attribute of the i -th parameter
of fun .
|