Re: Warning on self assignment

2018-04-24 Thread Mike Franklin via Digitalmars-d-learn
On Wednesday, 25 April 2018 at 01:20:13 UTC, Mike Franklin wrote: It appears a bug has already been filed (https://issues.dlang.org/show_bug.cgi?id=11970). I'll see if I can fix it. https://github.com/dlang/dmd/pull/8208 We'll see what happens.

Re: Add property-like Function to Type ?

2018-04-24 Thread Meta via Digitalmars-d-learn
On Tuesday, 24 April 2018 at 21:36:19 UTC, Rubn wrote: I was wondering if I could create my own property in a way that can be used the same way as something like "T.sizeof". Right now I have the following to replace length: uint length32(T)(T[] array) { return cast(uint)array.length; } I

Re: Warning on self assignment

2018-04-24 Thread Meta via Digitalmars-d-learn
On Wednesday, 25 April 2018 at 02:32:32 UTC, Per Nordlöw wrote: On Wednesday, 25 April 2018 at 02:23:04 UTC, Mike Franklin wrote: Are people using self assignment of structs as a way of force-running the postblit? Is there a valid use case for that? Mike If they are, there should be a

Re: Warning on self assignment

2018-04-24 Thread Per Nordlöw via Digitalmars-d-learn
On Wednesday, 25 April 2018 at 02:23:04 UTC, Mike Franklin wrote: Are people using self assignment of structs as a way of force-running the postblit? Is there a valid use case for that? Mike If they are, there should be a better way of force-running the postblit.

Re: Warning on self assignment

2018-04-24 Thread Mike Franklin via Digitalmars-d-learn
On Wednesday, 25 April 2018 at 01:08:46 UTC, Arun Chandrasekaran wrote: So I was telling my colleague that D would warn on self assignment, but found that I was wrong. https://run.dlang.io/is/HLhtek ``` module a; import std.stdio; void main() { string a; a = a; // Can the

Re: Are Fibers just broken in D?

2018-04-24 Thread bitwise via Digitalmars-d-learn
On Friday, 20 April 2018 at 18:58:36 UTC, Byron Moxie wrote: [...] In WIN32 it looks like its leaking memory Unless there is something I'm misunderstanding, it seems that Fibers that were not run to completion won't unroll their stack, which would mean that some destructors wouldn't be

Re: Warning on self assignment

2018-04-24 Thread Mike Franklin via Digitalmars-d-learn
On Wednesday, 25 April 2018 at 01:08:46 UTC, Arun Chandrasekaran wrote: So I was telling my colleague that D would warn on self assignment, but found that I was wrong. https://run.dlang.io/is/HLhtek ``` module a; import std.stdio; void main() { string a; a = a; // Can the

Warning on self assignment

2018-04-24 Thread Arun Chandrasekaran via Digitalmars-d-learn
So I was telling my colleague that D would warn on self assignment, but found that I was wrong. https://run.dlang.io/is/HLhtek ``` module a; import std.stdio; void main() { string a; a = a; // Can the compiler warn at this line that there is no effect? writeln(a);

Re: Sense check: construction / deconstruction

2018-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/24/18 6:59 PM, Jordan Wilson wrote: I have the following code: import std.stdio; import std.typecons; import d2sqlite3; class A {     Database db;     this ( Database d) {     db = d;     } } class B {     Database* db;     this ( Database* d) {     db = d;     } } void

Sense check: construction / deconstruction

2018-04-24 Thread Jordan Wilson via Digitalmars-d-learn
I have the following code: import std.stdio; import std.typecons; import d2sqlite3; class A { Database db; this ( Database d) { db = d; } } class B { Database* db; this ( Database* d) { db = d; } } void main() { auto db = Database(":memory:");

Re: Add property-like Function to Type ?

2018-04-24 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, April 24, 2018 21:36:19 Rubn via Digitalmars-d-learn wrote: > I was wondering if I could create my own property in a way that > can be used the same way as something like "T.sizeof". Right now > I have the following to replace length: > > uint length32(T)(T[] array) > { > return

Add property-like Function to Type ?

2018-04-24 Thread Rubn via Digitalmars-d-learn
I was wondering if I could create my own property in a way that can be used the same way as something like "T.sizeof". Right now I have the following to replace length: uint length32(T)(T[] array) { return cast(uint)array.length; } I want something similar to be able to do the following:

Using an external Assembler with D

2018-04-24 Thread solidstate1991 via Digitalmars-d-learn
In order to make one of my own code more readable (and hopefully to avoid a lot of compiling errors under LDC, which don't happen in DMD for some reason), I'm planning to put my assembly functions into separate files for each system that needs them, mainly due to the lack of proper SIMD

Re: Are Fibers just broken in D?

2018-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/24/18 4:30 PM, Steven Schveighoffer wrote: I'll file an issue. We may not be able to solve the problem, but it's something we should try and solve. Seems there's already a similar issue in there: https://issues.dlang.org/show_bug.cgi?id=3523 -Steve

Re: Are Fibers just broken in D?

2018-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/24/18 3:45 PM, Radu wrote: On Tuesday, 24 April 2018 at 16:05:48 UTC, Steven Schveighoffer wrote: On 4/24/18 10:16 AM, Radu wrote: On Tuesday, 24 April 2018 at 13:36:48 UTC, Steven Schveighoffer wrote: On 4/24/18 5:11 AM, bauss wrote: On Tuesday, 24 April 2018 at 07:58:01 UTC, Radu

Re: Are Fibers just broken in D?

2018-04-24 Thread Radu via Digitalmars-d-learn
On Tuesday, 24 April 2018 at 16:05:48 UTC, Steven Schveighoffer wrote: On 4/24/18 10:16 AM, Radu wrote: On Tuesday, 24 April 2018 at 13:36:48 UTC, Steven Schveighoffer wrote: On 4/24/18 5:11 AM, bauss wrote: On Tuesday, 24 April 2018 at 07:58:01 UTC, Radu wrote: On Tuesday, 24 April 2018 at

Re: Are Fibers just broken in D?

2018-04-24 Thread rikki cattermole via Digitalmars-d-learn
On 25/04/2018 5:13 AM, Steven Schveighoffer wrote: On 4/24/18 12:49 PM, kinke wrote: On Tuesday, 24 April 2018 at 16:22:04 UTC, Steven Schveighoffer wrote: On 4/24/18 10:31 AM, Byron Heads wrote: I will start ignoring win32 when win64 doesn't require dealing with visual studio installs. Also

Re: Are Fibers just broken in D?

2018-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/24/18 12:49 PM, kinke wrote: On Tuesday, 24 April 2018 at 16:22:04 UTC, Steven Schveighoffer wrote: On 4/24/18 10:31 AM, Byron Heads wrote: I will start ignoring win32 when win64 doesn't require dealing with visual studio installs. Also I have a feeling a client will ask for it.

Re: Are Fibers just broken in D?

2018-04-24 Thread kinke via Digitalmars-d-learn
On Tuesday, 24 April 2018 at 16:22:04 UTC, Steven Schveighoffer wrote: On 4/24/18 10:31 AM, Byron Heads wrote: I will start ignoring win32 when win64 doesn't require dealing with visual studio installs. Also I have a feeling a client will ask for it. Unfortunately I don't think the VS

Re: Are Fibers just broken in D?

2018-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/24/18 10:31 AM, Byron Heads wrote: On Tuesday, 24 April 2018 at 13:36:48 UTC, Steven Schveighoffer wrote: This is not the case of executing 100,000 concurrent fibers, but executing 100,000 *sequential* fibers. It should work just fine. Correct, in a normal run of my system there maybe

Re: Are Fibers just broken in D?

2018-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/24/18 10:16 AM, Radu wrote: On Tuesday, 24 April 2018 at 13:36:48 UTC, Steven Schveighoffer wrote: On 4/24/18 5:11 AM, bauss wrote: On Tuesday, 24 April 2018 at 07:58:01 UTC, Radu wrote: On Tuesday, 24 April 2018 at 00:46:39 UTC, Byron Heads wrote: [...] This is not a fiber issue but

Re: Are Fibers just broken in D?

2018-04-24 Thread Byron Heads via Digitalmars-d-learn
On Tuesday, 24 April 2018 at 13:36:48 UTC, Steven Schveighoffer wrote: On 4/24/18 5:11 AM, bauss wrote: On Tuesday, 24 April 2018 at 07:58:01 UTC, Radu wrote: On Tuesday, 24 April 2018 at 00:46:39 UTC, Byron Heads wrote: Fibers on Win32 have a memory leak for sure: import core.thread :

Re: Are Fibers just broken in D?

2018-04-24 Thread Radu via Digitalmars-d-learn
On Tuesday, 24 April 2018 at 13:36:48 UTC, Steven Schveighoffer wrote: On 4/24/18 5:11 AM, bauss wrote: On Tuesday, 24 April 2018 at 07:58:01 UTC, Radu wrote: On Tuesday, 24 April 2018 at 00:46:39 UTC, Byron Heads wrote: [...] This is not a fiber issue but a more memory management issue.

Re: Are Fibers just broken in D?

2018-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/24/18 5:11 AM, bauss wrote: On Tuesday, 24 April 2018 at 07:58:01 UTC, Radu wrote: On Tuesday, 24 April 2018 at 00:46:39 UTC, Byron Heads wrote: Fibers on Win32 have a memory leak for sure: import core.thread : Fiber; void main() {     foreach(ulong i; 0..99_999) {     auto foo =

Re: Are Fibers just broken in D?

2018-04-24 Thread bauss via Digitalmars-d-learn
On Tuesday, 24 April 2018 at 07:58:01 UTC, Radu wrote: On Tuesday, 24 April 2018 at 00:46:39 UTC, Byron Heads wrote: On Friday, 20 April 2018 at 20:52:17 UTC, Byron Moxie wrote: On Friday, 20 April 2018 at 20:46:20 UTC, Steven Schveighoffer wrote: On 4/20/18 2:58 PM, Byron Moxie wrote: [...]

Re: Are Fibers just broken in D?

2018-04-24 Thread Radu via Digitalmars-d-learn
On Tuesday, 24 April 2018 at 00:46:39 UTC, Byron Heads wrote: On Friday, 20 April 2018 at 20:52:17 UTC, Byron Moxie wrote: On Friday, 20 April 2018 at 20:46:20 UTC, Steven Schveighoffer wrote: On 4/20/18 2:58 PM, Byron Moxie wrote: [...] It sounds like the problems may be due to Win32 and