Re: Is this nogc? dmd and gdc disagree

2016-02-13 Thread Kapps via Digitalmars-d-learn
On Saturday, 13 February 2016 at 00:41:35 UTC, tsbockman wrote: On Friday, 12 February 2016 at 23:46:09 UTC, Kapps wrote: You'll encounter this pretty often in Phobos I think. I really don't think @nogc is ready, and tend to avoid it in my code. Exceptions are a big reason for it, and lots of f

Re: Is this nogc? dmd and gdc disagree

2016-02-12 Thread tsbockman via Digitalmars-d-learn
On Friday, 12 February 2016 at 23:46:09 UTC, Kapps wrote: You'll encounter this pretty often in Phobos I think. I really don't think @nogc is ready, and tend to avoid it in my code. Exceptions are a big reason for it, and lots of functions in Phobos throw exceptions which prevents them from bei

Re: Is this nogc? dmd and gdc disagree

2016-02-12 Thread Kapps via Digitalmars-d-learn
On Thursday, 11 February 2016 at 12:41:16 UTC, rcorre wrote: On Thursday, 11 February 2016 at 04:20:13 UTC, tsbockman wrote: On Thursday, 11 February 2016 at 03:09:51 UTC, rcorre wrote: I recently tried compiling enumap with GDC, and found that it disagrees with DMD on whether a function is @no

Re: Is this nogc? dmd and gdc disagree

2016-02-11 Thread tsbockman via Digitalmars-d-learn
On Thursday, 11 February 2016 at 12:55:02 UTC, rcorre wrote: Though it appears (in 2.070 at least) that zip's range primitives aren't nogc: I took a look at the source code for `zip()`, and the cause of this deficiency is that `Zip` takes a `StoppingPolicy` as a runtime parameter, rather than

Re: Is this nogc? dmd and gdc disagree

2016-02-11 Thread rcorre via Digitalmars-d-learn
On Thursday, 11 February 2016 at 12:41:16 UTC, rcorre wrote: On Thursday, 11 February 2016 at 04:20:13 UTC, tsbockman wrote: Using zip and slices guarantees that the structure returned will be only 5*size_t.sizeof bytes, regardless of the types of K and V. I'm on the DMD 2.070 release, so may

Re: Is this nogc? dmd and gdc disagree

2016-02-11 Thread rcorre via Digitalmars-d-learn
On Thursday, 11 February 2016 at 04:20:13 UTC, tsbockman wrote: On Thursday, 11 February 2016 at 03:09:51 UTC, rcorre wrote: I recently tried compiling enumap with GDC, and found that it disagrees with DMD on whether a function is @nogc. Here's a semi-reduced test-case: Here's an @nogc versio

Re: Is this nogc? dmd and gdc disagree

2016-02-10 Thread tsbockman via Digitalmars-d-learn
On Thursday, 11 February 2016 at 03:09:51 UTC, rcorre wrote: I recently tried compiling enumap with GDC, and found that it disagrees with DMD on whether a function is @nogc. Here's a semi-reduced test-case: Here's an @nogc version of `byKeyValue()`: @nogc auto byKeyValue() const { static im

Re: Is this nogc? dmd and gdc disagree

2016-02-10 Thread tsbockman via Digitalmars-d-learn
On Thursday, 11 February 2016 at 03:09:51 UTC, rcorre wrote: GDC claims that byKeyValue() allocates a closure, but DMD is just fine with me calling it @nogc. I'm inclined to agree with GDC here, unless DMD is doing some magic so that actually doesn't allocate a closure. I cannot reproduce you

Is this nogc? dmd and gdc disagree

2016-02-10 Thread rcorre via Digitalmars-d-learn
I recently tried compiling enumap with GDC, and found that it disagrees with DMD on whether a function is @nogc. Here's a semi-reduced test-case: --- import std.range; import std.traits: EnumMembers; import std.typecons : tuple, staticIota; import std.algorithm : map; struct Enumap(K, V)