Re: Module without object file?

2022-01-05 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/4/22 5:17 PM, kdevel wrote: Is there any chance to rephrase fsobjects.d such that it becomes a "header only"/"compile only" file of which no object file must be presented to the linker? Possibly. You see, you are importing another module. Since you are doing that, the module must

Re: Module without object file?

2022-01-05 Thread frame via Digitalmars-d-learn
On Tuesday, 4 January 2022 at 22:17:38 UTC, kdevel wrote: Is there any chance to rephrase fsobjects.d such that it becomes a "header only"/"compile only" file of which no object file must be presented to the linker? You didn't show how you compiled your files. If you want the compiler to

Re: Libc functions undefined when linking

2022-01-05 Thread Tejas via Digitalmars-d-learn
On Wednesday, 5 January 2022 at 16:14:02 UTC, Ben Jones wrote: On Wednesday, 5 January 2022 at 03:38:54 UTC, Tejas wrote: On Tuesday, 4 January 2022 at 18:13:56 UTC, Ben Jones wrote: The tricky part is that the lab machines that the students will be using don't have a D compiler installed

Re: std.concurrency and const

2022-01-05 Thread frame via Digitalmars-d-learn
On Wednesday, 5 January 2022 at 22:22:19 UTC, Christian Köstlin wrote: Hi all, I really like std.concurrency but I now stumbled upon the following. When receiving messages as const, they also need to be sent as const (otherwise they are not matched). Comparing this to normal function calls I

Re: mixin does not work as expected

2022-01-05 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jan 05, 2022 at 11:29:08PM +, Era Scarecrow via Digitalmars-d-learn wrote: [...] > That said, rolling your own mixins should really be the last resort. > You're dumping a lot into a single line of code you can't trace, > follow, debug, or look at. Mixins are kinda like the nuclear

Re: mixin does not work as expected

2022-01-05 Thread Era Scarecrow via Digitalmars-d-learn
On Wednesday, 5 January 2022 at 08:40:15 UTC, rempas wrote: I'm trying to use mixins and enums to "expand" code in place but the results are not what I expected and I'm getting an weird error. I have created the smallest possible example to reproduce the error and it is the following: Back

std.concurrency and const

2022-01-05 Thread Christian Köstlin via Digitalmars-d-learn
Hi all, I really like std.concurrency but I now stumbled upon the following. When receiving messages as const, they also need to be sent as const (otherwise they are not matched). Comparing this to normal function calls I would expect a different behavior. ```d import std.concurrency;

Re: Debugging D code with GDB

2022-01-05 Thread Luís Ferreira via Digitalmars-d-learn
On Tue, 2021-11-30 at 09:01 +, Iain Buclaw via Digitalmars-d-learn wrote: > On Monday, 29 November 2021 at 14:48:21 UTC, Luís Ferreira wrote: > > On Sun, 2021-11-28 at 21:59 +, Iain Buclaw via > > Digitalmars-d-learn wrote: > > > > > > DMD doesn't emit this information. GDB can't work

Re: mixin does not work as expected

2022-01-05 Thread rempas via Digitalmars-d-learn
On Wednesday, 5 January 2022 at 17:48:03 UTC, H. S. Teoh wrote: Yeah, this won't fly. Whatever you pass to mixin must be one or more *complete* declaration or (possibly compound) statements. It's illegal to pass the `static if` and its else-clause to two different mixin() invocations (they are

Re: mixin does not work as expected

2022-01-05 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jan 05, 2022 at 08:40:15AM +, rempas via Digitalmars-d-learn wrote: [...] > void test(bool signed)(int num, int base) { > static if (signed) { > mixin(type_check!("static if", "i8", "true", "5", "4", "10", "5")); > mixin(type_check!("else static if", "i16", "true", "7", "6",

Re: what is going on here?

2022-01-05 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jan 05, 2022 at 08:00:45AM +, forkit via Digitalmars-d-learn wrote: [...] > Well, in my case, it was nice to see that the oom reaper thread is > working correctly ;-) I'm well-acquainted with the OOM reaper; it and dmd are good friends, and love to throw parties esp. when CTFE and

Re: Libc functions undefined when linking

2022-01-05 Thread Ben Jones via Digitalmars-d-learn
On Wednesday, 5 January 2022 at 03:38:54 UTC, Tejas wrote: On Tuesday, 4 January 2022 at 18:13:56 UTC, Ben Jones wrote: The tricky part is that the lab machines that the students will be using don't have a D compiler installed (they're Fedora machines, and I didn't see a dmd package in their

Re: Returning value by ref does not create a ref. Is this intentional?

2022-01-05 Thread Tejas via Digitalmars-d-learn
On Wednesday, 5 January 2022 at 08:58:44 UTC, Dennis wrote: On Wednesday, 5 January 2022 at 05:38:45 UTC, Tejas wrote: The entire reason I wanted to get a `ref` was so that I can avoid the `*` :( I don't know what the real code behind the reduced example is, but maybe you can structure your

Re: mixin does not work as expected

2022-01-05 Thread rempas via Digitalmars-d-learn
On Wednesday, 5 January 2022 at 10:47:44 UTC, rempas wrote: There may be a problem in the "type_check" enum but I wanted to post this reply before I search any any case there is something else happening and you happen to know. I will update if I found it Well, it is specifically the "static

Re: mixin does not work as expected

2022-01-05 Thread rempas via Digitalmars-d-learn
On Wednesday, 5 January 2022 at 09:33:07 UTC, vit wrote: 2) if-else must be in same mixin: ```d mixin("" + type_check!("static if", "i8", "true", "5", "4", "10", "5") + type_check!("else static if", "i16", "true", "7", "6", "18", "8") + type_check!("else static if",

Re: mixin does not work as expected

2022-01-05 Thread vit via Digitalmars-d-learn
On Wednesday, 5 January 2022 at 09:17:54 UTC, rempas wrote: On Wednesday, 5 January 2022 at 09:02:53 UTC, vit wrote: Try this: ```d pragma(msg, type_check!("static if", "i8", "true", "5", "4", "10", "5")); ``` Result: ```d static if(is_same!(num, i8)) { mixin(base_digit!("5", "4", "10",

Re: mixin does not work as expected

2022-01-05 Thread rempas via Digitalmars-d-learn
On Wednesday, 5 January 2022 at 09:02:53 UTC, vit wrote: Try this: ```d pragma(msg, type_check!("static if", "i8", "true", "5", "4", "10", "5")); ``` Result: ```d static if(is_same!(num, i8)) { mixin(base_digit!("5", "4", "10", "5")); static if (true) {

Re: mixin does not work as expected

2022-01-05 Thread vit via Digitalmars-d-learn
On Wednesday, 5 January 2022 at 08:40:15 UTC, rempas wrote: I'm trying to use mixins and enums to "expand" code in place but the results are not what I expected and I'm getting an weird error. I have created the smallest possible example to reproduce the error and it is the following: [...]

Re: mixin does not work as expected

2022-01-05 Thread vit via Digitalmars-d-learn
On Wednesday, 5 January 2022 at 08:40:15 UTC, rempas wrote: I'm trying to use mixins and enums to "expand" code in place but the results are not what I expected and I'm getting an weird error. I have created the smallest possible example to reproduce the error and it is the following: [...]

Re: Returning value by ref does not create a ref. Is this intentional?

2022-01-05 Thread Dennis via Digitalmars-d-learn
On Wednesday, 5 January 2022 at 05:38:45 UTC, Tejas wrote: The entire reason I wanted to get a `ref` was so that I can avoid the `*` :( I don't know what the real code behind the reduced example is, but maybe you can structure your code such that the subsequent modification `c = 10` happens

mixin does not work as expected

2022-01-05 Thread rempas via Digitalmars-d-learn
I'm trying to use mixins and enums to "expand" code in place but the results are not what I expected and I'm getting an weird error. I have created the smallest possible example to reproduce the error and it is the following: ``` enum base_digit(string ten, string sixteen, string two, string

Re: what is going on here?

2022-01-05 Thread forkit via Digitalmars-d-learn
On Tuesday, 4 January 2022 at 23:37:57 UTC, H. S. Teoh wrote: Or the compiler would run out of memory before it gets to optimizing away those assignments, so it would just outright crash. I ran your code on my computer and got this: uncaught exception