On Mon, 22 Dec 2014 10:22:35 GMT, Jack Applegame wrote:
On Sun, 21 Dec 2014 19:59:50 GMT, Mathias LANG wrote:
There's @ignore for this: http://vibed.org/api/vibe.data.serialization/ignore
I'm talking about run time not compile time.
Okay. I can't see why you would use it (looks like lack of SoC), could you provide an use case ?
Anyway, I can imagine something like this fitting into Vibe.d:
struct MyStruct {
@optional(canSerialize) int value;
bool canSerialize(int value) { return value != 42; }
}
Here, 'MyStruct.value' will only be serialized if the return value from canSerialize (which can be either a member or a free function) is true. Would that do ?