Re: Debugging by old fashioned trace log printfs / writefln

2023-06-29 Thread Chris Katko via Digitalmars-d-learn
On Thursday, 29 June 2023 at 18:27:22 UTC, Cecil Ward wrote: I’m trying to debug my D program with old-fashioned printfs stuck in various strategic places, actually using writefln(). My problem is that the addition of printf fights with the existing declarations for pure nothrow @nogc @safe

Re: Reading an environment variable value

2023-06-29 Thread Josh Holtrop via Digitalmars-d-learn
On Thursday, 29 June 2023 at 19:19:21 UTC, Adam D Ruppe wrote: On Thursday, 29 June 2023 at 18:47:48 UTC, Josh Holtrop wrote: $ ldc2 -of environment environment.d Since you named the file `environment.d` and didn't use an explicit `module name.thing;` declaration, the compiler assumes it

Re: Reading an environment variable value

2023-06-29 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 29 June 2023 at 18:47:48 UTC, Josh Holtrop wrote: $ ldc2 -of environment environment.d Since you named the file `environment.d` and didn't use an explicit `module name.thing;` declaration, the compiler assumes it should match the filename. So it injects an implicit `module

Reading an environment variable value

2023-06-29 Thread Josh Holtrop via Digitalmars-d-learn
I am trying to use `std.process.environment.get()` as described here: https://dlang.org/library/std/process/environment.get.html I wrote this program to test it: ```d import std.stdio; import std.process; int main(string[] args) { string home = environment.get("HOME"); writeln("home

Re: Debugging by old fashioned trace log printfs / writefln

2023-06-29 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
```d debug { writeln("text"); } ``` ```d writeln(__MODULE__, ":", __LINE__, " ", "stuff"); ``` You'll need to wrap try/catch for flushing stdout however.

Re: Debugging by old fashioned trace log printfs / writefln

2023-06-29 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
```d debug writeln(__MODULE__, ":", __LINE__, " ", "stuff"); ``` Opps missed the debug.

Debugging by old fashioned trace log printfs / writefln

2023-06-29 Thread Cecil Ward via Digitalmars-d-learn
I’m trying to debug my D program with old-fashioned printfs stuck in various strategic places, actually using writefln(). My problem is that the addition of printf fights with the existing declarations for pure nothrow @nogc @safe and I have to adjust them, then put them back correctly when

Re: std.sumtyp and option ?

2023-06-29 Thread kiriakov via Digitalmars-d-learn
On Thursday, 29 June 2023 at 15:19:45 UTC, Paul Backus wrote: On Thursday, 29 June 2023 at 14:18:05 UTC, kiriakov wrote: struct Option(T) { SumType!(None, Some!T) data; alias data this; this(Value)(Value value) { data = value; } }

Re: std.sumtyp and option ?

2023-06-29 Thread jmh530 via Digitalmars-d-learn
On Thursday, 29 June 2023 at 14:18:05 UTC, kiriakov wrote: How to create option type over std.sumtype ? ``` enum None; struct Some(T) { T x; } alias Option = SumType!(Some!T, None); ``` I get Error: undefined identifier `T` Try ```d alias Option(T) = SumType!(Some!T, None); ``` Your version

Re: std.sumtyp and option ?

2023-06-29 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 29 June 2023 at 14:18:05 UTC, kiriakov wrote: How to create option type over std.sumtype ? ``` enum None; struct Some(T) { T x; } alias Option = SumType!(Some!T, None); ``` I get Error: undefined identifier `T` Looks like you meant to type alias Option(T) = SumType!(Some!T,

std.sumtyp and option ?

2023-06-29 Thread kiriakov via Digitalmars-d-learn
How to create option type over std.sumtype ? ``` enum None; struct Some(T) { T x; } alias Option = SumType!(Some!T, None); ``` I get Error: undefined identifier `T`

Re: Single-thread processes

2023-06-29 Thread IGotD- via Digitalmars-d-learn
On Wednesday, 28 June 2023 at 23:46:17 UTC, Cecil Ward wrote: If your program is such that one process will never ever involve multiple threads, because it simply doesn’t apply in your situation, then would it be worthwhile to have a "version (D_SingleThread)" which would get rid of the

Re: How to read live output from another process ?

2023-06-29 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 23 June 2023 at 23:37:29 UTC, Vinod K Chandran wrote: Hi all, I am trying to create a program which burns time codes to a video. I am using ffmpeg for this. So far, I can successfully start ffmpeg in another thread and stop it when I need. But I can't read the live outputs from