Browse Source

Merge branch 'main' into zig-0.15

Chris Boesch 3 weeks ago
parent
commit
4bad15a95b

+ 0 - 11
patches/patches/084_async.patch

@@ -1,11 +0,0 @@
---- exercises/084_async.zig	2023-10-03 22:15:22.125574535 +0200
-+++ answers/084_async.zig	2023-10-05 20:04:07.219436606 +0200
-@@ -48,7 +48,7 @@
- pub fn main() void {
-     // Additional Hint: you can assign things to '_' when you
-     // don't intend to do anything with them.
--    foo();
-+    _ = async foo();
- }
- 
- fn foo() void {

+ 0 - 10
patches/patches/085_async2.patch

@@ -1,10 +0,0 @@
---- exercises/085_async2.zig	2023-10-03 22:15:22.125574535 +0200
-+++ answers/085_async2.zig	2023-10-05 20:04:07.226103397 +0200
-@@ -19,6 +19,7 @@
- 
- pub fn main() void {
-     var foo_frame = async foo();
-+    resume foo_frame;
- }
- 
- fn foo() void {

+ 0 - 16
patches/patches/086_async3.patch

@@ -1,16 +0,0 @@
---- exercises/086_async3.zig	2023-10-03 22:15:22.125574535 +0200
-+++ answers/086_async3.zig	2023-10-05 20:04:07.229436793 +0200
-@@ -13,7 +13,12 @@
-     const n = 5;
-     var foo_frame = async foo(n);
- 
--    ???
-+    // Silly solution. You can also use a loop.
-+    resume foo_frame;
-+    resume foo_frame;
-+    resume foo_frame;
-+    resume foo_frame;
-+    resume foo_frame;
- 
-     print("\n", .{});
- }

+ 0 - 21
patches/patches/087_async4.patch

@@ -1,21 +0,0 @@
---- exercises/087_async4.zig	2023-10-03 22:15:22.125574535 +0200
-+++ answers/087_async4.zig	2023-10-05 20:04:07.236103584 +0200
-@@ -16,7 +16,7 @@
- 
-     while (global_counter <= 5) {
-         print("{} ", .{global_counter});
--        ???
-+        resume foo_frame;
-     }
- 
-     print("\n", .{});
-@@ -24,7 +24,7 @@
- 
- fn foo() void {
-     while (true) {
--        ???
--        ???
-+        global_counter += 1;
-+        suspend {}
-     }
- }

+ 0 - 11
patches/patches/088_async5.patch

@@ -1,11 +0,0 @@
---- exercises/088_async5.zig	2023-10-03 22:15:22.125574535 +0200
-+++ answers/088_async5.zig	2023-10-05 20:04:07.239436980 +0200
-@@ -36,7 +36,7 @@
- pub fn main() void {
-     var myframe = async getPageTitle("http://example.com");
- 
--    var value = ???
-+    var value = await myframe;
- 
-     print("{s}\n", .{value});
- }

+ 0 - 13
patches/patches/089_async6.patch

@@ -1,13 +0,0 @@
---- exercises/089_async6.zig	2023-10-03 22:15:22.125574535 +0200
-+++ answers/089_async6.zig	2023-10-05 20:04:07.242770376 +0200
-@@ -41,8 +41,8 @@
-     var com_frame = async getPageTitle("http://example.com");
-     var org_frame = async getPageTitle("http://example.org");
- 
--    var com_title = com_frame;
--    var org_title = org_frame;
-+    var com_title = await com_frame;
-+    var org_title = await org_frame;
- 
-     print(".com: {s}, .org: {s}.\n", .{ com_title, org_title });
- }

+ 0 - 11
patches/patches/090_async7.patch

@@ -1,11 +0,0 @@
---- exercises/090_async7.zig	2023-10-03 22:15:22.125574535 +0200
-+++ answers/090_async7.zig	2023-10-05 20:04:07.249437167 +0200
-@@ -29,7 +29,7 @@
-     // The main() function can not be async. But we know
-     // getBeef() will not suspend with this particular
-     // invocation. Please make this okay:
--    var my_beef = getBeef(0);
-+    var my_beef = nosuspend getBeef(0);
- 
-     print("beef? {X}!\n", .{my_beef});
- }

+ 0 - 26
patches/patches/091_async8.patch

@@ -1,26 +0,0 @@
---- exercises/091_async8.zig	2023-10-03 22:15:22.125574535 +0200
-+++ answers/091_async8.zig	2023-10-05 20:04:07.252770563 +0200
-@@ -17,7 +17,7 @@
- 
-     var frame = async suspendable();
- 
--    print("X", .{});
-+    print("D", .{});
- 
-     resume frame;
- 
-@@ -25,11 +25,11 @@
- }
- 
- fn suspendable() void {
--    print("X", .{});
-+    print("B", .{});
- 
-     suspend {
--        print("X", .{});
-+        print("C", .{});
-     }
- 
--    print("X", .{});
-+    print("E", .{});
- }