dattrs ~main

D classes with less boilerplate


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

dattrs

dattrs is a riff on Python's attrs. It removes the need for writing boring boilerplate class constructors.

Use it like so:


/* You MUST import the entire dattrs module, 
   dont just import `define`.
*/
import dattrs;

class wibble
{
    mixin define!(["donkey"], string);
}

auto w = new wibble("hello");

writeln(w.donkey); //"hello"

You may also define default values for the attributes, and optionally offer a no-parameter constructor.


class wibble
{
                              name       value  overload type
    mixin define_defaults!(["donkey"], ["hello"], true, string);
}

Authors:
  • Samathy Barratt
Dependencies:
none
Versions:
2.1.0 2020-Dec-31
2.0.0 2020-Dec-31
1.0.1 2020-Dec-31
1.0.0 2020-Dec-31
~main 2020-Dec-31
Show all 5 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 18 downloads total

Score:
0.1
Short URL:
dattrs.dub.pm