~sircmpwn/hare-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 3

[PATCH harelang.org] fix glitches in tagged unions/match example

Details
Message ID
<20210320235602.1214509-1-sourcehut@phil.spodhuis.org>
DKIM signature
missing
Download raw message
Patch: +3 -3
---
 content/tutorials/introduction.md | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/content/tutorials/introduction.md b/content/tutorials/introduction.md
index 61ec5fc..589d8fe 100644
--- a/content/tutorials/introduction.md
+++ b/content/tutorials/introduction.md
@@ -765,8 +765,8 @@   # TODO: We're going to expand the syntax for tuples later
      	let x: (str | int | example | void) = "Hello!";
      
      	match (x) {
      		s: str  => fmt::println("x is a str: {}", s);
      		i: int  => fmt::println("x is an int: {}", i);
      		s: str  => fmt::println("x is a str: {}", s),
      		i: int  => fmt::println("x is an int: {}", i),
      		example => fmt::println("x is example"),
      		void    => fmt::println("x is void"),
      	};
@@ -778,7 +778,7 @@   # TODO: We're going to expand the syntax for tuples later
      		example => -1,
      		*       => abort(),
      	};
      	fmt::println("y is {}", y);
      	fmt::printfln("y is {}", y);
      };
  details: |
      One of the most important features of Hare is **tagged unions**. These are
-- 
2.31.0
Details
Message ID
<CA2VZP701PZN.1INS09EHVTVYR@desktop>
In-Reply-To
<20210320235602.1214509-1-sourcehut@phil.spodhuis.org> (view parent)
DKIM signature
missing
Download raw message
> match (x) {
> - s: str => fmt::println("x is a str: {}", s);
> - i: int => fmt::println("x is an int: {}", i);
> + s: str => fmt::println("x is a str: {}", s),
> + i: int => fmt::println("x is an int: {}", i),

These should be changed to printfln too
Details
Message ID
<20210321224424.1266983-1-sourcehut@phil.spodhuis.org>
In-Reply-To
<CA2VZP701PZN.1INS09EHVTVYR@desktop> (view parent)
DKIM signature
missing
Download raw message
Patch: +5 -5
Alexey Yerin caught that the match block was also using println instead
of printfln.  Adjusted patch for that.
---
 content/tutorials/introduction.md | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/content/tutorials/introduction.md b/content/tutorials/introduction.md
index 61ec5fc..bb0bdd4 100644
--- a/content/tutorials/introduction.md
+++ b/content/tutorials/introduction.md
@@ -765,10 +765,10 @@   # TODO: We're going to expand the syntax for tuples later
      	let x: (str | int | example | void) = "Hello!";
      
      	match (x) {
      		s: str  => fmt::println("x is a str: {}", s);
      		i: int  => fmt::println("x is an int: {}", i);
      		example => fmt::println("x is example"),
      		void    => fmt::println("x is void"),
      		s: str  => fmt::printfln("x is a str: {}", s),
      		i: int  => fmt::printfln("x is an int: {}", i),
      		example => fmt::printfln("x is example"),
      		void    => fmt::printfln("x is void"),
      	};

      	x = example;
@@ -778,7 +778,7 @@   # TODO: We're going to expand the syntax for tuples later
      		example => -1,
      		*       => abort(),
      	};
      	fmt::println("y is {}", y);
      	fmt::printfln("y is {}", y);
      };
  details: |
      One of the most important features of Hare is **tagged unions**. These are
-- 
2.31.0
Details
Message ID
<CA3E98Z0YKEZ.Z978WFPHK52C@taiga>
In-Reply-To
<20210321224424.1266983-1-sourcehut@phil.spodhuis.org> (view parent)
DKIM signature
missing
Download raw message
Send a new patch in its own thread, please. You put the context-specific
details in the commit message, too, and they belong in the timely
commentary instead (after the ---)
Reply to thread Export thread (mbox)