Re: Since DMD 2.089.0 and later, compiled .exe showing SFX zip and opening with winRar when use resource.

2020-08-19 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 18 August 2020 at 19:01:17 UTC, Marcone wrote: SFX zip in it is properties: https://i.imgur.com/dH7jl5n.png Opening with winRar: https://i.imgur.com/s7C9mZn.png Probably winrar messing with your file manager. Try to uninstall ungerister winrar from your file manager or try a

Re: `enum x;` - what is it?

2020-08-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/19/20 10:06 AM, Victor Porton wrote: This declaration does compile: enum x; But what is it? Is it an equivalent of enum x { } ? What in the specification allows this looking a nonsense enum x; ? I use it as a symbol for UDAs. enum required; struct S { @required int x; } which

Creating a pointer array

2020-08-19 Thread data pulverizer via Digitalmars-d-learn
Hi all, How do you create an array of pointers in D? I tried something like ``` double* []y; ``` Or ``` (double*) []y; ``` But I get the error: ``` Error: only one index allowed to index double[] ``` Thanks in advance.

Re: Creating a pointer array

2020-08-19 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 19 August 2020 at 13:12:21 UTC, data pulverizer wrote: On Wednesday, 19 August 2020 at 13:08:37 UTC, Adam D. Ruppe wrote: On Wednesday, 19 August 2020 at 13:03:54 UTC, data pulverizer wrote: How do you create an array of pointers in D? I tried something like ``` double* []y;

Re: `enum x;` - what is it?

2020-08-19 Thread Victor Porton via Digitalmars-d-learn
On Wednesday, 19 August 2020 at 14:06:16 UTC, Victor Porton wrote: This declaration does compile: enum x; But what is it? Is it an equivalent of enum x { } ? What in the specification allows this looking a nonsense enum x; ? Oh, found: "An empty enum body (For example enum E;) signifies

`enum x;` - what is it?

2020-08-19 Thread Victor Porton via Digitalmars-d-learn
This declaration does compile: enum x; But what is it? Is it an equivalent of enum x { } ? What in the specification allows this looking a nonsense enum x; ?

Re: `enum x;` - what is it?

2020-08-19 Thread FeepingCreature via Digitalmars-d-learn
On Wednesday, 19 August 2020 at 14:06:16 UTC, Victor Porton wrote: This declaration does compile: enum x; But what is it? Is it an equivalent of enum x { } ? What in the specification allows this looking a nonsense enum x; ? It's an enum type whose members we don't know. So we can't

Re: Creating a pointer array

2020-08-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 19 August 2020 at 13:03:54 UTC, data pulverizer wrote: How do you create an array of pointers in D? I tried something like ``` double* []y; ``` I'd write it double*[] y; but yeah that's it. Error: only one index allowed to index double[] That must be at the usage point

Re: Creating a pointer array

2020-08-19 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 19 August 2020 at 13:08:37 UTC, Adam D. Ruppe wrote: On Wednesday, 19 August 2020 at 13:03:54 UTC, data pulverizer wrote: How do you create an array of pointers in D? I tried something like ``` double* []y; ``` I'd write it double*[] y; but yeah that's it. Error: only one

Re: `enum x;` - what is it?

2020-08-19 Thread FeepingCreature via Digitalmars-d-learn
On Wednesday, 19 August 2020 at 14:43:22 UTC, Victor Porton wrote: On Wednesday, 19 August 2020 at 14:06:16 UTC, Victor Porton wrote: This declaration does compile: enum x; But what is it? Is it an equivalent of enum x { } ? What in the specification allows this looking a nonsense enum x;

Re: how stdin stream works?

2020-08-19 Thread Flade via Digitalmars-d-learn
On Wednesday, 19 August 2020 at 18:11:23 UTC, Steven Schveighoffer wrote: On 8/19/20 1:44 PM, Flade wrote: Hi everyone! I'm trying to do error handling (with the try block) and when I give a wrong value to the variable (it is an integer and I give a non-number value), then It doesn't let me

how stdin stream works?

2020-08-19 Thread Flade via Digitalmars-d-learn
Hi everyone! I'm trying to do error handling (with the try block) and when I give a wrong value to the variable (it is an integer and I give a non-number value), then It doesn't let me re get input. The code: int x; bool not_accepted = false; while (!not_accepted) { try {

Re: how stdin stream works?

2020-08-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/19/20 1:44 PM, Flade wrote: Hi everyone! I'm trying to do error handling (with the try block) and when I give a wrong value to the variable (it is an integer and I give a non-number value), then It doesn't let me re get input. The code: int x; bool not_accepted = false; while

Re: BetterC + WASM Update

2020-08-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 19 August 2020 at 21:24:23 UTC, Mike Brown wrote: I can see that LDC supports WASM output, and I believe this requires BetterC to be enabled? Not really but anything beyond -betterC is still kinda diy right now. So I happened to do port my little tetris game in D to wasm just

Location of core.internal.traits : CoreUnqual in Dlang GitHub repo

2020-08-19 Thread data pulverizer via Digitalmars-d-learn
Hi all, I've been looking for where `CoreUnqual` is defined in the Dlang repos. I've tried searching in dmd and phobos but only found the reference usage in std.traits: import core.internal.traits : CoreUnqual; I'd like to know where it is defined so I can (attempt to!) study the code.

Re: BetterC + WASM Update

2020-08-19 Thread kinke via Digitalmars-d-learn
On Wednesday, 19 August 2020 at 21:24:23 UTC, Mike Brown wrote: I have done some tests, and it appears that classes are supported (LDC 1.22.0)? extern(C++) classes are supported by -betterC. With LDC, D classes are supported to some extent too since v1.11, but this requires a custom object.d

Re: Creating a pointer array

2020-08-19 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 19 August 2020 at 13:03:54 UTC, data pulverizer wrote: Hi all, How do you create an array of pointers in D? I tried something like ``` double* []y; ``` Or ``` (double*) []y; ``` But I get the error: ``` Error: only one index allowed to index double[] ``` Thanks in advance.

Re: Creating a pointer array

2020-08-19 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 19 August 2020 at 20:09:31 UTC, bachmeier wrote: On Wednesday, 19 August 2020 at 13:03:54 UTC, data pulverizer wrote: Maybe I'm the only one, but I think double*[] is hideous, and I'd sure hate for someone not used to D to see it. Alias is your friend. I think this is much nicer:

Re: BetterC + WASM Update

2020-08-19 Thread aberba via Digitalmars-d-learn
On Wednesday, 19 August 2020 at 21:24:23 UTC, Mike Brown wrote: Hi all, I'd like to make a WASM project, and looking into options. It's scattered in several places including https://gist.github.com/skoppe/7617ceba6afd67b2e20c6be4f922725d Are you aware of Spasm?

Re: Creating a pointer array

2020-08-19 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 19 August 2020 at 21:10:00 UTC, data pulverizer wrote: alias is one of those awesome chameleons in D. The template equivalent is ``` template P(T) = T*; ``` Correction ... ``` template P(T){ alias P = T*; } ```

Re: Creating a pointer array

2020-08-19 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Aug 19, 2020 at 08:09:31PM +, bachmeier via Digitalmars-d-learn wrote: [...] > Maybe I'm the only one, but I think double*[] is hideous, and I'd sure > hate for someone not used to D to see it. IMO, double*[] is absolutely logical. It's a natural consequence of type syntax. > Alias

BetterC + WASM Update

2020-08-19 Thread Mike Brown via Digitalmars-d-learn
Hi all, I'd like to make a WASM project, and looking into options. I can see that LDC supports WASM output, and I believe this requires BetterC to be enabled? The documentation states that classes are not supported by BetterC, but its preferable/required for me. I have done some tests, and

Re: Location of core.internal.traits : CoreUnqual in Dlang GitHub repo

2020-08-19 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Aug 19, 2020 at 10:47:19PM +, data pulverizer via Digitalmars-d-learn wrote: > Hi all, > > I've been looking for where `CoreUnqual` is defined in the Dlang > repos. I've tried searching in dmd and phobos but only found the > reference usage in std.traits: > > import

Which version of DMD does GDC 10 target

2020-08-19 Thread Arun via Digitalmars-d-learn
Which version of DMD is GDC 10 based on? 2020-08-19 19:36:17 ~/code/es-v2-d (master) $ gdc --version gdc (Ubuntu 10-20200411-0ubuntu1) 10.0.1 20200411 (experimental) [master revision bb87d5cc77d:75961caccb7:f883c46b4877f637e0fa5025b4d6b5c9040ec566] Copyright (C) 2020 Free Software Foundation,

Re: Disjoint slices of an array as reference

2020-08-19 Thread data pulverizer via Digitalmars-d-learn
On Thursday, 20 August 2020 at 02:38:33 UTC, data pulverizer wrote: I've been thinking about this some more and I don't think it is possible. An array in D is effectively two pointers either side of a memory block. When you create a slice you are creating another array two pointers somewhere

Re: Disjoint slices of an array as reference

2020-08-19 Thread data pulverizer via Digitalmars-d-learn
On Thursday, 20 August 2020 at 02:21:15 UTC, data pulverizer wrote: However I would like to have disjoint slices, something like this: ``` auto y = x[0..5, 9..14]; ``` I've been thinking about this some more and I don't think it is possible. An array in D is effectively two pointers either

Re: Disjoint slices of an array as reference

2020-08-19 Thread data pulverizer via Digitalmars-d-learn
On Thursday, 20 August 2020 at 03:47:15 UTC, Paul Backus wrote: double[][] y; y ~= x[0..5]; Thanks. I might go for a design like this: ``` struct View(T){ T* data; long[2][] ranges; } ``` The ranges are were the slices are stored and T* (maybe even immutable(T*)) is a pointer is to the

Re: Which version of DMD does GDC 10 target

2020-08-19 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Aug 20, 2020 at 04:28:41AM +, Arun via Digitalmars-d-learn wrote: > Which version of DMD is GDC 10 based on? Compile the following D program to find out: - static assert(0, "Compiler language version: " ~ __VERSION__.stringof); - I have this line in a file called langver.d,

Disjoint slices of an array as reference

2020-08-19 Thread data pulverizer via Digitalmars-d-learn
I have been trying to create a new array from an existing array that is effectively a view on the original array. This can be done with slices in D: ``` auto x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; auto y = [0..5]; ``` y a subset of the x array. If I

Re: Disjoint slices of an array as reference

2020-08-19 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 20 August 2020 at 02:21:15 UTC, data pulverizer wrote: ``` double[] y; y ~= x[0..5]; y ~= x[9..14]; ``` But the act of appending results in array copying - breaks the reference with the original array. The only other thing I have considered is creating an array of references to

Re: Which version of DMD does GDC 10 target

2020-08-19 Thread Arun via Digitalmars-d-learn
On Thursday, 20 August 2020 at 05:07:28 UTC, H. S. Teoh wrote: On Thu, Aug 20, 2020 at 04:28:41AM +, Arun via Digitalmars-d-learn wrote: Which version of DMD is GDC 10 based on? Compile the following D program to find out: - static assert(0, "Compiler language version: " ~

Re: How to sort a multidimensional ndslice?

2020-08-19 Thread 9il via Digitalmars-d-learn
On Tuesday, 18 August 2020 at 13:07:56 UTC, Arredondo wrote: On Tuesday, 18 August 2020 at 04:07:56 UTC, 9il wrote: To reorder the columns data according to precomputed index: auto index = a.byDim!1.map!sum.slice; Hello Ilya, thanks for the answer! Unfortunately I can't use it because I