Re: abs and minimum values

2021-10-28 Thread kyle via Digitalmars-d-learn
On Thursday, 28 October 2021 at 21:23:15 UTC, kyle wrote: ``` void main() { import std.math : abs, sgn; alias n_type = short; //or int, long, byte, whatever assert(n_type.min == abs(n_type.min)); assert(sgn(abs(n_type.min)) == -1); } ``` I stumbled into this fun today. I

abs and minimum values

2021-10-28 Thread kyle via Digitalmars-d-learn
``` void main() { import std.math : abs, sgn; alias n_type = short; //or int, long, byte, whatever assert(n_type.min == abs(n_type.min)); assert(sgn(abs(n_type.min)) == -1); } ``` I stumbled into this fun today. I understand why abs yields a negative value here with overflow

Re: SumType

2021-10-28 Thread JG via Digitalmars-d-learn
On Thursday, 28 October 2021 at 13:30:53 UTC, Paul Backus wrote: On Thursday, 28 October 2021 at 09:02:52 UTC, JG wrote: I am heavily using SumType (which I like very much). The problem I am having is that is seems to be causing slow compile times (as can be observed by profiling during the

Re: Vibe.d tutorial

2021-10-28 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 28 October 2021 at 13:30:36 UTC, Rey Valeza wrote: On Friday, 2 April 2021 at 22:29:20 UTC, Imperatorn wrote: On Thursday, 4 March 2021 at 13:47:11 UTC, Imperatorn wrote: On Monday, 1 March 2021 at 22:25:39 UTC, Rey Valeza wrote: [...]

Re: Vibe.d tutorial

2021-10-28 Thread Rey Valeza via Digitalmars-d-learn
On Wednesday, 7 April 2021 at 09:00:29 UTC, M.M. wrote: On Friday, 2 April 2021 at 22:29:20 UTC, Imperatorn wrote: On Thursday, 4 March 2021 at 13:47:11 UTC, Imperatorn wrote: On Monday, 1 March 2021 at 22:25:39 UTC, Rey Valeza wrote: Hi, I wrote a tutorial on Vibe.d while trying to re-learn

Re: SumType

2021-10-28 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 28 October 2021 at 09:02:52 UTC, JG wrote: I am heavily using SumType (which I like very much). The problem I am having is that is seems to be causing slow compile times (as can be observed by profiling during the compile). The problem seems to be with match (which is extremely

Re: Vibe.d tutorial

2021-10-28 Thread Rey Valeza via Digitalmars-d-learn
On Friday, 2 April 2021 at 22:29:20 UTC, Imperatorn wrote: On Thursday, 4 March 2021 at 13:47:11 UTC, Imperatorn wrote: On Monday, 1 March 2021 at 22:25:39 UTC, Rey Valeza wrote: Hi, I wrote a tutorial on Vibe.d while trying to re-learn Vibe.d. I find that most of Kai Nacke's book need

Re: What is D's "__debugbreak()" equivalent?

2021-10-28 Thread Dennis via Digitalmars-d-learn
On Wednesday, 27 October 2021 at 16:54:49 UTC, Simon wrote: What is the equivalent in D? With LDC, you have: ```D import ldc.intrinsics: llvm_debugtrap; ``` Combining that with previous answers, you can make something like this: ```D void debugbreak() nothrow @nogc @trusted {

SumType

2021-10-28 Thread JG via Digitalmars-d-learn
I am heavily using SumType (which I like very much). The problem I am having is that is seems to be causing slow compile times (as can be observed by profiling during the compile). The problem seems to be with match (which is extremely convenient to use). I looked at the code and it does the

Re: Bitfileds Error: no identifier for declarator

2021-10-28 Thread data pulverizer via Digitalmars-d-learn
On Thursday, 28 October 2021 at 05:51:27 UTC, Imperatorn wrote: Try renaming debug to something else Many thanks guys. I should have spotted that one!