www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Seeking help with opend std

reply monkyyy <crazymonkyyy gmail.com> writes:
https://github.com/opendlang/d/issues/4

I added the labels `good first issue` and `help wanted`; 
therefore its a good first issue and I'm good at open source and 
communicating

---

Id like help, most of the people in opend are specifically 
generic-code non-believers and its *allot* of code I want to get 
just werk`n.

If anyone wants to rant discussions should happen here: 
https://github.com/orgs/opendlang/discussions/46

Gists, stealing code from projects, *I dont care* about the 
formality of holy git, style, or even lawyers opinions on if 
russia is gnu compliment.

I view the following as the important factors for making 
programming ever actually good:

1. data structures
2. algorithm (including searching algorithms, experimenting with 
apis)
3. better printf debugging
4. sane serialization
Dec 27 2024
parent reply monkyyy <crazymonkyyy gmail.com> writes:
On Friday, 27 December 2024 at 21:15:40 UTC, monkyyy wrote:

Still want help

https://github.com/opendlang/d/blob/main/source/odc/algorthims.d

will take criticism from the usual suspects
Jan 10
next sibling parent Elias (0xEAB) <desisma heidel.beer> writes:
On Saturday, 11 January 2025 at 05:12:02 UTC, monkyyy wrote:
 from the usual suspects
You should probably clarify on that.
Jan 10
prev sibling next sibling parent Andrea Fontana <nospam example.com> writes:
On Saturday, 11 January 2025 at 05:12:02 UTC, monkyyy wrote:
 On Friday, 27 December 2024 at 21:15:40 UTC, monkyyy wrote:

 Still want help

 https://github.com/opendlang/d/blob/main/source/odc/algorthims.d

 will take criticism from the usual suspects
Nice filename, anyway.
Jan 11
prev sibling parent reply Anton Pastukhov <mail anton9.com> writes:
On Saturday, 11 January 2025 at 05:12:02 UTC, monkyyy wrote:
 On Friday, 27 December 2024 at 21:15:40 UTC, monkyyy wrote:

 Still want help

 https://github.com/opendlang/d/blob/main/source/odc/algorthims.d

 will take criticism from the usual suspects
Please make popFront and popBack actually return popped values thanks
Jan 12
next sibling parent reply monkyyy <crazymonkyyy gmail.com> writes:
On Sunday, 12 January 2025 at 19:25:37 UTC, Anton Pastukhov wrote:
 On Saturday, 11 January 2025 at 05:12:02 UTC, monkyyy wrote:
 On Friday, 27 December 2024 at 21:15:40 UTC, monkyyy wrote:

 Still want help

 https://github.com/opendlang/d/blob/main/source/odc/algorthims.d

 will take criticism from the usual suspects
Please make popFront and popBack actually return popped values thanks
Even if I liked that idea, wouldnt that break phoboes compatibility?
Jan 12
parent reply Anton Pastukhov <mail anton9.com> writes:
On Sunday, 12 January 2025 at 20:40:06 UTC, monkyyy wrote:
 On Sunday, 12 January 2025 at 19:25:37 UTC, Anton Pastukhov 
 wrote:
 On Saturday, 11 January 2025 at 05:12:02 UTC, monkyyy wrote:
 On Friday, 27 December 2024 at 21:15:40 UTC, monkyyy wrote:

 Still want help

 https://github.com/opendlang/d/blob/main/source/odc/algorthims.d

 will take criticism from the usual suspects
Please make popFront and popBack actually return popped values thanks
Even if I liked that idea, wouldnt that break phoboes compatibility?
My uninformed opinion is that shouldn't cause too much trouble? popFront and popBack currently return void, so it's safe to assume there are no places in the existing code that expect a return value, so it's just going to be discarded. I could be terribly wrong ofc
Jan 13
next sibling parent Dennis <dkorpel gmail.com> writes:
On Monday, 13 January 2025 at 12:26:07 UTC, Anton Pastukhov wrote:
 My uninformed opinion is that shouldn't cause too much trouble? 
 popFront and popBack currently return void, so it's safe to 
 assume there are no places in the existing code that expect a 
 return value, so it's just going to be discarded.
It would break this mini implementation of `map`: ```D private struct MapResult(alias func, R) { R r; auto front() => func(r.front); bool empty() => r.empty; void popFront() => r.popFront(); } ```
Jan 13
prev sibling next sibling parent IchorDev <zxinsworld gmail.com> writes:
On Monday, 13 January 2025 at 12:26:07 UTC, Anton Pastukhov wrote:
 My uninformed opinion is that shouldn't cause too much trouble? 
 popFront and popBack currently return void, so it's safe to 
 assume there are no places in the existing code that expect a 
 return value, so it's just going to be discarded. I could be 
 terribly wrong ofc
You can do this: ```d void fn1(){} void fn2(){ return fn1(); }
Jan 13
prev sibling parent monkyyy <crazymonkyyy gmail.com> writes:
On Monday, 13 January 2025 at 12:26:07 UTC, Anton Pastukhov wrote:
 On Sunday, 12 January 2025 at 20:40:06 UTC, monkyyy wrote:
 On Sunday, 12 January 2025 at 19:25:37 UTC, Anton Pastukhov 
 wrote:
 On Saturday, 11 January 2025 at 05:12:02 UTC, monkyyy wrote:
 On Friday, 27 December 2024 at 21:15:40 UTC, monkyyy wrote:

 Still want help

 https://github.com/opendlang/d/blob/main/source/odc/algorthims.d

 will take criticism from the usual suspects
Please make popFront and popBack actually return popped values thanks
Even if I liked that idea, wouldnt that break phoboes compatibility?
My uninformed opinion is that shouldn't cause too much trouble? popFront and popBack currently return void, so it's safe to assume there are no places in the existing code that expect a return value, so it's just going to be discarded. I could be terribly wrong ofc
I believe phoboes and "contract programming" to break code that should otherwise work(I know of spefic examples where coping and pasting the function without the contract compiles) Its possible to detect differences here and the real code range api that actually being used by phoebes is actually oo-y If you care about the api I could add some variant of this function: ```d auto ref next(R)(R r){ auto e=&(r.front); r.popFront; return *e; } ``` (would need to test several situation to find version that actually works with both ref and nonref front)
Jan 13
prev sibling parent reply =?UTF-8?Q?Ali_=C3=87ehreli?= <acehreli yahoo.com> writes:
On 1/12/25 11:25 AM, Anton Pastukhov wrote:
 On Saturday, 11 January 2025 at 05:12:02 UTC, monkyyy wrote:
 On Friday, 27 December 2024 at 21:15:40 UTC, monkyyy wrote:

 Still want help

 https://github.com/opendlang/d/blob/main/source/odc/algorthims.d

 will take criticism from the usual suspects
Please make popFront and popBack actually return popped values thanks
Historically that did not work at a time when - C++ was the ruler - Strong exception guarantee mattered - Move constructors were not available T popFront() { /* ... */ // 1) Mutate the range return front; // 2) Copy the element } The problem is with copying that popped value. If the copying itself throws, the range is already modified. Such topics have been covered extensively in books like Exceptional C++ by Herb Sutter. If strong exception guarantee is indeed needed, the correct API is to provide front() and popFront() separately. But once you have front() anyway, why conflate the two actions of popping and providing in popFront() again? So the current D InputRange API works. Ali
Jan 13
parent reply Anton Pastukhov <mail anton9.com> writes:
On Monday, 13 January 2025 at 21:29:38 UTC, Ali Çehreli wrote:
 On 1/12/25 11:25 AM, Anton Pastukhov wrote:
 On Saturday, 11 January 2025 at 05:12:02 UTC, monkyyy wrote:
 On Friday, 27 December 2024 at 21:15:40 UTC, monkyyy wrote:

 Still want help

 
https://github.com/opendlang/d/blob/main/source/odc/algorthims.d
 will take criticism from the usual suspects
Please make popFront and popBack actually return popped
values thanks Historically that did not work at a time when - C++ was the ruler - Strong exception guarantee mattered - Move constructors were not available T popFront() { /* ... */ // 1) Mutate the range return front; // 2) Copy the element } The problem is with copying that popped value. If the copying itself throws, the range is already modified. Such topics have been covered extensively in books like Exceptional C++ by Herb Sutter. If strong exception guarantee is indeed needed, the correct API is to provide front() and popFront() separately. But once you have front() anyway, why conflate the two actions of popping and providing in popFront() again? So the current D InputRange API works. Ali
This is just a matter of ergonomics. ```d auto x = myArr.popFront(); ``` is slightly more convenient than ```d myArr.popFront() auto x = myArr.front; ``` Re: exceptions, for builtin range data types it's realistic to give nothrow guarantee. For user-defined types, it's responsibility of the user to take care of it
Jan 14
parent Anton Pastukhov <mail anton9.com> writes:
On Tuesday, 14 January 2025 at 11:19:50 UTC, Anton Pastukhov 
wrote:
 On Monday, 13 January 2025 at 21:29:38 UTC, Ali Çehreli wrote:
 On 1/12/25 11:25 AM, Anton Pastukhov wrote:
This is a small inconvenience, but it's also a solved problem in many other languages. E.g. in Rust, `Vec.pop` behaves exactly like that
Jan 14