Re: static assert not printing out along the error diagnostic

2021-07-13 Thread jfondren via Digitalmars-d-learn
On Wednesday, 14 July 2021 at 03:06:06 UTC, someone wrote: in main() ... so then I went to the D docs and to Ali's book afterward and there I tested his example to same results. The current behavior seems like it could be taken for a bug, or at least room for improvement in letting static asse

Re: static assert not printing out along the error diagnostic

2021-07-13 Thread SealabJaster via Digitalmars-d-learn
On Wednesday, 14 July 2021 at 05:59:19 UTC, SealabJaster wrote: I've ran into this rarely. At a guess, it seems something triggers the compiler to either evaluate something in non-lexical order; doesn't realise it needs to error out at the static assert instead of doing it later, or maybe it so

Re: static assert not printing out along the error diagnostic

2021-07-13 Thread SealabJaster via Digitalmars-d-learn
On Wednesday, 14 July 2021 at 03:06:06 UTC, someone wrote: ... I've ran into this rarely. At a guess, it seems something triggers the compiler to either evaluate something in non-lexical order; doesn't realise it needs to error out at the static assert instead of doing it later, or maybe it

Re: static assert not printing out along the error diagnostic

2021-07-13 Thread someone via Digitalmars-d-learn
On Wednesday, 14 July 2021 at 02:42:21 UTC, Paul Backus wrote: Weirdly, adding a dummy `ResultType` declaration to the `else` branch makes the assert message show up: My code is like following: ```d public struct gudtUGC(typeStringUTF) { static if (! (is (typeStringUTF == string) || is

Re: static assert not printing out along the error diagnostic

2021-07-13 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 14 July 2021 at 02:28:07 UTC, someone wrote: If I add in main(): ```d auto g = MyType!string(); g.doWork(); ``` I get: ...: Error: undefined identifier `ResultType` ...: Error: template instance `...MyType!string` error instantiating But nothing like: ```d T.stringof

static assert not printing out along the error diagnostic

2021-07-13 Thread someone via Digitalmars-d-learn
The following example is from Ali's book @ http://ddili.org/ders/d.en/cond_comp.html: ```d import std.stdio; struct MyType(T) { static if (is (T == float)) { alias ResultType = double; } else static if (is (T == double)) { alias ResultType = real; } else {

Re: catching segfault using try_ catch

2021-07-13 Thread seany via Digitalmars-d-learn
On Tuesday, 13 July 2021 at 17:49:54 UTC, Adam D Ruppe wrote: On Tuesday, 13 July 2021 at 16:52:43 UTC, seany wrote: [...] true if it succeeded. [...] You mean transparently rerun some code? That's better done with the lowlevel sigaction handler. [...] Thank you. Is there a tutorial

Re: catching segfault using try_ catch

2021-07-13 Thread Adam D Ruppe via Digitalmars-d-learn
On Tuesday, 13 July 2021 at 16:52:43 UTC, seany wrote: What will it return to me? true if it succeeded. I want to catch the segfault and a segfault has occured, I want run a different code at that point. You mean transparently rerun some code? That's better done with the lowlevel sigaction

Re: catching segfault using try_ catch

2021-07-13 Thread seany via Digitalmars-d-learn
On Monday, 12 July 2021 at 00:04:05 UTC, Adam D Ruppe wrote: On Sunday, 11 July 2021 at 23:34:38 UTC, seany wrote: Is there an example i can use Thank you. You just call the registerMemoryHandler() function from that module at some point in your main function before doing other work. PS wi

Re: catching segfault using try_ catch

2021-07-13 Thread seany via Digitalmars-d-learn
On Monday, 12 July 2021 at 00:04:05 UTC, Adam D Ruppe wrote: On Sunday, 11 July 2021 at 23:34:38 UTC, seany wrote: Is there an example i can use Thank you. You just call the registerMemoryHandler() function from that module at some point in your main function before doing other work. OK H

Re: No rdmd.exe in /bin64 on Windows - is this an issue?

2021-07-13 Thread Scotpip via Digitalmars-d-learn
Mike - I'm bowled over by your response - what a great introduction to the community! You've given me the confidence to dig in and really learn the language. I had a brief flirtation with one of the newer niche system languages but ran into showstoppers pretty early on. The community was gr

Re: Error with implicit cast of ^^=

2021-07-13 Thread Ali Çehreli via Digitalmars-d-learn
On 7/13/21 4:12 AM, wjoe wrote: > ```D > byte x = some_val; > long y = some_val; > > x ^^= y; // Error: cannot implicitly convert expression > pow(cast(long)cast(int)x, y) of type long to byte [...] > I rewrote it to something like > ```D > mixin("x = cast(typeof(x))(x" ~ op[0..$-1] ~ " y);");

Re: mixin template's alias parameter ... ignored ?

2021-07-13 Thread someone via Digitalmars-d-learn
On Tuesday, 13 July 2021 at 05:37:49 UTC, ag0aep6g wrote: On 13.07.21 03:03, someone wrote: On Monday, 12 July 2021 at 23:28:29 UTC, ag0aep6g wrote: [...] I'm not sure where we stand with `in` You mean *we* = D developers ? Yes. Let me rephrase and elaborate: I'm not sure what the current

Re: mixin template's alias parameter ... ignored ?

2021-07-13 Thread someone via Digitalmars-d-learn
On Tuesday, 13 July 2021 at 05:26:56 UTC, Ali Çehreli wrote: Cumbersome because one has to make sure existing casts are correct after changing a type. ACK. Harmful because it bypasses the compiler's type checking. Hmmm ... I'll be reconsidering my cast usage approach then. >> For example

Re: No rdmd.exe in /bin64 on Windows - is this an issue?

2021-07-13 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 13 July 2021 at 11:23:38 UTC, Scotpip wrote: Mike - thanks for responding! You say that there wasn't a Windows 64 bit release "for good reason". That sounds a bit ominous - I'd appreciate your insights into what was behind this. Nothing ominous. It was just because of the state

Re: No rdmd.exe in /bin64 on Windows - is this an issue?

2021-07-13 Thread Scotpip via Digitalmars-d-learn
Mike - thanks for responding! You say that there wasn't a Windows 64 bit release "for good reason". That sounds a bit ominous - I'd appreciate your insights into what was behind this. Given the effort that's clearly gone into VisualD I was rather assuming that Windows was fully supported b

Error with implicit cast of ^^=

2021-07-13 Thread wjoe via Digitalmars-d-learn
```D byte x = some_val; long y = some_val; x ^^= y; // Error: cannot implicitly convert expression pow(cast(long)cast(int)x, y) of type long to byte ``` Is there a way to do this via ^^= ? This is part of a unittest for opIndexOpAssign where the type of x is that of i.opIndex(_i). It's gene