Re: automatically verifying code samples in phobos docs

2015-08-19 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-08-20 01:41, Laeeth Isharc wrote: Should this be done? How? Just use a documented unit tests block: /// unittest { // code goes here } It will be run as part of the unit tests and it will be included when generating the documentation. Although I don't have a good solution for

Reading dmd's source code

2015-08-19 Thread Freddy via Digitalmars-d-learn
dmd's source code is very big, are there tips for reading it(important files)?

Re: automatically verifying code samples in phobos docs

2015-08-19 Thread Laeeth Isharc via Digitalmars-d-learn
On Thursday, 20 August 2015 at 01:56:31 UTC, Jonathan M Davis In general, the code examples are supposed to be unit tests with an empty ddoc comment on them so that they're unit tested. However, in the case of std.net.curl, because it would be contacting websites, I doubt that they're going to

Re: Promises/A+ spec implementations?

2015-08-19 Thread Alexander J. Vincent via Digitalmars-d-learn
On Thursday, 20 August 2015 at 01:10:39 UTC, Alex Parrill wrote: IMO the 'next' generation of async is fibers/coroutines, not promises. Vibe.d is a great example; the code looks exactly like a normal synchronous function (including try/catch!), but is asynchronous behind the scenes. See also

Re: automatically verifying code samples in phobos docs

2015-08-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, August 20, 2015 02:09:12 Timon Gehr via Digitalmars-d-learn wrote: > On 08/20/2015 02:02 AM, Laeeth Isharc wrote: > > On Thursday, 20 August 2015 at 00:00:55 UTC, Timon Gehr wrote: > >> On 08/20/2015 01:41 AM, Laeeth Isharc wrote: > >>> > >>> BTW I don't know why you can't convert a ch

Re: Promises/A+ spec implementations?

2015-08-19 Thread Alex Parrill via Digitalmars-d-learn
On Wednesday, 19 August 2015 at 04:18:03 UTC, Alexander J. Vincent wrote: Hi, folks. Over ten years ago I had some interest in the D language. I'm starting to think about it again... I've been using Mozilla's Promises implementations for quite a while, now, and they're surprisingly nice to w

Re: automatically verifying code samples in phobos docs

2015-08-19 Thread Timon Gehr via Digitalmars-d-learn
On 08/20/2015 02:02 AM, Laeeth Isharc wrote: On Thursday, 20 August 2015 at 00:00:55 UTC, Timon Gehr wrote: On 08/20/2015 01:41 AM, Laeeth Isharc wrote: BTW I don't know why you can't convert a char[] to string - seems harmless enough conversion that way around. It would need to allocate a n

Re: automatically verifying code samples in phobos docs

2015-08-19 Thread Laeeth Isharc via Digitalmars-d-learn
On Thursday, 20 August 2015 at 00:00:55 UTC, Timon Gehr wrote: On 08/20/2015 01:41 AM, Laeeth Isharc wrote: BTW I don't know why you can't convert a char[] to string - seems harmless enough conversion that way around. It would need to allocate a new string, otherwise, one would be able to

Re: automatically verifying code samples in phobos docs

2015-08-19 Thread Timon Gehr via Digitalmars-d-learn
On 08/20/2015 01:41 AM, Laeeth Isharc wrote: BTW I don't know why you can't convert a char[] to string - seems harmless enough conversion that way around. It would need to allocate a new string, otherwise, one would be able to modify the contents of the immutable string via the char[] referen

automatically verifying code samples in phobos docs

2015-08-19 Thread Laeeth Isharc via Digitalmars-d-learn
Should this be done? How? I sent a pull request for the std.net.curl docs. They all talk about assigning the results of web requests to strings, but at least on my setup this does not work (cannot assign char[] to string). I was trying to walk someone else through using this and it was con

Re: Empty struct, any runtime cost?

2015-08-19 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-08-19 16:05, Nicholas Wilson wrote: I'd be surprised if it didn't, but you can always check the disassembly. If for some reason either the compiler doesn't remove it (it never removes classes btw but not sure about structs) or the linker doesn't discard it you can try -gcsections ( or w/

Re: Empty struct, any runtime cost?

2015-08-19 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 19 August 2015 at 09:54:33 UTC, SimonN wrote: Hi, in a release-like build, I'm using the tharsis profiler, which is a frame-based profiler. Zone is a RAII struct that measures how long its own lifetime is. with (Zone(my_profiler, "zone name to appear in output")) {

Re: Empty struct, any runtime cost?

2015-08-19 Thread SimonN via Digitalmars-d-learn
On Wednesday, 19 August 2015 at 09:54:33 UTC, SimonN wrote: Hi, I've found this thread (Theoretical best practises): http://forum.dlang.org/thread/codmadrwuyqxbklmu...@forum.dlang.org My goal is the same; I'm only more wary of putting debug/version everywhere. If the empty struct isn't optimiz

Empty struct, any runtime cost?

2015-08-19 Thread SimonN via Digitalmars-d-learn
Hi, in a release-like build, I'm using the tharsis profiler, which is a frame-based profiler. Zone is a RAII struct that measures how long its own lifetime is. with (Zone(my_profiler, "zone name to appear in output")) { do_expensive_work(); do_some_more_work(); } /