Discussion
Loading...

Post

Log in
  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
Andrew Kelley
Andrew Kelley
@andrewrk@mastodon.social  ·  activity timestamp 5 days ago

I'm proud of how std.Io is shaping up in Zig. It's really comfortable.

At first we were worried that passing around `io` everywhere would feel tedious, but it's turning out to be positively delightful because it offers sync primitives that help you express code exactly how you want it.

    {
        // Populate fork_set.
        var group: Io.Group = .init;
        defer group.cancel(io);

        for (forks.items) |*fork|
            group.async(io, loadFork, .{ io, gpa, fork, color });

        try group.await(io);

        for (forks.items) |*fork| {
            const project_id = fork.project_id catch |err| switch (err) {
                error.AlreadyReported => process.exit(1),
            };
            try fork_set.put(arena, project_id, fork.path);
        }
    }
{ // Populate fork_set. var group: Io.Group = .init; defer group.cancel(io); for (forks.items) |*fork| group.async(io, loadFork, .{ io, gpa, fork, color }); try group.await(io); for (forks.items) |*fork| { const project_id = fork.project_id catch |err| switch (err) { error.AlreadyReported => process.exit(1), }; try fork_set.put(arena, project_id, fork.path); } }
{ // Populate fork_set. var group: Io.Group = .init; defer group.cancel(io); for (forks.items) |*fork| group.async(io, loadFork, .{ io, gpa, fork, color }); try group.await(io); for (forks.items) |*fork| { const project_id = fork.project_id catch |err| switch (err) { error.AlreadyReported => process.exit(1), }; try fork_set.put(arena, project_id, fork.path); } }
  • Copy link
  • Flag this post
  • Block
Étienne Parmentier
Étienne Parmentier
@tinylittleenormous@piaille.fr replied  ·  activity timestamp 5 days ago

@andrewrk How does it works for embeded targets ?

  • Copy link
  • Flag this comment
  • Block
Kauê HB
Kauê HB
@bakaq@mastodon.social replied  ·  activity timestamp 5 days ago

@andrewrk I'm extremely excited for the next release!

  • Copy link
  • Flag this comment
  • Block
tristanC
tristanC
@tristanC@functional.cafe replied  ·  activity timestamp 5 days ago

@andrewrk ha, so it's like #haskell :D

  • Copy link
  • Flag this comment
  • Block

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.2-alpha.23 no JS en
Automatic federation enabled
Log in
  • Explore
  • About
  • Members
  • Code of Conduct