Re: Setting struct as default parameter of a function using struct literal?

2023-09-12 Thread Salih Dincer via Digitalmars-d-learn
On Monday, 11 September 2023 at 23:47:33 UTC, H. S. Teoh wrote: Since the type of the parameter is already known, the compiler does not need me to repeat the type name. It already knows enough to figure it out on its own. "Don't Repeat Yourself" (DRY). I think there are 3 possibilities,

Re: Setting struct as default parameter of a function using struct literal?

2023-09-12 Thread cc via Digitalmars-d-learn
On Monday, 11 September 2023 at 17:51:04 UTC, BoQsc wrote: I would like to set function's default struct for a function in a way that it would be visible for the reader to see what options are set. Something like `Options option = {silenceErrors: false}` If the function's defaults will

Re: pipeProcess output to hash string

2023-09-12 Thread user1234 via Digitalmars-d-learn
On Monday, 11 September 2023 at 22:08:54 UTC, Christian Köstlin wrote: Just three remarks: First I would recommend to use `std.process : execute` instead of `pipeProcess` in this usecase, as this will wait properly for the process to exit and it also will collect its output. Second its

Re: isBinary

2023-09-12 Thread novice2 via Digitalmars-d-learn
On Sunday, 3 September 2023 at 13:55:45 UTC, Vino wrote: f.open(fn, "rb"); here you command to your pc: "now open fn and treat is as binary file"

Re: Json Help

2023-09-12 Thread Christian Köstlin via Digitalmars-d-learn
On 10.09.23 13:06, Vino wrote: Hi All,   Request your help on the below code,I am trying to convert the below string to json and it always throws the error, if the below can be accomplished with any other json package even that is fine, I tired only the std.json package. Test Program: