Specifying executable names in DUB

2019-06-17 Thread Dave via Digitalmars-d-learn
Greetings, This might be totally obvious, but I can't seem to figure out how to specify an executable's name&path to be different for each build types in my DUB package. For example, if my project is named "dlang_test", I might want something like so: dub build --build=debug yields either

C++ base constructor call vs. D's

2019-10-02 Thread Just Dave via Digitalmars-d-learn
I was reading the C++ to D page, and came across this little bit about when to call the base class constructor: "It's superior to C++ in that the base constructor call can be flexibly placed anywhere in the derived constructor." Isn't there some inherent danger of not calling the base constr

Does Visual D actually work?

2019-10-07 Thread Just Dave via Digitalmars-d-learn
I downloaded it after experiencing debugging issues with CodeBlocks (it wouldn't attach the provided debugger). I downloaded Visual D and after some fiddling with Visual Studio 2019 not supporting third party templates in my version (had to update it), I haven't been able to get Visual D to com

Re: Does Visual D actually work?

2019-10-07 Thread Just Dave via Digitalmars-d-learn
A machine reboot seems to have fixed the problem...

Dynamic Arrays as Stack and/or Queue

2019-10-07 Thread Just Dave via Digitalmars-d-learn
I need a stack and a queue and I noticed that the standard library doesn't appear to have one. Which is ok. I just need something that can logically behave as a stack and queue, which I think the dynamic array should be able to do (if I understand correctly this is effectively the equivalent of

Re: Dynamic Arrays as Stack and/or Queue

2019-10-07 Thread Just Dave via Digitalmars-d-learn
On Monday, 7 October 2019 at 17:18:03 UTC, bachmeier wrote: On Monday, 7 October 2019 at 17:11:08 UTC, Just Dave wrote: I need a stack and a queue and I noticed that the standard library doesn't appear to have one. Which is ok. I just need something that can logically behave as a stack and queu

Re: Dynamic Arrays as Stack and/or Queue

2019-10-07 Thread Just Dave via Digitalmars-d-learn
On Monday, 7 October 2019 at 17:24:19 UTC, Ferhat Kurtulmuş wrote: On Monday, 7 October 2019 at 17:11:08 UTC, Just Dave wrote: I need a stack and a queue and I noticed that the standard library doesn't appear to have one. Which is ok. I just need something that can logically behave as a stack a

Re: Dynamic Arrays as Stack and/or Queue

2019-10-08 Thread Just Dave via Digitalmars-d-learn
Thanks for the advice. I used a quick and dirty range solution as was suggested. It allowed me to move on as I really wasn't looking to fully implement a queue or stack. Just get something that semantically behaved as such. I'll return later and optimize it with the later suggestions if it's a

C#'s 'is' equivalent in D

2019-10-10 Thread Just Dave via Digitalmars-d-learn
In C# you can do something like: if (obj is Person) { var person = obj as Person; // do stuff with person... } where you can check the type of an object prior to casting. Does D have a similar mechanism? It's so widely useful in the C# realm that they even added sy

Re: C#'s 'is' equivalent in D

2019-10-10 Thread Just Dave via Digitalmars-d-learn
Even though static solutions would be more performance minded, I'd actually prefer to see the runtime equivalent so I don't have to rethink how I think as performance isn't really my major concern right now.

Difference between template and mixin template

2019-10-10 Thread Just Dave via Digitalmars-d-learn
I'm trying to get my head around mixing templates. I'm using it as kind of a replacement for class inheritance as it seems to fit better composition over inheritance. So I do something like: mixin template NumberTemplate() { private: int number = 0; public: int g

Re: C#'s 'is' equivalent in D

2019-10-10 Thread Just Dave via Digitalmars-d-learn
On Thursday, 10 October 2019 at 15:53:20 UTC, Adam D. Ruppe wrote: On Thursday, 10 October 2019 at 15:47:58 UTC, Just Dave wrote: if (obj is Person person) Looks the same as D's if(auto person = cast(Person) obj) { // use person in here } else { // it was some other type } Excellent

Re: Difference between template and mixin template

2019-10-10 Thread Just Dave via Digitalmars-d-learn
On Thursday, 10 October 2019 at 15:56:36 UTC, Just Dave wrote: I'm trying to get my head around mixing templates. I'm using it as kind of a replacement for class inheritance as it seems to fit better composition over inheritance. So I do something like: mixin template NumberTemplate()

How Different Are Templates from Generics

2019-10-11 Thread Just Dave via Digitalmars-d-learn
I come from both a C++ and C# background. Those have been the primary languages I have used. In C# you can do something like this: public interface ISomeInterface { T Value { get; } } public class SomeClass : ISomeInterface { T Value { get; set; } }

Re: How Different Are Templates from Generics

2019-10-11 Thread Just Dave via Digitalmars-d-learn
Thanks for the thorough explanation. Most of that is how I was thinking it worked. However, that leaves me perplexed. If templates just generate code then how come: Wouldnt.. class SomeClass(T) : ISomeInterface!T and.. class SomeOtherClass(T) : ISomeInterface!T ...generate two diffe