www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - ranting and raving about the need for data structures

reply monkyyy <crazymonkyyy gmail.com> writes:
chat log from discord
https://imgur.com/a/9RH23Y1 (ocr didnt work)

I'm usually on the discord when I rant and rave about this but 
the people who treat data structures as low priority are here.

Can data structures please be a priority? Its "data structures + 
algorithms = programs", yet I only really have the basic slice 
and maybe aa's if the ctfe stuff works out; while I think there's 
lots of room for improvement for std.algorithms its there and 90% 
of it has a use.

Hot rolling a custom data structure leads to memory issues; not a 
lack of safe or borrow checkers, slices and foreach prevent 99% 
of the segfaults I would have; give me good tested abstractions 
for memory and my code will be safe due to my laziness; try to 
band-aid it with dip 1000 complexity and... well I'll probably 
find new exciting ways to break things.

I just want to type `import std;` type out 50 to 100 lines of 
code, and have a neat little project and ranges are fantastic for 
that, and the more that happens the better; but I often feel 
constrained on specifying the data structures part, cause hacking 
together an interface for arrays takes like 15 of those 
opOpIndexAssign style overloads, and they would probably be 
tested and~ you've already blown the 1-day project complexity and 
time budget.
Oct 09 2023
next sibling parent reply Commander Zot <no no.no> writes:
On Monday, 9 October 2023 at 19:05:43 UTC, monkyyy wrote:
 chat log from discord
 https://imgur.com/a/9RH23Y1 (ocr didnt work)

 [...]
99.9% of cases just just be an array for performance reasons, and if you actually need something else, then you most likely need a handcrafted solution anyway.
Oct 10 2023
parent reply monkyyy <crazymonkyyy gmail.com> writes:
On Tuesday, 10 October 2023 at 09:48:01 UTC, Commander Zot wrote:
 On Monday, 9 October 2023 at 19:05:43 UTC, monkyyy wrote:
 chat log from discord
 https://imgur.com/a/9RH23Y1 (ocr didnt work)

 [...]
99.9% of cases just just be an array for performance reasons, and if you actually need something else, then you most likely need a handcrafted solution anyway.
There are abstractions on top of static arrays as well, its absurd there isn't a nice circular buffer
Oct 10 2023
parent reply Commander Zot <no no.no> writes:
On Tuesday, 10 October 2023 at 14:51:56 UTC, monkyyy wrote:
 On Tuesday, 10 October 2023 at 09:48:01 UTC, Commander Zot 
 wrote:
 On Monday, 9 October 2023 at 19:05:43 UTC, monkyyy wrote:
 chat log from discord
 https://imgur.com/a/9RH23Y1 (ocr didnt work)

 [...]
99.9% of cases just just be an array for performance reasons, and if you actually need something else, then you most likely need a handcrafted solution anyway.
There are abstractions on top of static arrays as well, its absurd there isn't a nice circular buffer
because even for a circular buffer a single solution is not enough. you have typed vs unpyped, known length for elements vs dynamic length, single/multi producer, single/multi consumer, threat safety, ...
Oct 10 2023
parent reply monkyyy <crazymonkyyy gmail.com> writes:
On Tuesday, 10 October 2023 at 15:20:53 UTC, Commander Zot wrote:
 because even for a circular buffer a single solution is not 
 enough.
 you have typed vs unpyped, known length for elements vs dynamic 
 length, single/multi producer, single/multi consumer, threat 
 safety, ...
The stated reason is allocators; I believe if the reasoning was typed or void, static or dynamic, you could cover dozens of cases with meta programming that the std likes to over do. At which point you enumerate these and let people bodge it out, and there would be *progress*, an end point. Instead theres a dead end project I know of no one caring about and no ones worked on in years, thats stated as a blocker. When I see the work as api design and unit test writing.
Oct 10 2023
parent reply Commander Zot <no no.no> writes:
On Tuesday, 10 October 2023 at 18:00:45 UTC, monkyyy wrote:
 On Tuesday, 10 October 2023 at 15:20:53 UTC, Commander Zot 
 wrote:
 because even for a circular buffer a single solution is not 
 enough.
 you have typed vs unpyped, known length for elements vs 
 dynamic length, single/multi producer, single/multi consumer, 
 threat safety, ...
The stated reason is allocators; I believe if the reasoning was typed or void, static or dynamic, you could cover dozens of cases with meta programming that the std likes to over do. At which point you enumerate these and let people bodge it out, and there would be *progress*, an end point. Instead theres a dead end project I know of no one caring about and no ones worked on in years, thats stated as a blocker. When I see the work as api design and unit test writing.
i mean, if you think you can write one that covers all the cases, go for it. even if it might not end up in std, it would be a great addition to dub. but i honestly don't think it will solve any problems, because data structures are just not very generic, and should be specialized for the actual problem.
Oct 11 2023
parent monkyyy <crazymonkyyy gmail.com> writes:
On Wednesday, 11 October 2023 at 22:35:51 UTC, Commander Zot 
wrote:
 data structures are just not very generic
 99.9% of cases just just be an array for performance reasons
My goto rn is a dynamic array, when I want more static options. I dont see how you want it both ways
Oct 12 2023
prev sibling parent reply jmh530 <john.michael.hall gmail.com> writes:
On Monday, 9 October 2023 at 19:05:43 UTC, monkyyy wrote:
 chat log from discord
 https://imgur.com/a/9RH23Y1 (ocr didnt work)

 I'm usually on the discord when I rant and rave about this but 
 the people who treat data structures as low priority are here.

 Can data structures please be a priority? Its "data structures 
 + algorithms = programs", yet I only really have the basic 
 slice and maybe aa's if the ctfe stuff works out; while I think 
 there's lots of room for improvement for std.algorithms its 
 there and 90% of it has a use.

 Hot rolling a custom data structure leads to memory issues; not 
 a lack of safe or borrow checkers, slices and foreach prevent 
 99% of the segfaults I would have; give me good tested 
 abstractions for memory and my code will be safe due to my 
 laziness; try to band-aid it with dip 1000 complexity and... 
 well I'll probably find new exciting ways to break things.

 I just want to type `import std;` type out 50 to 100 lines of 
 code, and have a neat little project and ranges are fantastic 
 for that, and the more that happens the better; but I often 
 feel constrained on specifying the data structures part, cause 
 hacking together an interface for arrays takes like 15 of those 
 opOpIndexAssign style overloads, and they would probably be 
 tested and~ you've already blown the 1-day project complexity 
 and time budget.
You might want to be more specific about what data structures you are looking for being added (and maybe file enhancement requests asking for them). I'm fairly sure that std.container doesn't get a lot of attention because they want to have a better story with respect to DIP 1000 and reference counting.
Oct 10 2023
parent monkyyy <crazymonkyyy gmail.com> writes:
On Tuesday, 10 October 2023 at 15:14:32 UTC, jmh530 wrote:
 You might want to be more specific about what data structures 
 you are looking for being added (and maybe file enhancement 
 requests asking for them).

 I'm fairly sure that std.container doesn't get a lot of 
 attention because they want to have a better story with respect 
 to DIP 1000 and reference counting.
https://issues.dlang.org/show_bug.cgi?id=20801 I have no expectation this alone will work
Oct 10 2023