Re: How to get a function name (string) @ compile time

2018-12-08 Thread Andrew Pennebaker via Digitalmars-d-learn
On Monday, 3 November 2008 at 12:29:16 UTC, Simen Kjaeraas wrote: On Mon, 03 Nov 2008 12:33:05 +0100, Denis Koroskin <2kor...@gmail.com> wrote: On Mon, 03 Nov 2008 04:11:20 +0300, Daniel Ribeiro Maciel wrote: Denis Koroskin Wrote: On Mon, 03 Nov 2008 01:59:56 +0300, Daniel Ribeiro

Re: dmd -unittest works poorly with executables

2018-12-08 Thread Neia Neutuladh via Digitalmars-d-learn
On Sat, 08 Dec 2018 20:16:09 +, Andrew Pennebaker wrote: > I think it's lame to have to use magical code like `version(unittest) {} > else` to guard our main functions, when we run unit tests. Could D go > ahead and do the right thing, automatically shadowing our main functions > when the unit

Re: dmd -unittest works poorly with executables

2018-12-08 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 8 December 2018 at 20:16:09 UTC, Andrew Pennebaker wrote: I think it's lame to have to use magical code like `version(unittest) {} else` to guard our main functions, when we run unit tests. Could D go ahead and do the right thing, automatically shadowing our main functions when

dmd -unittest works poorly with executables

2018-12-08 Thread Andrew Pennebaker via Digitalmars-d-learn
I think it's lame to have to use magical code like `version(unittest) {} else` to guard our main functions, when we run unit tests. Could D go ahead and do the right thing, automatically shadowing our main functions when the unit tests are run?

Re: cant run unittests

2018-12-08 Thread Andrew Pennebaker via Digitalmars-d-learn
On Saturday, 16 July 2016 at 20:22:15 UTC, Seb wrote: On Thursday, 14 July 2016 at 10:13:38 UTC, dom wrote: On Thursday, 14 July 2016 at 00:33:50 UTC, ethgeh wrote: On Wednesday, 13 July 2016 at 19:41:53 UTC, dom wrote: how can i run my unittests for a dynamic library? some weird conflict is

Re: Library settings, best practices?

2018-12-08 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 8 December 2018 at 16:58:24 UTC, Vladimirs Nordholm wrote: Is there a best practice to enabling specific parts of a library? For my terminal library, I put it all in a struct. Then the user gets to choose how to initialize it, and its destructor gets a chance to cleanup when

Library settings, best practices?

2018-12-08 Thread Vladimirs Nordholm via Digitalmars-d-learn
Hello. Pre-rant: - I have a library to aid in development for the terminal. This library has to initialize some things before it can be used, and I run some code in `shared static this(){...}`. I believe in the most common case scenario my initializer should be run. The initializer

Re: cannot use local f as parameter to non-global template

2018-12-08 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 8 December 2018 at 09:57:29 UTC, aliak wrote: This compiles fine. However, if I change the match template to: template match(handlers...) { auto match(alias f)(Holder!f holder) { return handlers[0](holder); } } Notice the template parameter of the eponymous match

Re: ElementType of MapResult is a delegate??

2018-12-08 Thread John Chapman via Digitalmars-d-learn
On Saturday, 8 December 2018 at 13:02:00 UTC, Yuxuan Shui wrote: This surprised me A LOT: https://d.godbolt.org/z/82a_GZ So if I call something.map!().array, I get an array of delegates? That makes no sense to me. But in your example, "(a) =>" returns "{return tmp;}", which is a delegate.

ElementType of MapResult is a delegate??

2018-12-08 Thread Yuxuan Shui via Digitalmars-d-learn
This surprised me A LOT: https://d.godbolt.org/z/82a_GZ So if I call something.map!().array, I get an array of delegates? That makes no sense to me.

Re: Writing Program Without main Function

2018-12-08 Thread Samir via Digitalmars-d-learn
On Saturday, 8 December 2018 at 03:30:30 UTC, Jonathan M Davis wrote: There's one main per program, not per module. Where main lives depends on how the program was written, but dub encourages putting it in app.d, because that's what it generates when you create a new dub project. imports then

cannot use local f as parameter to non-global template

2018-12-08 Thread aliak via Digitalmars-d-learn
Hi, I'm wondering about why this happens in a certain situation and not another. I have the following code: struct Holder(alias fun) { alias T = typeof(fun()); T get() { return fun(); } alias get this; } template match(handlers...) { auto match(T)(T holder) { return