Re: 1 - 17 ms, 553 ╬╝s, and 1 hnsec

2019-05-18 Thread Les De Ridder via Digitalmars-d-learn
On Saturday, 18 May 2019 at 20:34:33 UTC, Patrick Schluter wrote: * hurrah for French keyboard which has a rarely used µ key, but none for Ç a frequent character of the language.

Re: Creating Anonymous structs

2019-05-18 Thread Alex via Digitalmars-d-learn
On Saturday, 18 May 2019 at 20:53:50 UTC, Alex wrote: On Saturday, 18 May 2019 at 20:03:14 UTC, Adam D. Ruppe wrote: On Saturday, 18 May 2019 at 15:59:05 UTC, Alex wrote: Structs combine data, I have a use case where I do not want to litter the scope with variables and would like to put them

Re: Creating Anonymous structs

2019-05-18 Thread Alex via Digitalmars-d-learn
On Saturday, 18 May 2019 at 20:03:14 UTC, Adam D. Ruppe wrote: On Saturday, 18 May 2019 at 15:59:05 UTC, Alex wrote: Structs combine data, I have a use case where I do not want to litter the scope with variables and would like to put them in a struct but the variable will only be used once.

Re: 1 - 17 ms, 553 ╬╝s, and 1 hnsec

2019-05-18 Thread Patrick Schluter via Digitalmars-d-learn
On Thursday, 16 May 2019 at 15:19:03 UTC, Alex wrote: 1 - 17 ms, 553 ╬╝s, and 1 hnsec That's µs* for micro-seconds. * hurrah for French keyboard which has a rarely used µ key, but none for Ç a frequent character of the language. WTH!! is there any way to just get a normal u rather than

Re: Creating Anonymous structs

2019-05-18 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 18 May 2019 at 15:59:05 UTC, Alex wrote: Structs combine data, I have a use case where I do not want to litter the scope with variables and would like to put them in a struct but the variable will only be used once. This is basically what Phobos's Tuple is. auto x =

Re: Does -profile need the D runtime?

2019-05-18 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 18 May 2019 at 16:35:44 UTC, Robert M. Münch wrote: I want to profile my windows app which has a WinMain(). One of the first statements in WinMain() within a try{} is: Runtime.initialize(); But when I compile my app with -profile, it crashes on entry of WinMain(). Looks like

Does -profile need the D runtime?

2019-05-18 Thread Robert M. Münch via Digitalmars-d-learn
I want to profile my windows app which has a WinMain(). One of the first statements in WinMain() within a try{} is: Runtime.initialize(); But when I compile my app with -profile, it crashes on entry of WinMain(). Looks like this function is instrumented with code, that might need the D

Generic state machines

2019-05-18 Thread MJ via Digitalmars-d-learn
Anyone have any nice, generic and very simple state machine design patterns in D? Basically one someone specifies the state transition matrix and callbacks in a very simple and direct way. Using a struct itself is rather straightforward but requires boilerplate code. This could be removed

Re: Creating Anonymous structs

2019-05-18 Thread Alex via Digitalmars-d-learn
Also, I realize one could use Voldemort types, e.g., something like auto x = (){ struct X { int x; } return X(); } but this is so verbose as to not really be any better(although it does accomplish hiding the struct, I'm not so concerned with hiding the struct as I am code brevity. I do

Creating Anonymous structs

2019-05-18 Thread Alex via Digitalmars-d-learn
Structs combine data, I have a use case where I do not want to litter the scope with variables and would like to put them in a struct but the variable will only be used once. struct X { int x; double y; } X x; Seems redundant to have to do this, rather, it would be nice to do auto x =

Re: 1 - 17 ms, 553 ╬╝s, and 1 hnsec

2019-05-18 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 18 May 2019 at 00:17:20 UTC, kdevel wrote: Why not simply 17.5531 ms ("%.4f ms") to get rid of the non-ASCII µ prefix? fwiw I like this solution for the output. It is very clear to me.

Re: mixing (else) static if inadvertently with else if

2019-05-18 Thread rikki cattermole via Digitalmars-d-learn
Works: --- import std.stdio; void main() { func!true(false); func!false(false); func!false(true); } void func(bool A)(bool b) { static if (A) { writeln("a"); } else if (b) { writeln("b"); } else { writeln("c"); } } --- This works because

mixing (else) static if inadvertently with else if

2019-05-18 Thread kdevel via Digitalmars-d-learn
Today I stumbled over this error: elsestaticif.d ``` import std.stdio; void insert () () { // some code } void insert (T, Args ...) (T x, Args args) { static if (T.stringof == "int") {{ `int`.writeln; }} else if (T.stringof == "bool") {{ // ← "static" is missing here

Re: a way of approximating "API internal" visibility?

2019-05-18 Thread DanielG via Digitalmars-d-learn
On Saturday, 18 May 2019 at 07:37:16 UTC, Laurent Tréguier wrote: Maybe what you need is `package(a.b.c)`? Ah, that's exactly what I needed! Thank you.

Re: a way of approximating "API internal" visibility?

2019-05-18 Thread Laurent Tréguier via Digitalmars-d-learn
On Saturday, 18 May 2019 at 06:23:37 UTC, DanielG wrote: I'm working on a library spread across multiple modules/packages. Sometimes I have symbols that I would like to share between internal packages, but I don't want to make 'public' because then it would be exposed to the client-facing

a way of approximating "API internal" visibility?

2019-05-18 Thread DanielG via Digitalmars-d-learn
I'm working on a library spread across multiple modules/packages. Sometimes I have symbols that I would like to share between internal packages, but I don't want to make 'public' because then it would be exposed to the client-facing API. To a degree this could be gotten around by making

Meson build system user learning D.

2019-05-18 Thread Mike Brockus via Digitalmars-d-learn
Hello there this is your hometown Meson build system user here just happen to have a question related to unit testing in D. So is there a way to run the unit-test in the test main as a costume test runner in "test/test.d", and run the executable program in "src/main.d", with this resulting in

Re: 1 - 17 ms, 553 ╬╝s, and 1 hnsec

2019-05-18 Thread evilrat via Digitalmars-d-learn
On Thursday, 16 May 2019 at 15:19:03 UTC, Alex wrote: 1 - 17 ms, 553 ╬╝s, and 1 hnsec fancy useless asci hieroglyphic Holy shirt! All that time I was thinking this is just some sort of encoding artifacts in terminal(common problem on windows), especially because IIRC on Linux it is

Re: 1 - 17 ms, 553 ╬╝s, and 1 hnsec

2019-05-18 Thread Alex via Digitalmars-d-learn
On Friday, 17 May 2019 at 18:02:04 UTC, kdevel wrote: On Thursday, 16 May 2019 at 20:31:23 UTC, Vladimir Panteleev wrote: On Thursday, 16 May 2019 at 20:17:37 UTC, Steven Schveighoffer [...] hnsecs is more confusing than nanoseconds. People know what a nanosecond is, a hecto-nano-second is