Re: std.format with named args

2023-10-17 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 17 October 2023 at 06:46:31 UTC, Vitaliy Fadeev wrote: Hi all! I want readable mixin. I want pass variable to string. I want string with named args. Like this: ```D enum JMP_ADDR_R = "RAX"; mixin( format!"asm { jmp [JMP_ADDR_R]; }"( JMP_ADDR_R ));// IT NOT WOR

Re: std.format with named args

2023-10-17 Thread Vitaliy Fadeev via Digitalmars-d-learn
On Tuesday, 17 October 2023 at 06:57:07 UTC, Imperatorn wrote: On Tuesday, 17 October 2023 at 06:46:31 UTC, Vitaliy Fadeev wrote: Hi all! I want readable mixin. I want pass variable to string. I want string with named args. Like this: ```D enum JMP_ADDR_R = "RAX"; mixin( format!"asm {

Re: std.format with named args

2023-10-17 Thread Vitaliy Fadeev via Digitalmars-d-learn
On Tuesday, 17 October 2023 at 07:22:41 UTC, Vitaliy Fadeev wrote: On Tuesday, 17 October 2023 at 06:57:07 UTC, Imperatorn wrote: On Tuesday, 17 October 2023 at 06:46:31 UTC, Vitaliy Fadeev wrote: Hi all! I want readable mixin. I want pass variable to string. I want string with named args. Like

Re: std.format with named args

2023-10-17 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 17 October 2023 at 07:53:28 UTC, Vitaliy Fadeev wrote: On Tuesday, 17 October 2023 at 07:22:41 UTC, Vitaliy Fadeev wrote: [...] `scriptlike` looks perfecto! ```D enum JMP_ADDR_R = ... ... import scriptlike; writeln( mixin(interp

Re: How to use ".stringof" to get the value of a variable and not the name of the variable (identifier) itself?

2023-10-17 Thread rempas via Digitalmars-d-learn
On Sunday, 15 October 2023 at 07:22:53 UTC, Imperatorn wrote: You already got a lot of good answers, I thought I'd just share this for anyone searching for nogc string formatting compatible with betterC: https://code.dlang.org/packages/bc-string You thought, well, thank you very much and hav

Re: How to use ".stringof" to get the value of a variable and not the name of the variable (identifier) itself?

2023-10-17 Thread Salih Dincer via Digitalmars-d-learn
On Sunday, 15 October 2023 at 07:22:53 UTC, Imperatorn wrote: You already got a lot of good answers, I thought I'd just share this for anyone searching for nogc string formatting compatible with betterC: https://code.dlang.org/packages/bc-string Doesn't it make more sense to use [ParseResu

Re: How to use ".stringof" to get the value of a variable and not the name of the variable (identifier) itself?

2023-10-17 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 17 October 2023 at 13:31:39 UTC, Salih Dincer wrote: On Sunday, 15 October 2023 at 07:22:53 UTC, Imperatorn wrote: You already got a lot of good answers, I thought I'd just share this for anyone searching for nogc string formatting compatible with betterC: https://code.dlang.org

Removing an element from a DList

2023-10-17 Thread Joakim G. via Digitalmars-d-learn
For some reason I cannot remove an element from a DList. I tried several range approaches but to no avail. I'm a noob. In the end I did this: ``` private void removeFromWaitingQueue(uint jid) { auto arr = waitingQueue[].array; arr = arr.remove!(job => job.jid == jid); waitingQueue.c

Re: Removing an element from a DList

2023-10-17 Thread monkyyy via Digitalmars-d-learn
On Tuesday, 17 October 2023 at 17:27:19 UTC, Joakim G. wrote: For some reason I cannot remove an element from a DList. I tried several range approaches but to no avail. I'm a noob. In the end I did this: ``` private void removeFromWaitingQueue(uint jid) { auto arr = waitingQueue[].array;