DUB issues

2022-04-17 Thread Danny Arends via Digitalmars-d-learn
Hey All, For some reason I cannot reset my password to get into dub (https://code.dlang.org/), after trying I never receive the email to reset my password. I was unsure at first if I had signed up at all, but trying to make a new account tells me my email address is already in use. Any

Re: Static struct initialization syntax behavior & it being disabled upon adding a constructor

2022-04-17 Thread H. S. Teoh via Digitalmars-d-learn
On Sun, Apr 17, 2022 at 05:35:13PM -0700, Ali Çehreli via Digitalmars-d-learn wrote: > On 4/17/22 08:13, HuskyNator wrote: [...] > > - 2: Why does adding a constructor to a struct disable the use of > > the static initialization syntax? > > I am not sure how to answer this question because I am

Re: Static struct initialization syntax behavior & it being disabled upon adding a constructor

2022-04-17 Thread Ali Çehreli via Digitalmars-d-learn
On 4/17/22 08:13, HuskyNator wrote: > - 1: Why does `m` initialization behave as if `m[0][]=1` and `m[1][]=2` > were used? (Shouldn't this code result in an error instead?) That's pretty weird. I think it boils down to scalar assignment to an array being valid: void main() { int[3] arr;

Re: Importing version identifiers from another file?

2022-04-17 Thread cc via Digitalmars-d-learn
Another option for this was suggested here: https://forum.dlang.org/post/qbvgboihhwcuqglyg...@forum.dlang.org On Wednesday, 12 February 2020 at 09:28:15 UTC, Simen Kjærås wrote: So, you could have a file called 'versions' containing this: # Setting 'Compress' version -version=Compress #

Re: Can Enums be integral types?

2022-04-17 Thread Bastiaan Veelo via Digitalmars-d-learn
On Saturday, 16 April 2022 at 11:39:01 UTC, Manfred Nowak wrote: In the specs(17) about enums the word "integral" has no match. But because the default basetype is `int`, which is an integral type, enums might be integral types whenever their basetype is an integral type. On the other hand

Re: How to use Vector Extensions in an opBinary

2022-04-17 Thread Bastiaan Veelo via Digitalmars-d-learn
On Sunday, 17 April 2022 at 11:16:25 UTC, HuskyNator wrote: I recently found out there is [support for vector extensions](https://dlang.org/spec/simd.html) But I have found I don't really understand how to use it, not even mentioning the more complex stuff. I couldn't find any good examples

Static struct initialization syntax behavior & it being disabled upon adding a constructor

2022-04-17 Thread HuskyNator via Digitalmars-d-learn
This is a twofold question, along the example code below: - 1: Why does `m` initialization behave as if `m[0][]=1` and `m[1][]=2` were used? (Shouldn't this code result in an error instead?) - 2: Why does adding a constructor to a struct disable the use of the static initialization syntax? I

Re: Why do immutable variables need reference counting?

2022-04-17 Thread ag0aep6g via Digitalmars-d-learn
On 17.04.22 15:27, H. S. Teoh wrote: On Sun, Apr 17, 2022 at 01:06:36PM +, wjoe via Digitalmars-d-learn wrote: [...] On the matter of undefined behavior. Technically a program is in undefined behavior land after throwing an error, thus every unittest that continues after assertThrown is

Re: Why do immutable variables need reference counting?

2022-04-17 Thread H. S. Teoh via Digitalmars-d-learn
On Sun, Apr 17, 2022 at 04:09:12PM +0200, ag0aep6g via Digitalmars-d-learn wrote: [...] > Failing asserts are a messy part of the language. They are supposed to > be: > > 1) not catchable, because they indicate a bug in the program; > 2) catchable in order to be testable; > 3) assumed impossible

Re: Why do immutable variables need reference counting?

2022-04-17 Thread ag0aep6g via Digitalmars-d-learn
On 17.04.22 15:06, wjoe wrote: On the matter of undefined behavior. Technically a program is in undefined behavior land after throwing an error, thus every unittest that continues after assertThrown is therefore nonsense code, is it not ? Yes. Failing asserts are a messy part of the

Re: Do I have to pass parameters with ref explicitly?

2022-04-17 Thread Elfstone via Digitalmars-d-learn
Thanks Ali. That's a lot of information. I'm learning D by rewriting my hobbyist project. I guess I can worry about optimization later. On Sunday, 17 April 2022 at 08:45:11 UTC, Ali Çehreli wrote: - Somewhat related, unlike C++, D does not allow binding rvalues to 'const ref'. (This point is

Re: Why do immutable variables need reference counting?

2022-04-17 Thread H. S. Teoh via Digitalmars-d-learn
On Sun, Apr 17, 2022 at 01:06:36PM +, wjoe via Digitalmars-d-learn wrote: [...] > On the matter of undefined behavior. Technically a program is in > undefined behavior land after throwing an error, thus every unittest > that continues after assertThrown is therefore nonsense code, is it > not

Re: Why do immutable variables need reference counting?

2022-04-17 Thread wjoe via Digitalmars-d-learn
On Thursday, 14 April 2022 at 12:10:04 UTC, ag0aep6g wrote: On 14.04.22 13:42, wjoe wrote: Undefined behavior yes, but regardless the example proves it can be done in @system code. A few versions ago, possibly due to a bug or regression, the compiler didn't complain in @safe code either. Of

Re: How to use Vector Extensions in an opBinary

2022-04-17 Thread user1234 via Digitalmars-d-learn
On Sunday, 17 April 2022 at 11:16:25 UTC, HuskyNator wrote: I recently found out there is [support for vector extensions](https://dlang.org/spec/simd.html) But I have found I don't really understand how to use it, not even mentioning the more complex stuff. I couldn't find any good examples

How to use Vector Extensions in an opBinary

2022-04-17 Thread HuskyNator via Digitalmars-d-learn
I recently found out there is [support for vector extensions](https://dlang.org/spec/simd.html) But I have found I don't really understand how to use it, not even mentioning the more complex stuff. I couldn't find any good examples either. I'm trying to figure out how to implement the

Re: TIC-80 WebAssembly: pointers to fixed addresses

2022-04-17 Thread Pierce Ng via Digitalmars-d-learn
On Saturday, 16 April 2022 at 20:36:12 UTC, Adam Ruppe wrote: __gshared ubyte[] framebuffer = (cast(ubyte*) 0) [0 .. 16320]; ubyte[] framebuffer() { return (cast(ubyte*) 0) [0 .. 16320]; } Thank you, Adam. I'll go with both, as existing examples in other languages use pointer arithmetic.

Re: Do I have to pass parameters with ref explicitly?

2022-04-17 Thread Ali Çehreli via Digitalmars-d-learn
On 4/17/22 01:45, Ali Çehreli wrote: > In D, if it > is an input to a function, then mark it as 'in' and the compiler will do > some magic: > >https://dlang.org/spec/function.html#in-params I should have remembered that there are some improvements coming for -preview=in as reported by

Re: Do I have to pass parameters with ref explicitly?

2022-04-17 Thread Ali Çehreli via Digitalmars-d-learn
On 4/16/22 21:56, Elfstone wrote: > On Sunday, 17 April 2022 at 04:00:19 UTC, max haughton wrote: >> On Sunday, 17 April 2022 at 03:00:28 UTC, Elfstone wrote: >>> I'm reading some d-sources, and it looks like they pass big structs >>> by value. >>> Such as: >>> >>> Matrix4x4f opBinary(string