Re: Learning delegates

2019-09-10 Thread Bert via Digitalmars-d-learn
On Sunday, 8 September 2019 at 10:04:57 UTC, Joel wrote: I'm trying to understand delegates. Is there any good ways I can get a better understanding of them? Simple, don't make it harder than it is. Delegates are basically functions... that is, function pointers(they point to some function

Re: Function Arguments with Multiple Types

2019-09-07 Thread Bert via Digitalmars-d-learn
On Friday, 6 September 2019 at 20:02:35 UTC, Bob4 wrote: Hi, I'm coming from a background in Python, without a lot of experience in statically typed languages, and I'm struggling to see how to make a certain function in D. This is what I have in Python: ``` from typing import Union Number

Shadertoy in Dcompute?

2019-08-21 Thread Bert via Digitalmars-d-learn
How hard would it be to do something like Shadertoy in Dcompute and would it be any faster? I don't like the basics of Shadertoy, lots of nonsense to do basic stuff. E.g., to work with complex numbers one must essentially do everything manually. Would there be any benefit using

Re: error : outer function context of `D main` is needed to `new` nested class `main.main.X`

2019-08-16 Thread Bert via Digitalmars-d-learn
On Thursday, 15 August 2019 at 02:23:06 UTC, Adam D. Ruppe wrote: On Thursday, 15 August 2019 at 01:55:17 UTC, Bert wrote: void main() { class X { ... } I would just make it `static class X` and then it should work fine. Won't be able to access main's local variables then though, but

error : outer function context of `D main` is needed to `new` nested class `main.main.X`

2019-08-14 Thread Bert via Digitalmars-d-learn
void main() { class X { ... } auto f = foo!X; } then in another module I have a templated function foo that simply new's x: auto foo(T)() { return new T; } yet I get the error. I realize that X is local to main and I realize I could do something like foo(new X); but that

Re: Local static class fields

2019-08-14 Thread Bert via Digitalmars-d-learn
On Tuesday, 13 August 2019 at 00:17:13 UTC, DanielG wrote: On Monday, 12 August 2019 at 22:48:43 UTC, Bert wrote: I have a recursive class structure(think of a graph or tree) and I need to keep a global state for it, If I'm understanding the problem correctly, it seems like you have a choice

Re: Local static class fields

2019-08-14 Thread Bert via Digitalmars-d-learn
On Tuesday, 13 August 2019 at 12:22:45 UTC, Simen Kjærås wrote: On Tuesday, 13 August 2019 at 08:41:02 UTC, Bert wrote: On Tuesday, 13 August 2019 at 04:43:29 UTC, Paul Backus wrote: It seems to me like the obvious solution is to use two different classes, one to store the global state, and

Re: Local static class fields

2019-08-13 Thread Bert via Digitalmars-d-learn
On Tuesday, 13 August 2019 at 04:43:29 UTC, Paul Backus wrote: On Monday, 12 August 2019 at 22:48:43 UTC, Bert wrote: Making a field static is effectively a global variable to the class. I have a recursive class structure(think of a graph or tree) and I need to keep a global state for it,

Local static class fields

2019-08-12 Thread Bert via Digitalmars-d-learn
Making a field static is effectively a global variable to the class. I have a recursive class structure(think of a graph or tree) and I need to keep a global state for it, but this state actually needs to be different for each tree object. The reason for this is that structurally it will not

Ethan: About your wpf/C# and D integration

2019-08-12 Thread Bert via Digitalmars-d-learn
One of the biggest issues I have with D is properly gui development. It's just a real pain in the ass compared to wpf and C#. I'm curious about what you have done and if it would let me get the best of both worlds. What I'd like to do is write the business end of apps in D and use C# for

Re: Help me decide D or C

2019-07-31 Thread Bert via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 18:38:02 UTC, Alexandre wrote: Hi everyone, I would like an honest opinion. I have a beginner level (able to do very small programs) in a few languages such as python, go, C, guile(scheme) and common lisp. I want to pick a language and go deep with it and focus