Re: How to unit-test behavior under "version"?

2022-03-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/29/22 8:57 PM, Andrey Zherikov wrote: On Tuesday, 29 March 2022 at 20:20:46 UTC, Steven Schveighoffer wrote: So keep in mind that versions are *module-wide*, and usually *compilation-wide*. Which means that you won't be testing multiple version configurations in the same build. ... In

Re: How do you properly use immutable on class members?

2022-03-29 Thread Fruitful Approach via Digitalmars-d-learn
On Tuesday, 29 March 2022 at 18:59:41 UTC, H. S. Teoh wrote: On Tue, Mar 29, 2022 at 05:58:11PM +, Fruitful Approach via Digitalmars-d-learn wrote: [...] 1) `immutable immutable(Prop)[]` is identical to `immutable(Prop[])`. Immutable is transitive. There is no need to spell it in

Re: How do you properly use immutable on class members?

2022-03-29 Thread Salih Dincer via Digitalmars-d-learn
On Tuesday, 29 March 2022 at 19:26:51 UTC, Ali Çehreli wrote: Better yet, and as I know you know :), and as it comes up occasionally but I usually forget in my own code; 'in' is much better than 'const' on function parameters because it has super powers when compiled with -preview=in:

Re: How to unit-test behavior under "version"?

2022-03-29 Thread Andrey Zherikov via Digitalmars-d-learn
On Tuesday, 29 March 2022 at 20:20:46 UTC, Steven Schveighoffer wrote: So keep in mind that versions are *module-wide*, and usually *compilation-wide*. Which means that you won't be testing multiple version configurations in the same build. ... In the case where version is going to *affect

Re: How to unit-test behavior under "version"?

2022-03-29 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 29 March 2022 at 19:55:52 UTC, Andrey Zherikov wrote: I have a function below (just an example). What's the recommended way to unit-test it for all `version` cases? ```d void f() { import std.stdio: writeln; version(foo) writeln("foo"); else

Re: arsd-minigui - couple of questions

2022-03-29 Thread sai via Digitalmars-d-learn
On Monday, 28 March 2022 at 23:03:01 UTC, Adam Ruppe wrote: In fact, using a pragma now, I think I got it so you don't even need the manifest now (the pragma includes a default one now). Only works when doing dmd -m32mscoff or dmd -m64 builds (which are also what dub uses fyi), will NOT work

Re: arsd-minigui - couple of questions

2022-03-29 Thread sai via Digitalmars-d-learn
Actually as you mentioned, I did find the changes in minigui.d file. I will try tweaking the pragma there see if anything works.

Re: arsd-minigui - couple of questions

2022-03-29 Thread Adam D Ruppe via Digitalmars-d-learn
On Tuesday, 29 March 2022 at 14:24:13 UTC, sai wrote: Seems like a linker bug? So we have to wait for the fix to show up in dmd package. I just tried copying the lld-link from llvm version 14 upstream into the dmd directory and it does fix the problem, so will try to get the dmd release

Re: arsd-minigui - couple of questions

2022-03-29 Thread sai via Digitalmars-d-learn
Interestingly I get the same error if I change the pragma test to "BLAH" lld-link: error: BLAH is not allowed in .drectve I suspect something is going wrong when passing the linker options from pragma to the linker itself. However, if I uncomment the pragma and explicitly place the

Re: arsd-minigui - couple of questions

2022-03-29 Thread sai via Digitalmars-d-learn
Found this: https://bugs.llvm.org/show_bug.cgi?id=38797 Seems like a linker bug? So we have to wait for the fix to show up in dmd package.

Re: arsd-minigui - couple of questions

2022-03-29 Thread Adam D Ruppe via Digitalmars-d-learn
On Tuesday, 29 March 2022 at 13:39:25 UTC, sai wrote: I searched for "manifestdependency" and "drectve" (w/o quotes) in arsd lib and couldn't find them so not sure how to debug this further. Ah sorry, you caught me in the middle of something. Yes, I remember seeing this before, lld-link is

Re: arsd-minigui - couple of questions

2022-03-29 Thread sai via Digitalmars-d-learn
Thanks Adam for all the help :)

How do you properly use immutable on class members?

2022-03-29 Thread Fruitful Approach via Digitalmars-d-learn
I have immutable members: `immutable immutable(Prop)[] axioms` which I can't initialize with Prop[], so I call this "immutable-poisoning" of the rest of my code. Can you provide a 10 line example of how to best work with immutable types, specifically immutable members, together with ctor,

Re: How do you properly use immutable on class members?

2022-03-29 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Mar 29, 2022 at 05:58:11PM +, Fruitful Approach via Digitalmars-d-learn wrote: > I have immutable members: > > `immutable immutable(Prop)[] axioms` which I can't initialize with > Prop[], so I call this "immutable-poisoning" of the rest of my code. > Can you provide a 10 line example

Re: How do you properly use immutable on class members?

2022-03-29 Thread Ali Çehreli via Digitalmars-d-learn
On 3/29/22 11:59, H. S. Teoh wrote: > As a general principle, const should be used when you're on the > receiving end of data that should not be changed (e.g., function > parameters) Better yet, and as I know you know :), and as it comes up occasionally but I usually forget in my own code;

Re: How do you properly use immutable on class members?

2022-03-29 Thread Ali Çehreli via Digitalmars-d-learn
On 3/29/22 10:58, Fruitful Approach wrote: > so I end up undoing all the places I inserted it. That's what I do as well, which proves my 'const' object only hoped to be 'const'. I never say "I have to respect my decision from 10 minutes ago, so I must keep this object const." Nope! 'const' is

How to unit-test behavior under "version"?

2022-03-29 Thread Andrey Zherikov via Digitalmars-d-learn
I have a function below (just an example). What's the recommended way to unit-test it for all `version` cases? ```d void f() { import std.stdio: writeln; version(foo) writeln("foo"); else writeln("no foo"); } ```

Re: How to unit-test behavior under "version"?

2022-03-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/29/22 3:55 PM, Andrey Zherikov wrote: I have a function below (just an example). What's the recommended way to unit-test it for all `version` cases? ```d void f() { import std.stdio: writeln;     version(foo)     writeln("foo");     else     writeln("no foo"); } ``` So