summaryrefslogtreecommitdiff
path: root/chapter23/README.md
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2026-10-24 15:41:48 -0700
committerCliff Click <cliffc@acm.org>2026-10-24 15:41:48 -0700
commit489672dfac7efc78fc239ba7c2dfc82f1c5fbeab (patch)
tree9f4e04ed9d4f7443c03b02269cc77a96bb23dbd0 /chapter23/README.md
parentfeb98e1bb6c973428b94591ed5b0aed5e4137bd0 (diff)
downloadSimple-489672dfac7efc78fc239ba7c2dfc82f1c5fbeab.tar.gz
Simple-489672dfac7efc78fc239ba7c2dfc82f1c5fbeab.zip
Finish chapter numbering, retire combined chapter 24, and update documentation
Diffstat (limited to 'chapter23/README.md')
-rw-r--r--chapter23/README.md14
1 files changed, 13 insertions, 1 deletions
diff --git a/chapter23/README.md b/chapter23/README.md
index c99d2441..8f371e9b 100644
--- a/chapter23/README.md
+++ b/chapter23/README.md
@@ -3,7 +3,7 @@
English | [日本語](README.ja.md)
[Previous: Chapter 22](../chapter22/README.md) |
-[Next: Chapter 24](../chapter24/README.md)
+[Next: Chapter 24a](../chapter24a/README.md)
In this chapter we add *methods*, functions defined in structs which take a
hidden `self` argument and can access the struct fields. Here is an
@@ -53,6 +53,18 @@ You can also read [this chapter](https://github.com/SeaOfNodes/Simple/tree/linea
Here is the [complete language grammar](docs/23-grammar.md) for this chapter.
+## Chained comparisons
+
+`lo <= x < hi` compares adjacent values and evaluates `x` only once. If the
+first comparison fails, the later operand is not evaluated. This uses the
+same control and scope merges as short-circuit expressions; it does not need
+SCCP. For example, `10 < 30 < 20` is false, and `0 < 2 <= 2` is true.
+
+A chain must keep one direction, but may mix strict and inclusive tests:
+`a < b <= c` and `a >= b > c` are allowed; `a < b > c` is rejected. Equality
+has lower precedence and does not join a chain. Parentheses can still make
+the result of one comparison an operand of another.
+
## Why Cyclic Types?
Cyclic types give us a sharper analysis than the alternative, and thus admit