Re: Garbage collection and closures.

2017-06-17 Thread ANtlord via Digitalmars-d-learn
On Saturday, 17 June 2017 at 17:15:50 UTC, Adam D. Ruppe wrote: On Saturday, 17 June 2017 at 14:19:34 UTC, ANtlord wrote: Excuse me, I can't get what does it mean "deepest-referenced". What the deep you mean? The deep of a closure or deep of the function where the variable is defined. Can you

Re: Garbage collection and closures.

2017-06-17 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 17 June 2017 at 14:19:34 UTC, ANtlord wrote: Excuse me, I can't get what does it mean "deepest-referenced". What the deep you mean? The deep of a closure or deep of the function where the variable is defined. Can you give an example code? Where the variable is defined that is

Re: Garbage collection and closures.

2017-06-17 Thread ANtlord via Digitalmars-d-learn
On Saturday, 17 June 2017 at 13:13:17 UTC, Adam D. Ruppe wrote: On Saturday, 17 June 2017 at 13:03:28 UTC, ANtlord wrote: Is GC called every iteration of this loop? No, it will once on scope entry; where the deepest-referenced variable that is actually captured is defined. The compiler

Re: Garbage collection and closures.

2017-06-17 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 17 June 2017 at 13:03:28 UTC, ANtlord wrote: Is GC called every iteration of this loop? No, it will once on scope entry; where the deepest-referenced variable that is actually captured is defined. The compiler allocates heap space instead of stack space for the locals, then

Garbage collection and closures.

2017-06-17 Thread ANtlord via Digitalmars-d-learn
Hello! I can't understand one thing related to closures and calling of GC. I have the following demo snippet, where a closure is passed to `receive` function in a loop. bool isDone = false; while(!isDone) receive((bool val){ isDone = val }); Is GC called every iteration of this loop?

Re: Simple c header => Dlang constants using mixins in compile time

2017-06-17 Thread Igor Shirkalin via Digitalmars-d-learn
On Saturday, 17 June 2017 at 11:23:52 UTC, Cym13 wrote: On Saturday, 17 June 2017 at 11:20:53 UTC, Igor Shirkalin wrote: [...] I'm sure others will have cleaner solutions as as a quick hack you can read the file at compile time, modify it, and compile the D code on the go: [...] Thanks

Re: Simple c header => Dlang constants using mixins in compile time

2017-06-17 Thread Cym13 via Digitalmars-d-learn
On Saturday, 17 June 2017 at 11:20:53 UTC, Igor Shirkalin wrote: On Saturday, 17 June 2017 at 11:10:47 UTC, Igor wrote: On Saturday, 17 June 2017 at 10:56:52 UTC, Igor Shirkalin wrote: Hello! I have a simple C header file that looks like: #define Name1 101 #define Name2 122 #define NameN

Re: Simple c header => Dlang constants using mixins in compile time

2017-06-17 Thread Igor Shirkalin via Digitalmars-d-learn
On Saturday, 17 June 2017 at 11:10:47 UTC, Igor wrote: On Saturday, 17 June 2017 at 10:56:52 UTC, Igor Shirkalin wrote: Hello! I have a simple C header file that looks like: #define Name1 101 #define Name2 122 #define NameN 157 It comes from resource compiler and I need all these

Re: Simple c header => Dlang constants using mixins in compile time

2017-06-17 Thread Igor via Digitalmars-d-learn
On Saturday, 17 June 2017 at 10:56:52 UTC, Igor Shirkalin wrote: Hello! I have a simple C header file that looks like: #define Name1 101 #define Name2 122 #define NameN 157 It comes from resource compiler and I need all these constants to be available in my Dlang program in compile time.

Simple c header => Dlang constants using mixins in compile time

2017-06-17 Thread Igor Shirkalin via Digitalmars-d-learn
Hello! I have a simple C header file that looks like: #define Name1 101 #define Name2 122 #define NameN 157 It comes from resource compiler and I need all these constants to be available in my Dlang program in compile time. It seems to me it is possible. I know I can simply write

Re: GStreamer and D

2017-06-17 Thread Mike Wey via Digitalmars-d-learn
On 06/17/2017 01:34 AM, Jay Norwood wrote: gst_plugin_feature_get_name This is a macro, the alternative: ``` import gobject.Value; Value name; feature.getProperty("name", name); name.getString(); ``` or if you don't want to use GValue. ```

Re: Calling delegate in a dll callback fails silently

2017-06-17 Thread Andre Pany via Digitalmars-d-learn
On Saturday, 17 June 2017 at 03:35:42 UTC, Adam D. Ruppe wrote: On Friday, 16 June 2017 at 22:17:07 UTC, Andre Pany wrote: [...] What is the type of dg there? This looks horribly, horribly wrong to me. [...] Thanks a lot for the explanation and the link. Now it makes sense why it not