Optional and NotNull version 0.5.0 - swift optional like and scala option like

ikod geller.garry at gmail.com
Mon Aug 20 09:16:18 UTC 2018


On Thursday, 16 August 2018 at 16:20:09 UTC, aliak wrote:
> On Thursday, 16 August 2018 at 12:25:14 UTC, aliak wrote:
>> It's also @nogc and @safe
>
> No it's not. Not dispatching at least. Dunno why though. Seems 
> safey is because taking an address. Nogc will have to look in 
> to.

Hello!

please, help, how can I use match in @nogc code:

import optional;

void main() @nogc {
     Optional!int i = 1;
     bool b = true;
     i.match!(
         (v) => b,
         () => false
     );
}

fails to compile:
source/app.d(3,6): Error: function `D main` is @nogc yet 
allocates closures with the GC
source/app.d(7,9):        app.main.__lambda1 closes over variable 
b at source/app.d(5,10)

Thanks!


More information about the Digitalmars-d-announce mailing list