Re: Getters/setters generator

2016-12-10 Thread Iakh via Digitalmars-d-announce

On Friday, 9 December 2016 at 16:30:55 UTC, Eugene Wissner wrote:

On Friday, 9 December 2016 at 12:37:58 UTC, Iakh wrote:


Is there possibility to remove affixes in generated accessor 
names?


No, there is no way to manipulate the accessor names. What 
affixes do you mean?


You can remove suffix "_" so "name_" becomes "name". But I like
to see genarated accessors "name" for field "m_name"


Re: Getters/setters generator

2016-12-09 Thread Iakh via Digitalmars-d-announce

mixin template GenerateFieldAccessorMethods()
{
static enum GenerateFieldAccessorMethods()
{
string result = "";
return result;
}
}

Strange syntax


Re: Getters/setters generator

2016-12-09 Thread Iakh via Digitalmars-d-announce

On Friday, 9 December 2016 at 10:27:05 UTC, Eugene Wissner wrote:

Hello,

we've just open sourced a small module ("accessors") that helps 
to generate getters and setters automatically:

https://github.com/funkwerk/accessors
http://code.dlang.org/packages/accessors

It takes advantage of the UDAs and mixins. A simple example 
would be:


import accessors;

class WithAccessors
{
@Read @Write
private int num_;

mixin(GenerateFieldAccessors);
}

It would generate 2 methods "num": one to set num_ and one to 
get its value. Of cause you can generate only @Read without 
@Write and vice versa. There are some more features, you can 
find the full documentation in the README.
"GenerateFieldAccessors" mixin should be added into each 
class/struct that wants to use auto generated accessors.


Is there possibility to remove affixes in generated accessor 
names?


Re: unit-threaded v0.6.5 - Type-parametrized tests

2016-03-10 Thread Iakh via Digitalmars-d-announce

On Wednesday, 9 March 2016 at 18:01:49 UTC, Atila Neves wrote:

@Types!(int, byte)
void testInit(T)() {
assert(T.init == 0);
}

Atila


It is not clear that this UDA is about unittesting