Re: Template argument deduction not working with template specialization

2021-01-17 Thread Paul via Digitalmars-d-learn
I just figured out half of my frustration is caused by a collision between the 'alias this'd template possibillity and the normal one. For example: struct Bar(uint size, V) { V[size] blup; alias blup this; } void foo(S : T[], T)(S a) { pragma(msg, "first"); } void

Re: Generating documentation help

2021-01-17 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 17 January 2021 at 21:07:31 UTC, Tim wrote: Hi there, I have a couple of (probably) fairly simple questions. First, when I generate documentation files (-Dd docs) for my project, it also generates documentation for the library Mir. How can I fix the compiler pulling in those docs

Re: Static constructor

2021-01-17 Thread ludo via Digitalmars-d-learn
Thanks, as explained I am indeed porting old code. No on the AA (as noted above). The mutex *is* created on demand. Every Object can have a mutex, and it's only created when you synchronize it for the first time. Yes alright. I think the dev made a design mistake because he called

Re: Template argument deduction not working with template specialization

2021-01-17 Thread Paul via Digitalmars-d-learn
On Sunday, 17 January 2021 at 16:42:27 UTC, Steven Schveighoffer wrote: I've always hated that aspect of specialization. I don't really understand why it's valid (how can T be T[]?) I totally agree with that, that confuses me as well. This works: void TFoo(T : U[], U)(T a) Oh cool, that's

Re: using dub and -checkaction=context

2021-01-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/17/21 2:27 PM, Anonymouse wrote: On Sunday, 17 January 2021 at 15:41:45 UTC, Steven Schveighoffer wrote: I'm trying to run unittests using `dub test`, and I wanted to use the new -checkaction=context feature to avoid having to instrument my unittests to print out the string comparison

Re: Template argument deduction not working with template specialization

2021-01-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/17/21 3:41 PM, Paul wrote: On Sunday, 17 January 2021 at 16:42:27 UTC, Steven Schveighoffer wrote: This works: void TFoo(T : U[], U)(T a) Oh cool, that's surprising to say the least. Thanks! This indeed works with argument deduction :) It's basically saying if T matches the pattern

Re: using dub and -checkaction=context

2021-01-17 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 17 January 2021 at 15:41:45 UTC, Steven Schveighoffer wrote: I'm trying to run unittests using `dub test`, and I wanted to use the new -checkaction=context feature to avoid having to instrument my unittests to print out the string comparison failure that's happening. But I tried

Generating documentation help

2021-01-17 Thread Tim via Digitalmars-d-learn
Hi there, I have a couple of (probably) fairly simple questions. First, when I generate documentation files (-Dd docs) for my project, it also generates documentation for the library Mir. How can I fix the compiler pulling in those docs as well? It seems that D won't let me document class

Re: Generating documentation help

2021-01-17 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 17 January 2021 at 21:48:20 UTC, Paul Backus wrote: I recommend using adrdox instead: note you should be able to just dub run adrdox and it will spit out `generated_docs/files...` (assuming i haven't broken that recently)

Re: Why many programmers don't like GC?

2021-01-17 Thread James Blachly via Digitalmars-d-learn
On 1/15/21 4:55 PM, Ola Fosheim Grøstad wrote: On Friday, 15 January 2021 at 21:18:55 UTC, aberba wrote: TL;DR: In summation, the garbage collection system is a robust part of Unreal Engine that affords C++ programmers a lot of safety from memory leaks, as well as convenience. With this

native way to tell if output binary is library or executable?

2021-01-17 Thread Jack via Digitalmars-d-learn
I know I can set version but I'd looking for a native way, if any, to do that. Is possible to tell if output binary is library or executable at compile time? then I'd call different version of a function.

Re: native way to tell if output binary is library or executable?

2021-01-17 Thread Paul Backus via Digitalmars-d-learn
On Monday, 18 January 2021 at 02:24:59 UTC, Jack wrote: I know I can set version but I'd looking for a native way, if any, to do that. Is possible to tell if output binary is library or executable at compile time? then I'd call different version of a function. Add `-version=library` to your

Re: Why many programmers don't like GC?

2021-01-17 Thread Ola Fosheim Grostad via Digitalmars-d-learn
On Monday, 18 January 2021 at 01:41:35 UTC, James Blachly wrote: Those were not aberba's words, but the author of the first link, in which one does find a conceptual, high level description of GC. I read it, it said nothing of relevance to the D collector. That is not TLDR informative.

How to use dguihub package ?

2021-01-17 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I would like to use a gui package called "dguihub". So i did these steps. 1. Downloaded source files from Github. 2. Extract it and copy dguihub folder to my project folder. this folder contains all the source files of this package. 3. Write an import statement in my app.d "import

foreach, RefCounted and non-copyable range

2021-01-17 Thread Fynn Schröder via Digitalmars-d-learn
I'm puzzled why RefCounted and foreach do not work well together, i.e.: ``` auto range = refCounted(nonCopyableRange); // ok foreach(e; range) // Error: struct is not copyable because it is annotated with @disable // do something ``` See https://run.dlang.io/is/u271nK for a full example

Re: Why many programmers don't like GC?

2021-01-17 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Saturday, 16 January 2021 at 00:20:16 UTC, Guillaume Piolat wrote: It's certainly true that in team dynamics, without any reward, efficiency can be victim to a tragedy of commons. Well, any software invariant is harder to hold if the shareholders don't care. (be it "being fast", or "being

using dub and -checkaction=context

2021-01-17 Thread Steven Schveighoffer via Digitalmars-d-learn
I'm trying to run unittests using `dub test`, and I wanted to use the new -checkaction=context feature to avoid having to instrument my unittests to print out the string comparison failure that's happening. But I tried adding this to my dub.sdl file: dflags "-checkaction=context"

Re: How to use dguihub package ?

2021-01-17 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 17 January 2021 at 13:04:33 UTC, Vinod K Chandran wrote: Do i miss something ? Three of those messages include the solution to fix the errors. The fourth one is a missing import (`import std.conv : to`) in dguihub.core.utils. You could fix these yourself and submit a pull

Template argument deduction not working with template specialization

2021-01-17 Thread Paul via Digitalmars-d-learn
While trying to use template specializations I noticed the argument deductions do not yield the same version as the ones yielded when being explicit. Example: uint a = 1; uint[] b = [2]; TFoo(a); TFoo!(uint[])(b); void TFoo(T)(T a) { pragma(msg, "T: " ~ T.stringof); } void TFoo(T

Re: Template argument deduction not working with template specialization

2021-01-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/17/21 11:22 AM, Paul wrote: While trying to use template specializations I noticed the argument deductions do not yield the same version as the ones yielded when being explicit. Example: uint a = 1; uint[] b = [2]; TFoo(a); TFoo!(uint[])(b); void TFoo(T)(T a) { pragma(msg, "T: "