Re: Stacktraces in static constructors

2016-05-06 Thread Nordlöw via Digitalmars-d-learn
On Tuesday, 3 May 2016 at 10:48:51 UTC, Nordlöw wrote: This is a big problem for me because, in my application, I've realized unittests as functions called from within static shared module constructors to elide the problem of unittests being enabled recursively, which slows down iterative comp

Re: Ascii string literal.

2016-05-06 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 7 May 2016 at 01:37:30 UTC, Jonathan M Davis wrote: In general, it's better to use representation than to cast, because representation gets the constness right, whereas if you cast, there's always the risk that you won't. Yeah, if it is a general thing, but here it is a simple fu

Re: Ascii string literal.

2016-05-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Fri, 06 May 2016 21:57:22 + "Adam D. Ruppe via Digitalmars-d-learn" wrote: > On Friday, 6 May 2016 at 21:39:35 UTC, Anonymouse wrote: > > Is this different from what std.string.representation does? > > No, it does the same thing, but with your own function the > intention may be clearer (o

Re: Ascii string literal.

2016-05-06 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 6 May 2016 at 21:39:35 UTC, Anonymouse wrote: Is this different from what std.string.representation does? No, it does the same thing, but with your own function the intention may be clearer (or you could do a template to avoid any function or custom types too)

Re: Ascii string literal.

2016-05-06 Thread Anonymouse via Digitalmars-d-learn
On Friday, 6 May 2016 at 20:29:35 UTC, Adam D. Ruppe wrote: On Friday, 6 May 2016 at 20:01:27 UTC, Alexandru Ermicioi wrote: Is it possible somehow to convert implicitly a string literal Not implicitly (well, unless you just use string, ascii is a strict subset of utf-8 anyway), but you could

Re: Ascii string literal.

2016-05-06 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 6 May 2016 at 20:01:27 UTC, Alexandru Ermicioi wrote: Is it possible somehow to convert implicitly a string literal Not implicitly (well, unless you just use string, ascii is a strict subset of utf-8 anyway), but you could do it explicitly easily. immutable(ubyte)[] ascii(string

Ascii string literal.

2016-05-06 Thread Alexandru Ermicioi via Digitalmars-d-learn
Good day, Is it possible somehow to convert implicitly a string literal into an ubyte array? For example: void do(immutable(ubyte)[] asciiString) { // Do something with ascii string. } And from another section of code, calling it like: do("Some ascii string"); --- If no, is there an

Re: Async or event library

2016-05-06 Thread Jay Norwood via Digitalmars-d-learn
The tnfox cross-platform toolkit had some solution for per-thread event loops. I believe this was the demo: https://github.com/ned14/tnfox/blob/master/TestSuite/TestEventLoops/main.cpp

Re: Accepting function or delegate as function argument

2016-05-06 Thread Gary Willoughby via Digitalmars-d-learn
On Wednesday, 4 May 2016 at 15:23:20 UTC, Rene Zwanenburg wrote: On Wednesday, 4 May 2016 at 14:54:39 UTC, chmike wrote: Two constructors, one accepting a function and the other one accepting a delegate would do the job for the API. Is there a simple method to convert a function pointer into a

Re: How the heck is onInvalidMemoryOperationError() nothrow?

2016-05-06 Thread Jeremy DeHaan via Digitalmars-d-learn
On Friday, 6 May 2016 at 03:24:23 UTC, tsbockman wrote: On Friday, 6 May 2016 at 02:57:59 UTC, Jeremy DeHaan wrote: [...] From the spec (https://dlang.org/spec/function.html#nothrow-functions): "Nothrow functions can only throw exceptions derived from class Error." Throwing an Error is

Re: Async or event library

2016-05-06 Thread rikki cattermole via Digitalmars-d-learn
On 07/05/2016 12:08 AM, chmike wrote: Excuse the naive question rikki, why does the window event loop have to be single threaded ? The question is just to expose the rationale. Is it to avoid the synchronization overhead to access the window data ? In this case there is indeed a lot of data. Is

Re: parameter pack to inputRange

2016-05-06 Thread Alex Parrill via Digitalmars-d-learn
On Friday, 6 May 2016 at 05:00:48 UTC, Erik Smith wrote: Is there an existing way to adapt a parameter pack to an input range? I would like to construct an array with it. Example: void run(A...) (A args) { Array!int a(toInputRange(args)); } Use std.range.only: http://dlang.org/phobos/st

Re: Async or event library

2016-05-06 Thread Kagamin via Digitalmars-d-learn
On Friday, 6 May 2016 at 12:08:29 UTC, chmike wrote: In some applications and event types the synchronization overhead is small compared to the benefit of executing tasks in parallel on different cores. GUI generates too many messages that are handled too fast - synchronization overhead would

Re: Async or event library

2016-05-06 Thread chmike via Digitalmars-d-learn
Excuse the naive question rikki, why does the window event loop have to be single threaded ? The question is just to expose the rationale. Is it to avoid the synchronization overhead to access the window data ? In this case there is indeed a lot of data. Is there another reason ? In some ap

Re: Async or event library

2016-05-06 Thread rikki cattermole via Digitalmars-d-learn
Me and Dicebot have just had a quick conversion on IRC about this. To recap, I'm talking about event loops for windowing. For an event loop for e.g. socket based systems like Vibe.d it is a different story. For windowing you have the limitation of having to be on the same thread as the one tha

Re: Async or event library

2016-05-06 Thread rikki cattermole via Digitalmars-d-learn
On 06/05/2016 11:21 PM, Dicebot wrote: On Thursday, 5 May 2016 at 09:21:04 UTC, rikki cattermole wrote: Event loops needs to be thread local not per process. So many API's such as WinAPI for e.g. GUI's have this requirement in it that its just not worth fighting over. It is implementation deta

Re: Async or event library

2016-05-06 Thread Dicebot via Digitalmars-d-learn
On Thursday, 5 May 2016 at 09:21:04 UTC, rikki cattermole wrote: Event loops needs to be thread local not per process. So many API's such as WinAPI for e.g. GUI's have this requirement in it that its just not worth fighting over. It is implementation detail. You can have global event loop and

Re: Async or event library

2016-05-06 Thread Dicebot via Digitalmars-d-learn
On Thursday, 5 May 2016 at 08:19:26 UTC, chmike wrote: At the bottom of the wiki page there is an innocent question regarding TLS which is quite devastating. A worker thread pool system would not support affinity between threads and callback context. Unfortunately, D relies on Thread Local Stor

Re: Async or event library

2016-05-06 Thread Kagamin via Digitalmars-d-learn
On Thursday, 5 May 2016 at 08:19:26 UTC, chmike wrote: At the bottom of the wiki page there is an innocent question regarding TLS which is quite devastating. A worker thread pool system would not support affinity between threads and callback context. Unfortunately, D relies on Thread Local Stor

Re: Async or event library

2016-05-06 Thread rikki cattermole via Digitalmars-d-learn
On 06/05/2016 9:40 PM, chmike wrote: On Thursday, 5 May 2016 at 09:21:04 UTC, rikki cattermole wrote: Event loops needs to be thread local not per process. So many API's such as WinAPI for e.g. GUI's have this requirement in it that its just not worth fighting over. I don't understand. Do you

Re: Async or event library

2016-05-06 Thread chmike via Digitalmars-d-learn
On Thursday, 5 May 2016 at 09:21:04 UTC, rikki cattermole wrote: Event loops needs to be thread local not per process. So many API's such as WinAPI for e.g. GUI's have this requirement in it that its just not worth fighting over. I don't understand. Do you mean that these event loops are singl

Tree in ddox-generated pages

2016-05-06 Thread VlasovRoman via Digitalmars-d-learn
Hey guys! I have project with 3.5k strings of code. Now I'm writing documentation for this. I'm using scod, ddox based generator, but after generation I get pages where all my modules is not grouped by packages. What i'm doing wrong? Thanks.