save and load a 2d array to a file

2022-04-18 Thread Chris Katko via Digitalmars-d-learn
D struct map_t{ int data[50][50]; } map; //save std.file.write("save.map", map.data); // compiles //load map.data = std.file.read("save.map", map.data.sizeof); // error main.d(536): Error: cannot implicitly convert expression `read("save.map", 2500LU)` of type `void[]` to `ubyte[50][]`

Re: DUB issues

2022-04-18 Thread Marcone via Digitalmars-d-learn
The dub creator shouldn't even remember creating this anymore. It makes me sad when I see that things in D are old, forgotten, outdated, abandoned. D is the best programming language in the world. But nobody appreciates it. It makes me sad when I see the repositories for over 10 years without

Re: Can Enums be integral types?

2022-04-18 Thread Era Scarecrow via Digitalmars-d-learn
On Sunday, 17 April 2022 at 18:25:32 UTC, Bastiaan Veelo wrote: 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

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

2022-04-18 Thread Ali Çehreli via Digitalmars-d-learn
On 4/18/22 09:17, Ali Çehreli wrote: > shared static ~this(): 0 > static ~this(): 0 >~this(): 8 Apologies for omitting 'scope' statements: scope(exit): 34 scope(success): 6 scope(failure): 8 Ali

Re: Install D lang on Windows 10 : an installation step by step tutorial made by a beginner who loves D !

2022-04-18 Thread SMAOLAB via Digitalmars-d-learn
On Monday, 18 April 2022 at 16:20:38 UTC, SMAOLAB wrote: After I noticed that if you don't install VisualD and Microsoft Visual Studio you may have issues (you don't see the DMD extension for instance, the PATH is not set) you should read : After I noticed that if you don't install **in the

Re: Install D lang on Windows 10 : an installation step by step tutorial made by a beginner who loves D !

2022-04-18 Thread SMAOLAB via Digitalmars-d-learn
Dear Community, Thanks for your reactions/feedbacks. What went wrong when you used the DMD installer? Nothing really, the thing that went really wrong is the Microsoft Visual Studio (which licence I should install to get my D / Dplug program work). Next, I use LDC rather than DMD (but this

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

2022-04-18 Thread Ali Çehreli via Digitalmars-d-learn
On 4/17/22 17:35, Ali Çehreli wrote: > compared to C++, the amount of constructor, destructor, copy > constructor, etc. that I do *not* write in D is very liberating to me. > It feels like I just write what is needed and it mostly just works. The following is a quick and dirty grep-based stats

Re: Install D lang on Windows 10 : an installation step by step tutorial made by a beginner who loves D !

2022-04-18 Thread Anonymouse via Digitalmars-d-learn
On Monday, 18 April 2022 at 09:04:24 UTC, Dennis wrote: What went wrong when you used the DMD installer? Installing Visual Studio should not be necessary, since DMD ships with the lld linker and MinGW Windows import libraries. If it doesn't work out of the box, it should be fixed. "Download

Re: Why do immutable variables need reference counting?

2022-04-18 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Apr 18, 2022 at 12:55:26PM +, wjoe via Digitalmars-d-learn wrote: > On Sunday, 17 April 2022 at 14:14:37 UTC, H. S. Teoh wrote: > > Not entirely true. See paragraph 3 in: > > > > https://dlang.org/spec/unittest.html > > > > and 10.24.11.3 in: > > > >

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

2022-04-18 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Apr 18, 2022 at 08:22:26AM +, cc via Digitalmars-d-learn wrote: > On Monday, 18 April 2022 at 03:21:30 UTC, H. S. Teoh wrote: > > Structs in D ought to be treated like "glorified ints", as Andrei > > puts it. If you need complex ctors and complex methods, that's a > > sign you should

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

2022-04-18 Thread zjh via Digitalmars-d-learn
On Monday, 18 April 2022 at 13:21:44 UTC, zjh wrote: I hope that d can support it like `C++`. `Struct` and `class` behavior is inconsistent. `Constructors` sometimes have initialize behavior. If D doesn't think about `C++` users, `C++` users feel too troublesome, can't understand, and the

Re: DUB issues

2022-04-18 Thread Mike Parker via Digitalmars-d-learn
On Monday, 18 April 2022 at 05:27:32 UTC, Danny Arends wrote: Any ideas how to get into contact/fix this issue ? I've emailed Sönke and pointed him to this thread.

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

2022-04-18 Thread zjh via Digitalmars-d-learn
On Sunday, 17 April 2022 at 15:13:29 UTC, HuskyNator wrote: This is a twofold question, along the example code below: The `default constructor` of `struct` is very convenient to use. I hope that d can support it like `C++`.

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

2022-04-18 Thread user1234 via Digitalmars-d-learn
On Monday, 18 April 2022 at 10:26:16 UTC, HuskyNator wrote: On a sidenote, I'm surprised D did not choose 0 as the default floating value. Doesn't almost every language do this? I understand the thinking behind it, but when the type one uses in a template influences the behavior of the code,

Re: Why do immutable variables need reference counting?

2022-04-18 Thread wjoe via Digitalmars-d-learn
On Sunday, 17 April 2022 at 14:14:37 UTC, H. S. Teoh wrote: Not entirely true. See paragraph 3 in: https://dlang.org/spec/unittest.html and 10.24.11.3 in: https://dlang.org/spec/expression.html#assert_expressions T Thanks. Either I missed that the last time I checked or it

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

2022-04-18 Thread cc via Digitalmars-d-learn
On Monday, 18 April 2022 at 10:26:16 UTC, HuskyNator wrote: On a sidenote, I'm surprised D did not choose 0 as the default floating value. Doesn't almost every language do this? I understand the thinking behind it, but when the type one uses in a template influences the behavior of the code,

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

2022-04-18 Thread HuskyNator via Digitalmars-d-learn
On Monday, 18 April 2022 at 03:21:30 UTC, H. S. Teoh wrote: Structs in D ought to be treated like "glorified ints", as Andrei puts it. If you need complex ctors and complex methods, that's a sign you should be using a class instead. I prefer not to use classes, as the code would now move

Re: Install D lang on Windows 10 : an installation step by step tutorial made by a beginner who loves D !

2022-04-18 Thread Dennis via Digitalmars-d-learn
On Monday, 18 April 2022 at 08:22:43 UTC, SMAOLAB wrote: I tried to install D on a Windows 10 but encountered some difficulties (even though I was reading the official D langage tutorial available on the official website). What went wrong when you used the DMD installer? Installing Visual

Install D lang on Windows 10 : an installation step by step tutorial made by a beginner who loves D !

2022-04-18 Thread SMAOLAB via Digitalmars-d-learn
Hello everyone, I am a newbie in the D langage. I tried to install D on a Windows 10 but encountered some difficulties (even though I was reading the official D langage tutorial available on the official website). I guess that for someone who has a totally new PC, new & fresh Windows 10

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

2022-04-18 Thread cc via Digitalmars-d-learn
On Monday, 18 April 2022 at 03:21:30 UTC, H. S. Teoh wrote: Structs in D ought to be treated like "glorified ints", as Andrei puts it. If you need complex ctors and complex methods, that's a sign you should be using a class instead. Unless you're having a nice quiet get-together with friends,

Re: DUB issues

2022-04-18 Thread BoQsc via Digitalmars-d-learn
On Monday, 18 April 2022 at 05:27:32 UTC, Danny Arends wrote: 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