June 02, 2016 Re: non empty slices | ||||
---|---|---|---|---|
| ||||
Posted in reply to ag0aep6g | On Thursday, 2 June 2016 at 23:35:53 UTC, ag0aep6g wrote:
> It's the Algebraic. The `get` method isn't @nogc. The documentation [1] says that it may throw an exception, which is most probably being allocated through the GC. So that's a reason why it can't be @nogc.
>
> The alternative `peek` method is not documented to throw an exception, but it's not @nogc either. No idea why. Maybe Algebraic does GC allocations internally. I wouldn't know for what, though. Or it misses a @nogc somewhere.
>
>
> [1] http://dlang.org/phobos/std_variant#.VariantN.get
Yeah... thanks a lot!
|
June 03, 2016 Re: non empty slices | ||||
---|---|---|---|---|
| ||||
Posted in reply to ag0aep6g | On 06/03/2016 01:35 AM, ag0aep6g wrote:
> The alternative `peek` method is not documented to throw an exception,
> but it's not @nogc either. No idea why. Maybe Algebraic does GC
> allocations internally. I wouldn't know for what, though. Or it misses a
> @nogc somewhere.
I've looked at the source to see if it's something simple, and Algebraic/VariantN seems to be terribly complicated. Writing a simpler @nogc tagged union may be easier than fixing the phobos one, if the phobos one can even be made @nogc.
|
June 02, 2016 Re: non empty slices | ||||
---|---|---|---|---|
| ||||
Posted in reply to ag0aep6g | On Thursday, 2 June 2016 at 23:44:49 UTC, ag0aep6g wrote:
> On 06/03/2016 01:35 AM, ag0aep6g wrote:
>> The alternative `peek` method is not documented to throw an exception,
>> but it's not @nogc either. No idea why. Maybe Algebraic does GC
>> allocations internally. I wouldn't know for what, though. Or it misses a
>> @nogc somewhere.
>
> I've looked at the source to see if it's something simple, and Algebraic/VariantN seems to be terribly complicated. Writing a simpler @nogc tagged union may be easier than fixing the phobos one, if the phobos one can even be made @nogc.
I'm also inside the source... yes, its not a simple one. I think I will try to write my own one...
|
Copyright © 1999-2021 by the D Language Foundation