Re: Strange error

2021-03-23 Thread Nicholas Wilson via Digitalmars-d-learn
On Monday, 22 March 2021 at 07:52:14 UTC, MichaelJames wrote: Tell me, did you manage to solve this problem? https://github.com/dlang/dmd/pull/12300

Re: Manually check struct invariants

2021-03-23 Thread Q. Schroll via Digitalmars-d-learn
On Tuesday, 23 March 2021 at 23:27:54 UTC, Paul Backus wrote: On Tuesday, 23 March 2021 at 22:22:12 UTC, Q. Schroll wrote: For a class object obj, one can use assert(obj) to get its invariants checked. How to do this for structs? https://dlang.org/spec/expression.html#assert_expressions If

Re: Implicit conversion of unique chars[] to string

2021-03-23 Thread ag0aep6g via Digitalmars-d-learn
On 23.03.21 02:07, Steven Schveighoffer wrote: const(char)[] x = "foo"; string chained = chainPath(x, "bar").array; Error: cannot implicitly convert expression array(chainPath(x, "bar")) of type const(char)[] to string And the answer is complex. You can't accept a const range, because they

Re: Implicit conversion of unique chars[] to string

2021-03-23 Thread Per Nordlöw via Digitalmars-d-learn
On Tuesday, 23 March 2021 at 01:07:15 UTC, Steven Schveighoffer wrote: const(char)[] x = "foo"; string chained = chainPath(x, "bar").array; that calls the template overload ForeachType!Range[] array(Range)(Range r) if (isIterable!Range && !isAutodecodableString!Range && !isInfinite!Range)

Re: Implicit conversion of unique chars[] to string

2021-03-23 Thread Per Nordlöw via Digitalmars-d-learn
On Tuesday, 23 March 2021 at 01:07:15 UTC, Steven Schveighoffer wrote: And the answer is complex. You can't accept a const range, because they don't work. The only way to have purity infer uniqueness is to accept paramters that the result could not have come from. Usually this means accepting

Re: 2.096.0 linker errors

2021-03-23 Thread mw via Digitalmars-d-learn
On Tuesday, 23 March 2021 at 15:27:32 UTC, Curtis wrote: On Tuesday, 23 March 2021 at 00:39:32 UTC, mw wrote: On Monday, 22 March 2021 at 23:35:09 UTC, Curtis wrote: Using 2.096.0, I'm getting a number of "undefined reference" ... The code compiles and links with 2.091.1 but I'm not sure

Re: 2.096.0 linker errors

2021-03-23 Thread Curtis via Digitalmars-d-learn
On Tuesday, 23 March 2021 at 00:39:32 UTC, mw wrote: On Monday, 22 March 2021 at 23:35:09 UTC, Curtis wrote: Using 2.096.0, I'm getting a number of "undefined reference" ... The code compiles and links with 2.091.1 but I'm not sure what has changed since then that might cause this problem. I

Re: 2.096.0 linker errors

2021-03-23 Thread mw via Digitalmars-d-learn
If it's not a clean up issue, try -- DMD 2.095 or -- LDC 1.25.1 to see if you can build, if yes, then it could be a bug of 2.096

Re: 2.096.0 linker errors

2021-03-23 Thread Curtis via Digitalmars-d-learn
On Tuesday, 23 March 2021 at 16:04:49 UTC, mw wrote: Just want to make sure: what I mean is $HOME/.dub/ the whole *dir* tree, it contains all the 3rd party packages; not a single file. I don't have a $HOME/.dub/ directory, but I did delete the whole .dub/ directory in the project I am trying

Manually check struct invariants

2021-03-23 Thread Q. Schroll via Digitalmars-d-learn
For a class object obj, one can use assert(obj) to get its invariants checked. How to do this for structs?

Re: 2.096.0 linker errors

2021-03-23 Thread Curtis via Digitalmars-d-learn
On Tuesday, 23 March 2021 at 17:19:10 UTC, mw wrote: If it's not a clean up issue, try -- DMD 2.095 or -- LDC 1.25.1 to see if you can build, if yes, then it could be a bug of 2.096 I tried compiling with both DMD 2.095.1 and LDC 1.25.1 and still got the linker errors. Then I tried

Re: Manually check struct invariants

2021-03-23 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 23 March 2021 at 22:22:12 UTC, Q. Schroll wrote: For a class object obj, one can use assert(obj) to get its invariants checked. How to do this for structs? It's called after the constructor has run and before the destructor is called. It's called before entering a member

Re: 2.096.0 linker errors

2021-03-23 Thread Curtis via Digitalmars-d-learn
https://github.com/dlang/dub/issues/2119

Re: Manually check struct invariants

2021-03-23 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 23 March 2021 at 22:22:12 UTC, Q. Schroll wrote: For a class object obj, one can use assert(obj) to get its invariants checked. How to do this for structs? https://dlang.org/spec/expression.html#assert_expressions If the first AssignExpression is a pointer to a struct instance

Re: Manually check struct invariants

2021-03-23 Thread Ali Çehreli via Digitalmars-d-learn
On 3/23/21 4:14 PM, Imperatorn wrote:> On Tuesday, 23 March 2021 at 22:22:12 UTC, Q. Schroll wrote: >> For a class object obj, one can use assert(obj) to get its invariants >> checked. How to do this for structs? > > It's called after the constructor has run and before the destructor is >