Re: Debugging on Windows

2025-04-18 Thread Python via Digitalmars-d-learn
On Wednesday, 16 April 2025 at 20:08:00 UTC, Arokh Slade wrote: Hello, I'm trying to get debugging on windows 10 to work. d_test.d ```D void main() { int i; } ``` I compile with: dmd -g -gf -m64 .\d_test.d I load the msvc debugger with devenv /DebugExe .\d_test.exe latest visualD insta

D equivalent for LINQ Where

2025-05-02 Thread Python via Digitalmars-d-learn
I am trying to get some items from a list, but `find` gives me unexpected results. ``` import std.stdio; import std.algorithm; int[] x = [1, 2, 3, 4, 5, 1, 2, 3]; void main() { auto selection = x.find!(a => a == 2); foreach(item;selection) { writeln(item); } } ``` Out

Re: D equivalent for LINQ Where

2025-05-02 Thread Python via Digitalmars-d-learn
On Friday, 2 May 2025 at 14:33:57 UTC, Richard (Rikki) Andrew Cattermole wrote: Have you tried filter? https://dlang.org/phobos/std_algorithm_iteration.html#.filter Thx. Anyway, what find returns aftrr first occurrence is unexpected.

Re: string from C function

2025-05-08 Thread Python via Digitalmars-d-learn
On Thursday, 8 May 2025 at 04:51:27 UTC, Andy Valencia wrote: Thank you. I want to work in strings, so the first one's not an option. But both the second and third do the trick. Would you say the to!string would be the most idiomatic? It worked as "to!string(ctime(&t))", but is it safe to

Re: Capture context surrounding delegate

2025-05-10 Thread Python via Digitalmars-d-learn
On Saturday, 10 May 2025 at 11:35:41 UTC, Tim wrote: This is a known issue. See e.g. https://github.com/dlang/dmd/issues/18108 Wow, the original issue is 17 years old. https://issues.dlang.org/show_bug.cgi?id=2043 At least I know that not my threading stuff is causing this. Thanks.

Capture context surrounding delegate

2025-05-09 Thread Python via Digitalmars-d-learn
Too much code below, but I cannot reduce it more. The issue is in the main function, I want to pass a delegate to a thread with a captured value from the surrounding context. At least this was my expectation, the delegate should capture any stack value. Am I doing something wrong? (please ign

Re: Capture context surrounding delegate

2025-05-12 Thread Python via Digitalmars-d-learn
On Monday, 12 May 2025 at 08:35:02 UTC, Justin Allen Parrott wrote: On Saturday, 10 May 2025 at 04:52:15 UTC, Python wrote: getchar(); I don’t like this Poor man's tool to keep my threads running.

Re: Debugging on Windows

2025-05-13 Thread Python via Digitalmars-d-learn
On Monday, 12 May 2025 at 07:33:34 UTC, Justin Allen Parrott wrote: On Wednesday, 16 April 2025 at 20:08:00 UTC, Arokh Slade wrote: Any tips? Debuggers phased out in the nineties Press F12 in your browser. You'll be surprised.

Windows thread pool

2025-05-19 Thread Python via Digitalmars-d-learn
If I am using the integrated Windows Thread Pool (1), how this will interact with garbage collection? Is there any risk that some objects are never freed or some are freed too soon? Can the garbage collector stop the threads as needed? I am asking that because I cannot use the managed core.th