Re: public vs private alias this

2022-11-01 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 1 November 2022 at 23:01:57 UTC, Per Nordlöw wrote: When is it preferrable to use ```d struct S { private T t; alias t this; } ``` instead of ```d struct S { public T t; alias t this; } ``` for any given type `T`? If the `alias this` needs to work outside the module where `S` is

Re: Make IN Dlang

2022-11-01 Thread rikki cattermole via Digitalmars-d-learn
Something to consider: dub can be used as a library. You can add your own logic in main to allow using your build specification to generate a dub file (either in memory or in file system).

Re: Make IN Dlang

2022-11-01 Thread Tejas via Digitalmars-d-learn
On Tuesday, 1 November 2022 at 23:40:22 UTC, Christian Köstlin wrote: Dear dlang-folk, one of the tools I always return to is rake (https://ruby.github.io/rake/). For those that do not know it, its a little like make in the sense that you describe your build as a graph of tasks with dependenc

Re: Make IN Dlang

2022-11-01 Thread Adam D Ruppe via Digitalmars-d-learn
I don't have specific answers to your questions but your goal sounds similar to Atila's reggae project so it might be good for you to take a look at: https://code.dlang.org/packages/reggae

Make IN Dlang

2022-11-01 Thread Christian Köstlin via Digitalmars-d-learn
Dear dlang-folk, one of the tools I always return to is rake (https://ruby.github.io/rake/). For those that do not know it, its a little like make in the sense that you describe your build as a graph of tasks with dependencies between them, but in contrast to make the definition is written in

public vs private alias this

2022-11-01 Thread Per Nordlöw via Digitalmars-d-learn
When is it preferrable to use ```d struct S { private T t; alias t this; } ``` instead of ```d struct S { public T t; alias t this; } ``` for any given type `T`?

Re: druntime thread (from foreach parallel?) cleanup bug

2022-11-01 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 1 November 2022 at 19:49:47 UTC, mw wrote: On Tuesday, 1 November 2022 at 18:18:45 UTC, Steven Schveighoffer wrote: [...] Maybe the hunt library author doesn't know. (My code does not directly use this library, it got pulled in by some other decencies.) [...] Please, if you

Re: druntime thread (from foreach parallel?) cleanup bug

2022-11-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On Tuesday, 1 November 2022 at 18:18:45 UTC, Steven Schveighoffer wrote: Oh yeah, isDaemon detaches the thread from the GC. Don't do that unless you know what you are doing. As discussed on discord, this isn't actually true. All it does is prevent the thread from being joined before exiting

Re: druntime thread (from foreach parallel?) cleanup bug

2022-11-01 Thread mw via Digitalmars-d-learn
On Tuesday, 1 November 2022 at 18:18:45 UTC, Steven Schveighoffer wrote: And I just noticed, one of the thread trace points to here: https://github.com/huntlabs/hunt/blob/master/source/hunt/util/DateTime.d#L430 ``` class DateTime {   shared static this() {     ...     dateThread.isDaemon

Re: druntime thread (from foreach parallel?) cleanup bug

2022-11-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On Tuesday, 1 November 2022 at 18:18:45 UTC, Steven Schveighoffer wrote: Oh yeah, isDaemon detaches the thread from the GC. Don't do that unless you know what you are doing. As discussed on discord, this isn't true actually. All it does is prevent the thread from being joined before exiting

Re: druntime thread (from foreach parallel?) cleanup bug

2022-11-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/1/22 1:47 PM, mw wrote: Can you show a code snippet that includes the parallel foreach? (It's just a very straight forward foreach on an array; as I said it may not be relevant.) And I just noticed, one of the thread trace points to here: https://github.com/huntlabs/hunt/blob/master/

Re: druntime thread (from foreach parallel?) cleanup bug

2022-11-01 Thread mw via Digitalmars-d-learn
Can you show a code snippet that includes the parallel foreach? (It's just a very straight forward foreach on an array; as I said it may not be relevant.) And I just noticed, one of the thread trace points to here: https://github.com/huntlabs/hunt/blob/master/source/hunt/util/DateTime.d#L43

Re: druntime thread (from foreach parallel?) cleanup bug

2022-11-01 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Nov 01, 2022 at 10:37:57AM -0700, Ali Çehreli via Digitalmars-d-learn wrote: > On 11/1/22 10:27, H. S. Teoh wrote: > > > Maybe try running Digger to reduce the code for you? > > Did you mean dustmite, which is accessible as 'dub dustmite > ' but I haven't used it. Oh yes, sorry, I meant

Re: druntime thread (from foreach parallel?) cleanup bug

2022-11-01 Thread Ali Çehreli via Digitalmars-d-learn
On 11/1/22 10:27, H. S. Teoh wrote: > Maybe try running Digger to reduce the code for you? Did you mean dustmite, which is accessible as 'dub dustmite ' but I haven't used it. My guess for the segmentation fault is that the OP is executing destructor code that assumes some members are alive.

Re: druntime thread (from foreach parallel?) cleanup bug

2022-11-01 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Nov 01, 2022 at 05:19:56PM +, mw via Digitalmars-d-learn wrote: > My program received signal SIGSEGV, Segmentation fault. > > Its simplified structure looks like this: > > ``` > void foo() { > ... > writeln("done"); // saw this got printed! > } > > int main() { > foo(); > re

druntime thread (from foreach parallel?) cleanup bug

2022-11-01 Thread mw via Digitalmars-d-learn
My program received signal SIGSEGV, Segmentation fault. Its simplified structure looks like this: ``` void foo() { ... writeln("done"); // saw this got printed! } int main() { foo(); return 0; } ``` So, just before the program exit, it failed. I suspect druntime has a thread (maybe

Re: A strange DMD error

2022-11-01 Thread ryuukk_ via Digitalmars-d-learn
This reminds me of an issue i reported last year... https://issues.dlang.org/show_bug.cgi?id=22583

Re: A strange DMD error

2022-11-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/1/22 11:40 AM, Keivan Shah wrote: Hello, Today I came across a strange bug while using D with `dmd`. I have still not been able to figure out under what conditions does it happen but it seems to be a DMD related bug to me. Here is a reproducible snippet of the code ```D import std; a

Re: A strange DMD error

2022-11-01 Thread Tejas via Digitalmars-d-learn
On Tuesday, 1 November 2022 at 15:49:54 UTC, Keivan Shah wrote: On Tuesday, 1 November 2022 at 15:42:43 UTC, Imperatorn wrote: On Tuesday, 1 November 2022 at 15:40:04 UTC, Keivan Shah wrote: Hello, Today I came across a strange bug while using D with `dmd`. I have still not been able to figur

Re: A strange DMD error

2022-11-01 Thread Keivan Shah via Digitalmars-d-learn
On Tuesday, 1 November 2022 at 16:06:44 UTC, Imperatorn wrote: Hehe. One simple thing you could do is to create a struct instead for you params and pass that Yeah, can do, thanks for the suggestion. But anyways still want to see if anyone else has seen this issue, or has a clue about what

Hipreme's #3 Tip of the day - Changing DMD linker on Windows

2022-11-01 Thread Hipreme via Digitalmars-d-learn
The linker used on Windows when installing DMD is pretty much decided on how your PC was setup. - If you had Visual Studio installed on your windows for "Desktop Development with C++" before downloading DMD (from the site and setup), you will pretty have MSVC Linker as a default. - If you inst

Re: A strange DMD error

2022-11-01 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 1 November 2022 at 15:49:54 UTC, Keivan Shah wrote: On Tuesday, 1 November 2022 at 15:42:43 UTC, Imperatorn wrote: On Tuesday, 1 November 2022 at 15:40:04 UTC, Keivan Shah wrote: [...] Could be there's some restriction in DMD on number of arguments. May I ask if this was just a

Re: Can't seem to find the relevant documentation for dub.

2022-11-01 Thread WhatMeWorry via Digitalmars-d-learn
On Monday, 31 October 2022 at 20:31:11 UTC, ryuukk_ wrote: On Monday, 31 October 2022 at 20:20:49 UTC, WhatMeWorry wrote: I've got a pretty straightforward SDL dub file dependency "bindbc-opengl"version="~>1.0.3" versions "GL_46" dependency "bindbc-glfw" version="~>1.0.1" versions "GLFW

Re: A strange DMD error

2022-11-01 Thread Keivan Shah via Digitalmars-d-learn
On Tuesday, 1 November 2022 at 15:42:43 UTC, Imperatorn wrote: On Tuesday, 1 November 2022 at 15:40:04 UTC, Keivan Shah wrote: Hello, Today I came across a strange bug while using D with `dmd`. I have still not been able to figure out under what conditions does it happen but it seems to be a

Re: A strange DMD error

2022-11-01 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 1 November 2022 at 15:40:04 UTC, Keivan Shah wrote: Hello, Today I came across a strange bug while using D with `dmd`. I have still not been able to figure out under what conditions does it happen but it seems to be a DMD related bug to me. Here is a reproducible snippet of the co

A strange DMD error

2022-11-01 Thread Keivan Shah via Digitalmars-d-learn
Hello, Today I came across a strange bug while using D with `dmd`. I have still not been able to figure out under what conditions does it happen but it seems to be a DMD related bug to me. Here is a reproducible snippet of the code ```D import std; alias DG = void delegate(); class TType {