add uda (e.g. @csvIgnore) support in std.csv?
snarwin at gmail.com
Thu Sep 10 17:57:09 UTC 2020
On Thursday, 10 September 2020 at 14:57:11 UTC, Jacob Carlborg
> On 2020-09-08 06:53, mw wrote:
>> I'm trying this example:
>> struct Layout
>> string name;
>> int value;
>> double other;
>> Layout* parent; // add extra pointer
>> auto records = text.csvReader!Layout(';');
>> Right now, if we add this extra pointer, the compiler will
>> error out:
>> Error: template std.conv.toImpl cannot deduce function from
>> argument types !(Layout*)(string), candidates are:
>> I think if we can add add uda (e.g. @csvIgnore) support in
>> std.csv, it will make the library more flexible to use.
> How about a more general attribute in `core.attribute`, like
> `@nonSerialized`? This could be used by third party
> serialization libraries. Then it could also be used by druntime
> and Phobos to ignore things that should not be serializable.
> Like threads, processes and sockets.
Existing serialization libraries  already define their own
attributes for this sort of thing. I don't think there's anything
to be gained by attempting to force standardization here.
If Phobos and/or the D ecosystem does someday decide to
standardize on a shared @ignore attribute, std.csv can be easily
upgraded for compatibility by adding `alias csvIgnore =
More information about the Digitalmars-d