Re: how to assign to shared obj.systime?

2020-07-14 Thread Kagamin via Digitalmars-d-learn
--- import std; shared class TimeCount { synchronized void startClock() { auto me = cast()this; me.startTime = Clock.currTime; } synchronized void endClock() { auto me = cast()this; me.endTime =

Re: how to assign to shared obj.systime?

2020-07-14 Thread Arafel via Digitalmars-d-learn
On 14/7/20 8:05, Kagamin wrote: On Monday, 13 July 2020 at 07:26:06 UTC, Arafel wrote: That's exactly why what I propose is a way to *explicitly* tell the compiler about it, like @system does for safety. With __gshared you can opt out from sharing safety, then you're back to old good C-style

Re: how to assign to shared obj.systime?

2020-07-14 Thread Kagamin via Digitalmars-d-learn
--- import std; shared class TimeCount { void startClock() { auto me = cast()this; me.startTime = Clock.currTime; } void endClock() { auto me = cast()this; me.endTime = Clock.currTime; } void

Re: how to assign to shared obj.systime?

2020-07-14 Thread Arafel via Digitalmars-d-learn
On 14/7/20 8:13, Kagamin wrote: --- import std; shared class TimeCount { void startClock() {     auto me = cast()this;     me.startTime = Clock.currTime; } void endClock() {     auto me = cast()this;     me.endTime = Clock.currTime; } void

Re: how to assign to shared obj.systime?

2020-07-14 Thread Kagamin via Digitalmars-d-learn
On Monday, 13 July 2020 at 07:26:06 UTC, Arafel wrote: That's exactly why what I propose is a way to *explicitly* tell the compiler about it, like @system does for safety. With __gshared you can opt out from sharing safety, then you're back to old good C-style multithreading.

Re: How can I make executeShell ask for Admin Elevation?

2020-07-14 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
On Monday, 13 July 2020 at 19:32:33 UTC, Marcone wrote: alias runas = compose!(x => to!bool((cast(int) x) > 32), x => ShellExecute(null, "runas", "cmd", cast(wchar*) "/c \"cd /d %s && %s\"".format(getcwd(), x).to!wstring, null, SW_HIDE).WaitForSingleObject(WAIT_TIMEOUT)); runas("netsh

Re: how to assign to shared obj.systime?

2020-07-14 Thread Arafel via Digitalmars-d-learn
On 14/7/20 10:45, Dominikus Dittes Scherkl wrote: This is generally true. Avoid sharing many variables! Tasks should be as independent from each other as possible. Anything else is bad design doomed to run into problems sooner or later. Also there is really almost never a good reason to share

Re: how to assign to shared obj.systime?

2020-07-14 Thread Kagamin via Digitalmars-d-learn
Yes, all the synchronization and casting pretty much mandates that shared data must be behind some kind of abstraction for better ergonomics and better correctness too.

Re: how to assign to shared obj.systime?

2020-07-14 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
On Tuesday, 14 July 2020 at 07:05:43 UTC, Arafel wrote: *However*, for this to work, you shouldn't use `shared` member variables unless absolutely necessary, much less whole `shared` classes/structs This is generally true. Avoid sharing many variables! Tasks should be as independent from each

Re: getopt: How does arraySep work?

2020-07-14 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 14 July 2020 at 11:12:06 UTC, Andre Pany wrote: [...] Steven Schveighoffer already answered while I was composing this, so discarding top half. As far as I can tell the default arraySep of "" splitting the argument by whitespace is simply not the case.

Re: getopt: How does arraySep work?

2020-07-14 Thread Andre Pany via Digitalmars-d-learn
On Tuesday, 14 July 2020 at 14:33:47 UTC, Steven Schveighoffer wrote: On 7/14/20 10:22 AM, Steven Schveighoffer wrote: The documentation needs updating, it should say "parameters are added sequentially" or something like that, instead of "separation by whitespace".

Re: getopt: How does arraySep work?

2020-07-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/14/20 10:22 AM, Steven Schveighoffer wrote: The documentation needs updating, it should say "parameters are added sequentially" or something like that, instead of "separation by whitespace". https://github.com/dlang/phobos/pull/7557 -Steve

Re: getopt: How does arraySep work?

2020-07-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/14/20 9:51 AM, Anonymouse wrote: On Tuesday, 14 July 2020 at 11:12:06 UTC, Andre Pany wrote: [...] Steven Schveighoffer already answered while I was composing this, so discarding top half. As far as I can tell the default arraySep of "" splitting the argument by whitespace is simply

Re: getopt: How does arraySep work?

2020-07-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/14/20 10:05 AM, Steven Schveighoffer wrote: Hm... that looks like it IS actually expecting to do what Andre wants. It's adding each successive parameter. If that doesn't work, then there's something wrong with the logic that decides whether a parameter is part of the previous argument

Re: getopt: How does arraySep work?

2020-07-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/14/20 7:12 AM, Andre Pany wrote: Hi, by reading the documentation of std.getopt I would assume, this is a valid call dmd -run sample.d --modelicalibs a b ``` d import std; void main(string[] args) {     string[] modelicaLibs;     getopt(args, "modelicalibs", );    

Re: getopt: How does arraySep work?

2020-07-14 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 14 July 2020 at 13:40:44 UTC, Steven Schveighoffer wrote: The whitespace separator doesn't get to your program. args is: ["sample", "--modelicalibs", "a", "b"] There is no separator in the parameter to --modelicalibs, it's just "a". What you need to do is: dmd -run sample.d

Re: Uploading coverage to Codecov doesn't work

2020-07-14 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 14 July 2020 at 17:52:25 UTC, Basile B. wrote: On Tuesday, 14 July 2020 at 11:05:17 UTC, Mitacha wrote: On Saturday, 11 July 2020 at 09:43:39 UTC, Basile B. wrote: On Wednesday, 8 July 2020 at 15:55:58 UTC, Mitacha wrote: I filed an issue on codecov community forum

Re: Uploading coverage to Codecov doesn't work

2020-07-14 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 14 July 2020 at 11:05:17 UTC, Mitacha wrote: On Saturday, 11 July 2020 at 09:43:39 UTC, Basile B. wrote: On Wednesday, 8 July 2020 at 15:55:58 UTC, Mitacha wrote: I filed an issue on codecov community forum https://community.codecov.io/t/uploading-d-lang-coverage-doesnt-work/1740

D Mir: standard deviation speed

2020-07-14 Thread tastyminerals via Digitalmars-d-learn
I am trying to implement standard deviation calculation in Mir for benchmark purposes. I have two implementations. One is the straightforward std = sqrt(mean(abs(x - x.mean())**2)) and the other follows Welford's algorithm for computing variance (as described here:

Re: D Mir: standard deviation speed

2020-07-14 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 14 July 2020 at 19:04:45 UTC, tastyminerals wrote: I am trying to implement standard deviation calculation in Mir for benchmark purposes. I have two implementations. One is the straightforward std = sqrt(mean(abs(x - x.mean())**2)) and the other follows Welford's algorithm for

misc questions about a DUB package

2020-07-14 Thread DanielG via Digitalmars-d-learn
I have some D-wrapped C libraries I'm considering publishing to DUB, mainly for my own use but also for anybody else who might benefit. I've never done this before so I have some questions: - Should there be any obvious relationship between the DUB package version and the version of the C

Error: `std.uni.isUpper` conflicts with `std.ascii.isUpper`

2020-07-14 Thread Marcone via Digitalmars-d-learn
import std: isUpper, writeln; void main(){ writeln(isUpper('A')); } Why I get this error? How can I use isUpper()?

Re: Error: `std.uni.isUpper` conflicts with `std.ascii.isUpper`

2020-07-14 Thread Ben Jones via Digitalmars-d-learn
On Tuesday, 14 July 2020 at 20:37:53 UTC, Marcone wrote: import std: isUpper, writeln; void main(){ writeln(isUpper('A')); } Why I get this error? How can I use isUpper()? import std.uni: isUpper; // or import std.ascii : isUpper import std.stdio : writeln; import std pulls in all

Question about publishing a useful function I have written

2020-07-14 Thread Cecil Ward via Digitalmars-d-learn
I have written something which may or may not be novel and I’m wondering about how to distribute it to as many users as possible, hoping others will find it useful. What’s the best way to publish a D routine ? It is called void assume( bool condition ) nothrow nogc safe for example:

Re: D Mir: standard deviation speed

2020-07-14 Thread 9il via Digitalmars-d-learn
On Tuesday, 14 July 2020 at 19:04:45 UTC, tastyminerals wrote: @fastmath private double sd0(T)(Slice!(T*, 1) flatMatrix) @fastmath shouldn't be really used with summation algorithms except the `"fast"` version of them. Otherwise, they may or may not behave like "fast".

What is the best CI to test with (almost) latest GDC?

2020-07-14 Thread 9il via Digitalmars-d-learn
For now, Mir doesn't really support GDC. But we want to. Is there are a clear way to get a specific version of GDC. Is there a table of GDC compilers with correspnding DMD FE versions? dlang.org refers to a deprecated page, it is weird.

Re: D Mir: standard deviation speed

2020-07-14 Thread 9il via Digitalmars-d-learn
On Wednesday, 15 July 2020 at 02:08:48 UTC, 9il wrote: On Tuesday, 14 July 2020 at 19:04:45 UTC, tastyminerals wrote: @fastmath private double sd0(T)(Slice!(T*, 1) flatMatrix) @fastmath shouldn't be really used with summation algorithms except the `"fast"` version of them. Otherwise, they

Re: Error: `std.uni.isUpper` conflicts with `std.ascii.isUpper`

2020-07-14 Thread oddp via Digitalmars-d-learn
On 2020-07-14 22:37, Marcone via Digitalmars-d-learn wrote: import std: isUpper, writeln; void main(){ writeln(isUpper('A')); } Why I get this error? How can I use isUpper()? Two more options: either fully qualify the name: import std; void main(){ writeln(std.uni.isUpper('A')); }

Re: Error: `std.uni.isUpper` conflicts with `std.ascii.isUpper`

2020-07-14 Thread oddp via Digitalmars-d-learn
On 2020-07-14 22:37, Marcone via Digitalmars-d-learn wrote: import std: isUpper, writeln; void main(){ writeln(isUpper('A')); } Why I get this error? How can I use isUpper()? Two more options: either fully qualify the name: import std; void main(){ writeln(std.uni.isUpper('A')); }

Re: Question about publishing a useful function I have written

2020-07-14 Thread Max Haughton via Digitalmars-d-learn
On Tuesday, 14 July 2020 at 21:58:49 UTC, Cecil Ward wrote: I have written something which may or may not be novel and I’m wondering about how to distribute it to as many users as possible, hoping others will find it useful. What’s the best way to publish a D routine ? [...] GitHub is the

Re: misc questions about a DUB package

2020-07-14 Thread 9il via Digitalmars-d-learn
On Tuesday, 14 July 2020 at 20:56:06 UTC, DanielG wrote: I have some D-wrapped C libraries I'm considering publishing to DUB, mainly for my own use but also for anybody else who might benefit. I've never done this before so I have some questions: - Should there be any obvious relationship

Re: misc questions about a DUB package

2020-07-14 Thread DanielG via Digitalmars-d-learn
Thank you.

Re: Question about publishing a useful function I have written

2020-07-14 Thread 9il via Digitalmars-d-learn
On Tuesday, 14 July 2020 at 21:58:49 UTC, Cecil Ward wrote: Does anyone know if this has already been published by someone else? https://github.com/libmir/mir-core/blob/master/source/mir/utility.d#L29 We test LDC and DMC. CI needs an update to be actually tested with GDC.

Re: Vibe.d and NodeJs with Express

2020-07-14 Thread bauss via Digitalmars-d-learn
On Sunday, 12 July 2020 at 19:16:32 UTC, aberba wrote: 3) packages, now it might be better though. But I've always felt that there's not a lot of people using D for complete web dev projects... I'm one of the few but then again I don't use a lot of external packages either other than what

Re: Uploading coverage to Codecov doesn't work

2020-07-14 Thread Mitacha via Digitalmars-d-learn
On Saturday, 11 July 2020 at 09:43:39 UTC, Basile B. wrote: On Wednesday, 8 July 2020 at 15:55:58 UTC, Mitacha wrote: [...] It's broken for me too, on gitlab,... --- GitLab CI detected. project root: . --> token set from env Yaml found at: ./.codecov.yml ==> Running gcov in .

getopt: How does arraySep work?

2020-07-14 Thread Andre Pany via Digitalmars-d-learn
Hi, by reading the documentation of std.getopt I would assume, this is a valid call dmd -run sample.d --modelicalibs a b ``` d import std; void main(string[] args) { string[] modelicaLibs; getopt(args, "modelicalibs", ); assert(modelicaLibs == ["a", "b"]); } ``` but it fails,