Re: struct constructor with rvalue param of same struct type

2021-01-18 Thread Kyle Ingraham via Digitalmars-d-learn
I’m sorry that this isn’t a solution to your problem but your code caught my attention. What is your snippet supposed to do?

Re: How can I create a Standalone Bundle Portable file application using Dlang?

2021-01-18 Thread Imperatorn via Digitalmars-d-learn
On Monday, 18 January 2021 at 19:42:22 UTC, Marcone wrote: How can I create a Standalone Bundle Portable file application using Dlang? Could you describe what you mean with "Bundle portable file application"?

Re: Why many programmers don't like GC?

2021-01-18 Thread Imperatorn via Digitalmars-d-learn
On Monday, 18 January 2021 at 12:41:31 UTC, Ola Fosheim Grøstad wrote: On Monday, 18 January 2021 at 12:17:24 UTC, aberba wrote: [...] Not fighting the GC, but the whole argument about improving it, or mix or match, does not work for most developers looking for a new language. So either ther

Re: Why many programmers don't like GC?

2021-01-18 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Monday, 18 January 2021 at 15:18:40 UTC, aberba wrote: 1). You're not a minority at all. System programming is also vast so having a GC (especially D's special kind of GC) is nothing alien in System programming. If you look out there, This is not true, and you know it. There is nothing spe

Re: How do I make a template function that only accepts instances of a specific class?

2021-01-18 Thread Jack via Digitalmars-d-learn
On Monday, 18 January 2021 at 19:54:04 UTC, Adam D. Ruppe wrote: On Monday, 18 January 2021 at 19:34:52 UTC, Jack wrote: is that sytax derived from there? sort of. it is the type pattern matching "is expression" described here: https://dlang.org/spec/expression.html#IsExpression I read st

Re: How do I enable visual styles?

2021-01-18 Thread Jack via Digitalmars-d-learn
On Monday, 18 January 2021 at 19:50:18 UTC, Adam D. Ruppe wrote: I haven't played with the pragma yet but I've done it before both with the file.exe.manifest XML file sitting alongside it and with the resource compiler before (you can use the same resource compilers for D as you use for C btw)

Re: How do I make a template function that only accepts instances of a specific class?

2021-01-18 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 18 January 2021 at 19:34:52 UTC, Jack wrote: is that sytax derived from there? sort of. it is the type pattern matching "is expression" described here: https://dlang.org/spec/expression.html#IsExpression The is(A:B) thing technically means "if A is implicitly convertible to B" w

Re: How do I enable visual styles?

2021-01-18 Thread Adam D. Ruppe via Digitalmars-d-learn
I haven't played with the pragma yet but I've done it before both with the file.exe.manifest XML file sitting alongside it and with the resource compiler before (you can use the same resource compilers for D as you use for C btw)

How can I create a Standalone Bundle Portable file application using Dlang?

2021-01-18 Thread Marcone via Digitalmars-d-learn
How can I create a Standalone Bundle Portable file application using Dlang?

How do I enable visual styles?

2021-01-18 Thread Jack via Digitalmars-d-learn
Currently I'm using dmd but the release binaries I'll be usind ldc. Is this how I can enable visual styles on dmd? and how is this done on ldc? pragma(linkerDirective, "\"/manifestdependency:type='win32' " ~ "name='Microsoft.Windows.Common-Controls' version='6.0

Re: How do I make a template function that only accepts instances of a specific class?

2021-01-18 Thread Jack via Digitalmars-d-learn
On Monday, 18 January 2021 at 19:02:10 UTC, Adam D. Ruppe wrote: On Monday, 18 January 2021 at 18:40:37 UTC, Jack wrote: isInstanceOf from std.traits seems to not work with class the way I need to. I'd like to make a template function accepts only class of a specified class type class A { } c

Re: How do I make a template function that only accepts instances of a specific class?

2021-01-18 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 18 January 2021 at 18:40:37 UTC, Jack wrote: isInstanceOf from std.traits seems to not work with class the way I need to. I'd like to make a template function accepts only class of a specified class type class A { } class B : A { } class C : A { } int f(T)(in A[int] arr) Use if(

Re: foreach, RefCounted and non-copyable range

2021-01-18 Thread vitamin via Digitalmars-d-learn
On Sunday, 17 January 2021 at 12:15:00 UTC, Fynn Schröder wrote: 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 some

How do I make a template function that only accepts instances of a specific class?

2021-01-18 Thread Jack via Digitalmars-d-learn
isInstanceOf from std.traits seems to not work with class the way I need to. I'd like to make a template function accepts only class of a specified class type class A { } class B : A { } class C : A { } import std.traits : isInstanceOf; int f(T)(in A[int] arr) if(isInstanceOf!(A, T)) // does

struct constructor with rvalue param of same struct type

2021-01-18 Thread vitamin via Digitalmars-d-learn
Hello, is it possible to create constructor which initialize 'ptr3' with const rvalue of same type? struct Foo{} static struct Ptr{ void* impl; //ctor 1 this(ref const typeof(this) x)pure nothrow @trusted @nogc{/*...*/} //ctor 2 this(const Foo foo)pure nothrow @trusted @

Re: Static constructor

2021-01-18 Thread ludo via Digitalmars-d-learn
The mutex isn't more "global", it's more "local" (although, this will make it shared). Yes shared, this is what I meant by global :) Thanks, it's clearer now.

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

2021-01-18 Thread Jack via Digitalmars-d-learn
On Monday, 18 January 2021 at 03:30:56 UTC, Paul Backus wrote: 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 diff

Re: Why many programmers don't like GC?

2021-01-18 Thread aberba via Digitalmars-d-learn
On Monday, 18 January 2021 at 13:14:16 UTC, Arafel wrote: On 18/1/21 13:41, Ola Fosheim Grøstad wrote: Yes, it is natural that the current D population don't mind the current GC. Otherwise they would be gone... but then you have to factor in all the people that go through the revolving door an

Re: using dub and -checkaction=context

2021-01-18 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/18/21 7:48 AM, Mathias LANG wrote: On Sunday, 17 January 2021 at 20:42:06 UTC, Steven Schveighoffer wrote: 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 ne

Re: Static constructor

2021-01-18 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/17/21 6:54 PM, ludo wrote: Yes alright. I think the dev made a design mistake because he called synchronized( OpenAL.mutex ) when it should be more of a global, non OpenAL specific, mutex. I mean in the code there were things like (pseudo-code) --- System {   private int[] buffer   fu

Re: Why many programmers don't like GC?

2021-01-18 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Monday, 18 January 2021 at 13:14:16 UTC, Arafel wrote: I must be in the minority here because one of the reasons why I started using D was precisely because it HAS a GC with full support. I wouldn't even have considered it if it hadn't. You are probably not in a minority among those that us

Re: Why many programmers don't like GC?

2021-01-18 Thread Arafel via Digitalmars-d-learn
On 18/1/21 13:41, Ola Fosheim Grøstad wrote: Yes, it is natural that the current D population don't mind the current GC. Otherwise they would be gone... but then you have to factor in all the people that go through the revolving door and does not stay. If they stayed the eco system would be bet

Re: using dub and -checkaction=context

2021-01-18 Thread Mathias LANG via Digitalmars-d-learn
On Sunday, 17 January 2021 at 20:42:06 UTC, Steven Schveighoffer wrote: 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 h

Re: Why many programmers don't like GC?

2021-01-18 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Monday, 18 January 2021 at 12:17:24 UTC, aberba wrote: If you read the Origin of D book, you would see that the GC was a desire thing when D was designed probably due to how useful it is for ... as said, 90% or so of software development. So at this point, fighting the GC isn't (in my opinio

Re: Why many programmers don't like GC?

2021-01-18 Thread Imperatorn via Digitalmars-d-learn
On Friday, 15 January 2021 at 21:49:07 UTC, H. S. Teoh wrote: On Fri, Jan 15, 2021 at 09:04:13PM +, welkam via Digitalmars-d-learn wrote: [...] As the joke goes, "you can write assembly code in any language". :-D If you code in a sloppy way, it doesn't matter what language you write in,

Re: Why many programmers don't like GC?

2021-01-18 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Jan 18, 2021 at 11:43:20AM +, aberba via Digitalmars-d-learn wrote: [...] > It talks how the use of GC is desired even in a game engine like > Unreal. Several AAA title's have been built on Unreal. > > Apparently you can't convince people who have made up their mind about > GC being a

Re: Why many programmers don't like GC?

2021-01-18 Thread aberba via Digitalmars-d-learn
On Monday, 18 January 2021 at 11:55:46 UTC, Ola Fosheim Grøstad wrote: On Monday, 18 January 2021 at 11:43:20 UTC, aberba wrote: Nevertheless, GC in D isn't going anywhere. And if the approach for writing nogc code in D doesn't cut it, then I'm not what else will. As long as that attitude pre

Re: Why many programmers don't like GC?

2021-01-18 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Monday, 18 January 2021 at 11:43:20 UTC, aberba wrote: Nevertheless, GC in D isn't going anywhere. And if the approach for writing nogc code in D doesn't cut it, then I'm not what else will. As long as that attitude prevails, D will be going nowhere as well.

Re: Why many programmers don't like GC?

2021-01-18 Thread aberba via Digitalmars-d-learn
On Monday, 18 January 2021 at 07:11:20 UTC, Ola Fosheim Grostad wrote: 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 nothin