October 11, 2020 Re: add uda (e.g. @csvIgnore) support in std.csv? | ||||
---|---|---|---|---|
| ||||
Posted in reply to mw | On Sunday, 11 October 2020 at 16:15:30 UTC, mw wrote: > On Sunday, 11 October 2020 at 14:04:47 UTC, 9il wrote: >> On Saturday, 10 October 2020 at 16:52:32 UTC, mw wrote: >>> On Saturday, 10 October 2020 at 10:13:55 UTC, 9il wrote: >>>> >>>> Ready to use module for this purpose. >>>> http://mir-algorithm.libmir.org/mir_serde.html >>> >>> Nice, but this is in a 3rd-party library, and std.csv is the DLang standard library. >>> >>> Maybe can you create a PR just contribute this module to std? >>> >>> (I've read there are some issues regarding licensing to contribute the whole mir to stb lib). >> >> We are making Mir the real standard D library. > > This is excellent news. > > BTW, what namespace it will use? std.???? mir.* std.* is used by Phobos and it is fine. It isn't the same as it was in D1 with two standard libraries. Mir is compatible with Phobos. > From a purely marketing / promotional perspective, may I suggest numD? Mir isn't limited by numeric code. For example, mir.rc (mir-algorithm) provides a production-ready full-featured ref-counted type system. > People will immediately recognize numPy => numD, and if we can even make the interface the same, people may adopt it more quickly. I know there is numir project, but there are several repos under https://github.com/libmir, as a user I sometimes got confused which one to use, can they *all* be merged into a single library numD? Different code of different purpose needs different maintaining rules and coding standards. |
September 25, 2022 Re: add uda (e.g. @csvIgnore) support in std.csv? | ||||
---|---|---|---|---|
| ||||
Posted in reply to mw | On Saturday, 10 October 2020 at 04:31:20 UTC, mw wrote:
> On Tuesday, 8 September 2020 at 04:53:26 UTC, mw wrote:
>> Hi,
>>
>> I'm trying this example:
>>
>> https://dlang.org/phobos/std_csv.html
>>
>> ```
>> struct Layout
>> {
>> string name;
>> int value;
>> double other;
>>
>> @csvIgnore
>> Layout* parent; // add extra pointer
>> }
>>
>> auto records = text.csvReader!Layout(';');
>> ```
>>
>> Right now, if we add this extra pointer, the compiler will error out:
>>
>> https://run.dlang.io/is/EvU6Ee
>>
>> /dlang/dmd/linux/bin64/../../src/phobos/std/conv.d(223): 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.
>>
>> Thoughts?
>
> I do run into this problem today, i.e. my struct need some extra non-simple-scalar fields (e.g. SysTime) other than those defined in the csv file, I'm wondering what kind of work-around people use in such situation?
>
> Thanks.
Run into this problem yet again:
```
class Foo {
Foo[] foos; // how to mark this field to be csv ignored?
}
```
Any work around?
Thanks.
|
Copyright © 1999-2021 by the D Language Foundation