diff options
author | Dave Gauer <dave@ratfactor.com> | 2021-02-28 13:23:22 -0500 |
---|---|---|
committer | Dave Gauer <dave@ratfactor.com> | 2021-02-28 13:23:22 -0500 |
commit | b12afaa577e5f9b0c3bf922ec5c1ab15893c7378 (patch) | |
tree | c8a5be6d30f4b44ea6124064fcf3e399876ab661 /patches | |
parent | febc9dfecb5285cdaa9f4e9edb4d8331a1f1350c (diff) | |
download | ziglings-b12afaa577e5f9b0c3bf922ec5c1ab15893c7378.tar.gz ziglings-b12afaa577e5f9b0c3bf922ec5c1ab15893c7378.tar.bz2 ziglings-b12afaa577e5f9b0c3bf922ec5c1ab15893c7378.tar.xz ziglings-b12afaa577e5f9b0c3bf922ec5c1ab15893c7378.zip |
Added ex 48, additional comment on 46
Diffstat (limited to 'patches')
-rw-r--r-- | patches/patches/46_optionals2.patch | 19 | ||||
-rw-r--r-- | patches/patches/48_methods2.patch | 4 |
2 files changed, 20 insertions, 3 deletions
diff --git a/patches/patches/46_optionals2.patch b/patches/patches/46_optionals2.patch index 5becede..10705d9 100644 --- a/patches/patches/46_optionals2.patch +++ b/patches/patches/46_optionals2.patch @@ -1,8 +1,21 @@ -12c12 -< tail: *Elephant = null, // <---- make this optional! +8,19d7 +< // We also introduce the handy ".?" shortcut: +< // +< // const foo = bar.?; +< // +< // is the same as +< // +< // const foo = bar orelse unreachable; +< // +< // See if you can find where we use this shortcut below. +< // +< // Now let's make those elephant tails optional! +< // +24c12 +< tail: *Elephant = null, // Hmm... tail needs something... --- > tail: ?*Elephant = null, // <---- make this optional! -42c42 +54c42 < if (e.tail == null) ???; --- > if (e.tail == null) break; diff --git a/patches/patches/48_methods2.patch b/patches/patches/48_methods2.patch new file mode 100644 index 0000000..781a99e --- /dev/null +++ b/patches/patches/48_methods2.patch @@ -0,0 +1,4 @@ +57c57 +< e = e.???; // Which method do we want here? +--- +> e = e.getTail(); // Which method do we want here? |