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 described 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.

Members

Aliases

Parameters
alias Parameters = std.traits.Parameters
Undocumented in source.
ReturnType
alias ReturnType = std.traits.ReturnType
Undocumented in source.

Functions

refract
Function 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

Function
struct 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
struct Parameter

A struct capturing all the properties of a function parameter.

Templates

ParameterAttributes
template ParameterAttributes(alias fun, int i)

Return an alias to the j-th user-define attribute of the i-th parameter of fun.

Variables

functions
Function[] functions;
Undocumented in source.

Meta