Stories: Lexical Rules
See also:
spec/lexical.md— the rules these chapters explain.
Casing separates types from values
The parser needs to distinguish type names from value names in places where the syntax could otherwise allow competing readings. We already intended types to use PascalCase and values to use camelCase, so the practical question was why the language should permit spellings that abandon that convention and make parsing harder. We made the initial-case distinction a rule, letting the lexer hand the parser separate identifier classes rather than leaving it to recover the distinction from declarations. OCaml supplied the technique of splitting identifiers by initial case, though its mapping of those classes differs from Zane’s.
This is primarily a parsing decision. For example, Vector<Int> and a < b share the < character, but the uppercase type name and lowercase value name let the grammar distinguish type application from comparison without consulting a symbol table (lexical.md §5). The casing rule has to be enforced for that distinction to be reliable; a lint that could be waived would leave the parser needing to handle the exceptions.
Readers get a useful side benefit: an identifier’s initial case also helps them see whether it names a type or a value. We did not choose casing as a central organising idea for the language, and neither the type model nor the memory model follows from it. It is a small syntax rule that makes an intended convention useful to the parser as well as the reader. The cost is limited naming freedom: lowercase type names and uppercase value names are unavailable.
Privacy lives in the name
Enforced casing also makes it visible at every use site whether an identifier names a type or a value. Field privacy benefits from a similar visible marker, but there the reader-facing benefit was part of the reason for the choice.
Two decisions were tangled here, and it helps to take them in turn. The first was how privacy is spelled. Languages reach it three ways: a specifier per field (C#’s private on each member), a specifier over a range (C++’s private: heading a block), or the name itself (Dart’s leading underscore). We ruled out the per-field specifier first: it clutters every member with a modifier, and while it is unarguably explicit, explicitness is not its exclusive property — a convention can be just as unambiguous without the noise. C++’s range form we actually liked; it is terse and it groups. But the deciding argument for the name-based form is a virtue neither specifier form has: the marker rides along to the use site. A reader who meets _id in an expression sees that it is private right there, with no jump back to the declaration to find out; the specifier forms announce visibility only where the field is defined, and everywhere it is used the information is gone. The visible marker resembles the readability benefit of casing, though the casing rule was chosen primarily to simplify parsing.
The name-based form wins on a second count too, and it is the count we weigh most heavily: it is the simplest and most minimal of the three. It adds no grammar at all — no private keyword, no private: section, no per-member modifier slot — because it reuses the identifier the field already has. A property that costs zero new syntax and still reads at every use site is not a close call; the pull of the alternatives is mostly the gravity of the familiar.
So a leading _ marks a field private (lexical.md §4.2), and it changes nothing about the name’s lexical class — the first letter still fixes type-versus-value; the underscore is a separate signal layered on top.
The second decision was what privacy is private to, and here Zane’s extensibility forced a question C++ never has to ask. The model we started from is C++’s: a private field is visible to the type’s own methods and hidden from everyone else — privacy is a wall around the type, not around a file or a package. But in Zane methods are not sealed inside the type’s declaration; they are package-scope verbs, and a method taking a this receiver for some type may be declared in any package, including one the type’s author never saw. So “the type’s own methods” no longer names a closed set. We had to decide whether a this-receiver method declared in a foreign package sees the private fields, and we said yes: privacy in Zane is the line between a method and a non-method, not between one package and another (types.md §2.3). Any method whose first parameter is this for the type gets in, wherever it lives. We chose the general rule over the guarded rule because generality is a bet the whole language makes — a rule with fewer special cases is easier to hold in the head and harder to trip over — and drawing the privacy line at the package boundary would have carved a special case into a model that did not otherwise need one.
The cost is a single, honest one, and it lands in tooling rather than in the language. Because visibility is spelled in the name, flipping a field from private to public is a rename, and a rename touches every site that mentions the field, where a specifier-based language flips one token in one place. By hand that is tedious; the real answer is a rename refactor, which is to say the cost is a dependence on a language server that does not exist yet and one day will. Beyond that the decision costs essentially nothing — no runtime, no grammar, no reader confusion — and pretending otherwise to look even-handed would be dishonest.
A delimiter for each separated construct
Casing and the underscore load meaning onto the identifier; the last lexical decisions load it onto the punctuation between identifiers, under one governing rule — no mark may carry two meanings in the same context, so the parser never needs lookahead to identify the entries a separator separates.
The rule we settled on is that the delimiter is chosen by what is being separated and the bracket by the kind of content inside (lexical.md §6). A ; terminates every member of a struct or variant body; a , separates the elements of a value collection; a newline separates statements; { } encloses a member body or a code block; [ ] encloses a flat list. Each character has exactly one job in exactly one setting, so meeting it is unambiguous.
Two of these carry a deliberate asymmetry worth naming. The ; is always trailing — every member ends in one, single-member or many, inline or spread over lines — and the , is never trailing — it appears only between elements, never after the last. That was a choice against the more common style where a body’s last member may drop or optionally keep its separator. Making the terminator unconditional means newlines can be insignificant inside a body without a special rule for the final line, and giving the two characters different trailing behaviour keeps their roles visually distinct: a ; seen after every member reads as termination, a , seen only between elements reads as separation. The bracket split does the same work one level up — because { } always wraps a member body or code block and [ ] always wraps a flat list, the bracket alone shows the parser whether the newlines inside it are structural.
The honest cost here is small, and it is worth saying so plainly rather than inventing a drawback. The one stumbling block for a newcomer is the always-trailing ;: even inline, a body terminates its last member with a semicolon just like the rest — struct { r Int; g Int; b Int; } — which looks redundant next to languages that drop the final semicolon. We take the uniformity, one rule with no exception for the final member, over saving a character, because the exception is what would have cost a reader more than the semicolon does.
The bracket picks the separator
The chapter above states the rule as the delimiter is chosen by what is being separated — a member, a value-collection element, a statement. That reads like a principle, and we took it for one. It was not. It was a description of a list, and the list was what we were actually carrying around.
Reaching for dynamic containers exposed it. Choosing the separator for a map literal’s entries required stating the rule precisely enough to apply it to a construct the language did not yet have, and at that point the axis came apart in our hands. An enum body is a declaration — type Colors = enum [ red, green, blue ] — and it takes [ ] with ,. “Declaration member versus value-collection element” was therefore already false about a construct we had been writing from the start. The obvious repair, that ; goes wherever an entry pairs an identifier with a type, survived about a minute: a parameter list (Node(id Int, scale Float)), a generic header (Buffer<T Type, n Number>) and a field-constructor header (Vector{x Int, y Int}) all pair an identifier with a type, and all three take ,.
What actually held was thinner than either candidate, and it ran in only one direction: a ; appeared solely inside { }, but a { } did not imply a ;, because init{ } and the field constructors took ,. A one-directional rule cannot be stated in a sentence, and ours had quietly degenerated into three memorized constructs — a struct body, a variant body, match arms. The clearest symptom was in the syntax reference, which had to carve out “a constructor-header-specific exception” to describe a form that was not an exception to anything except our own account of the rule.
So we made it run both ways by keying it on the bracket instead. A { } body terminates each entry with ;, always trailing; a [ ], ( ) or < > list separates its entries with ,, never trailing (lexical.md §6). It is a very simple rule and it works almost always, which is the most we ask of it. The reason it lands so well is a fact about how the forms are actually written rather than anything deep about their meaning: a { } is very often multiline, while a ( ) or a [ ] much less often is. Always-trailing suits a multiline body — a final entry that carries the same mark as every other, so adding one touches one line — and never-trailing reads best on the single-line lists. The bracket was already correlated with the shape of the construct; we just stopped pretending the correlation was semantic and named the bracket as the rule.
We had considered dropping ; altogether and separating everything with ,. One mark is simpler than two, and it would have deleted the trailing asymmetry along with it. We rejected it on how a multiline body reads: in a body, ; is doing a genuinely different job from , — it is not separating one item from the next, it is terminating each item — and terminating reads more naturally down a column of members than separating does. A separator makes the last item a special case; a terminator makes every item alike. The other direction we looked at, keying on whether an entry declares an identifier or supplies a value, was worse than both: it puts ; inside parameter lists (Node(id Int; scale Float;)), and a parameter list is call-shaped, so a terminator there fights the form.
The honest cost is small and worth naming anyway. This is a second delimiter to learn, and ; does not look as light on the page as , does — init{x; y;} is visually heavier than init{x, y}, and init{ } is the most-written form in the language. We do not think it is a burden. It is what orthogonality costs here, and it is the kind of weight that stops registering once the forms are familiar. The rule’s one real limit is not the weight but the branch: a { } has two readings, a body of ;-terminated entries and a code block of newline-separated statements, so the bracket picks the separator everywhere except that it also has to pick which kind of { } it is. Every { } is introduced by a token that marks which reading it takes — a mould keyword, match, init, a type name, a verb’s signature — so nothing is ambiguous, but “almost always” is the accurate claim and we would rather write that than overstate it (lexical.md §6.4).
The glossary term went with the axis. It had been the member-versus-value delimiter, a name that encoded the very distinction we had just found did not hold, so keeping it would have preserved the wrong idea in the one place a reader goes to look a term up. It is the bracket-picked separator now. The name is plain and it states that the bracket does the picking, which is the whole content of the rule; there was no rival candidate worth weighing, because once the bracket determines the separator, naming anything else would be describing the old axis again.
Telling a body brace from a code block by its content
The chapter above rewrote the rule in order to reach dynamic containers, and then closed by reassuring itself about the one place the rule branches. A { } has two readings — a body of ;-terminated entries, and a code block of newline-separated statements — and the reassurance was that every { } is introduced by a token that marks which reading it takes: a mould keyword, match, init, a type name, a verb’s signature. That was true when it was written, and it stopped being true almost immediately, because the construct we had rewritten the rule for turned out to be the counterexample.
A map literal could have carried an introducing token. The obvious spelling is Map{ ... }, and it would have preserved the reassurance word for word. Two problems ruled it out. The smaller problem is that the slot in front of the brace is already taken: Type{ ... } is a field-constructor call, so Map{ ... } would be a call to a constructor named Map, and a reader meeting one would have no way to tell which they were looking at. The larger problem is that it would misrepresent the form. A map literal is not a Map; it is a piece of syntax that any keyed type can consume, and it carries @concepts$Map<K, V> — a compiler concept, with no storage form and no claim to be a complete type (syntax.md §2.8). Writing a type’s name in front of it would put a complete type where the whole point is that there isn’t one yet, in exactly the way [ ] does not name one either.
So the map literal stands alone in a value position with no token in front of it, and the two readings of { } genuinely compete. The collision is not hypothetical: a block argument is also a braced construct in argument position, and it need not trail — f({ x }, { y }) passes two of them (syntax.md §4.9). We looked first at closing the collision from that side, by restricting block arguments to the trailing position only, which would have left the interior of an argument list unambiguously map territory. It was a real option and we did not take it, because it pays for a local ambiguity with a permanent restriction on an unrelated feature, and because a better answer turned out to be available at no cost at all.
The better answer is that the two readings are already distinguishable by shape. A body holds ;-terminated entries; a code block holds statements. Nothing about that test needs a leading token — it needs only that the two shapes never coincide. And they coincide in exactly one case: the empty brace. {} is an empty block and would equally be an empty map, and no amount of looking at the entries settles it, because there are none.
Which turned the discrimination problem into a question we had to answer anyway, from the other end: what type does an empty literal have? A [ ] with no elements fixes no element type, and a { } with no entries fixes neither a key type nor a value type. There were three ways out. We could require an annotation inside the literal, so the form carries the type the elements do not supply — rejected for the same reason Map{ ... } was, since a literal’s whole character is that it defers the type to whatever consumes it, and a form that must name its own type is a constructor call wearing a literal’s brackets. We could mint @concepts$EmptyList and @concepts$EmptyMap, concept types that exist purely to be converted away — which is machinery bought to keep one spelling legal, and it would have left the empty brace ambiguous between an empty map and an empty block regardless. Or we could ban the empty literal outright.
We banned it. A [ ] literal must hold at least one element and a { } literal at least one entry, and an empty container is built by naming its type, which supplies what the literal cannot — Array(Int, 0) today, and the same move on whichever dynamic containers arrive later, whether as a plain constructor or a named one. The reasoning is that the ban is not a restriction imposed to buy the discrimination; it is the honest form of a fact that was already true. An empty literal never had a type to give, and every proposal for rescuing it amounted to writing the type down elsewhere in the expression. Once it was written down, a constructor was the natural place for it. That the ban also makes the shape test total — with no empty case left, a bare {} is always a code block and every other { } is settled by its entries (lexical.md §6.4) — came to us for free, and it let the block-argument restriction go back on the shelf unused.
The cost is real and it is paid at the keyboard. doSomething([]) is not a legal call, and there is no shortage of situations where passing an empty collection is the natural request; you name the container’s type at the call instead, and you write out a type you would rather have had inferred. We think that is the correct trade, because the inference was never actually available — the empty literal did not carry the type either, and the alternatives only moved the moment of naming around — but it is a form the language now makes impossible rather than merely more verbose, and a newcomer will reach for it first.
Of the reassurance we retired, finally, we would say that it was doing less work than it appeared to do. “Every { } is introduced by a token” is a claim about lookahead — it asserts that the reading is settled before the brace opens. The shape test is a claim about content, and it is the stronger of the two, because it does not depend on an inventory of introducing tokens staying complete as the language grows. The map literal was the first construct to fall outside that inventory. With the discrimination keyed on the brace’s content, the next such construct will not need a new rule.
The enum map takes braces
Keying the separator on the bracket settled the map literal, and settling the map literal sent us back over what was already written. If the bracket determines the reading, then every construct in the language is making a claim about its own nature simply by which bracket it wears, and we had never audited those claims — we had only ever changed the rule underneath them. One construct did not survive the audit.
An enum map attached uniform data to an enum’s members, and it was written Colors.colorName String [ red = "Red", green = "Green" ]. Under the old axis that looked unremarkable. Under the new rule it is the only place in the language where a name = value body is spelled as a [ ] list. Everything else that pairs an identifier with a value or a type takes { } and ;: the members of a struct or variant, the arms of a match, the fields of an init{ }, the entries of a field-constructor header or call site, and now the entries of a map literal. Everything in [ ] is a flat run of bare elements: array elements, the members of an enum body, the selectors of a match case group, the parameter types of a function type. Once the two piles are set side by side the enum map is plainly in the wrong pile, and it had been the whole time.
The comparison that makes it unarguable is the field-constructor call site. Weapon{name = String("Pistol"); damage = Float(10);} and Colors.colorName String [ red = "Red", ... ] are the same construct wearing different clothes: a header that states a type once, and a run of entries that each name a slot and supply a value for it. They had just been given the same treatment in the type rules, too — an enum-map entry became a coercion site on exactly the terms a field-constructor entry already was (types.md §4.2). Two forms that share a meaning and a treatment by the compiler should share their punctuation.
So the enum map takes the brace and the semicolon (adt.md §6), and the enum declaration it ranges over keeps its [ ], because an enum body really is a flat list of bare members. The one argument for leaving the enum map alone was that the two had looked like a matched pair on the page — enum [ ... ] above, [ ... ] below — and that pairing is what we gave up. We think the resemblance was misleading rather than useful: the declaration lists members, the map fills a slot per member, and the brackets now show which is which instead of implying the two are the same kind of construct. That is the rule doing its job, not an exception to it.
The audit paid for itself in one small, concrete respect, which is worth recording because such gains usually go unnoticed. The repository’s guard against reintroduced commas cannot be extended to multi-line bodies, because an indented entry line ending in , is legitimate in constructs that keep their commas. There used to be two such constructs; the enum map was one of them. Now there is only the multi-line enum body. The guard did not get stronger, but the reason it has to stay weak got smaller, and a rule whose exceptions are shrinking is usually a rule that was right.
We did not go back and correct the older chapters. The chapter that introduced enum maps shows the [ ] form, and it stays that way: it was true when it was written, and the record of the language having once spelled it differently is worth more than a tidy file.
Statements end in ; so a trailing brace can end one
The bracket rule had been settled twice and audited once, and the problem that kept turning up was not the separator at all — it was the end of a statement. Trailing arguments made it unavoidable. A call that moves its last argument outside the parentheses elides the ), so the } of that argument is the last mark on the line; the question is whether the statement is over. We wanted it to be. A brace that closes the call and the statement at once is the whole appeal of the form — one mark doing the closing work that the parenthesized version needs two for.
We could not have it, and the obstacle was a rule written years earlier for a different reason. A newline separated statements; the spec called it the one place a newline was structural. While that held, a } could not end a statement, because the newline already did. Declaring that a brace ends one too would not have been a new rule so much as a second rule competing with the first over the same boundary, and the reader would have had to know which won. The layout owned the statement, and nothing else could.
So the semicolon went in to take the boundary away from the layout. That is the whole of its purpose, and it is worth being exact about it, because a terminator on every statement looks like an aesthetic choice and was not one. We did not add ; because a column of statements reads better with one, or because anyone wanted two statements per line; those are consequences, and mild ones. We added it so that a statement would carry its own end, and once a statement carries its own end, saying that a } also ends one is an ordinary claim about the grammar rather than a fight with the whitespace. The ; is scaffolding for the brace rule. It exists so that, in the place we cared about most, it does not have to be written.
Which is why the trailing form takes no terminator, and why the alternative looked wrong to us before we could say why. Writing it out —
if(true) {
print("hi");
};
— the ; reads as though it belongs to the block, and the desugaring shows that it does not. In full, the call is if(true, { print("hi"); });, and the ) slides in between the } and the ;: the terminator was never part of what got passed to the callee. A mark that consistently implies the wrong grouping is worse than no mark, and this one was redundant besides, since a trailing argument is required to be the last element of its statement and the brace is therefore already unambiguous. Nothing may follow it (lexical.md §6.3).
Two other consequences fell out of the same move. The first is that a { } may no longer open a statement at all (lexical.md §6.3.1); scoping a run of work is a call taking a block argument, core’s do(block), which reads the same and costs no grammar. With raw blocks gone and ; marking where statements end, the rule that a trailing { had to open on the same line as its call — written to keep a statement block on the next line from being swallowed — had nothing left to disambiguate, and went with it. Three rules retired for one added, which is the trade we were hoping for and do not always get.
The second is that trailing stopped being a property of blocks specifically. Any last argument can take the position if it is a { } — a block or a map literal (syntax.md §4.9) — because size is what earns the position and a map literal gets just as large. We tried to extend it to [ ] as well, on the same reasoning, and pulled back: expr[args] is already subscript syntax, so a trailing [ ] would make the reading of an opening [ depend on whether a call preceded it. That is resolvable but it is exactly the context-dependence the bracket rule exists to abolish, and we had just spent two chapters removing that kind of dependence. { has no such rival.
The cost lands on the chapter before last. The brace with nothing in front of it settled map-literal-versus-block by their contents: a body held ;-terminated entries, a code block held statements, and the terminator distinguished them at the level of tokens. Once statements carry ; too, that test is gone — a body holds ;-terminated entries and a code block holds ;-terminated statements. What replaces it is a parse rather than a scan: read one expression, then look at the next mark, where a , opens a map entry’s value and a ; ends a statement. The test still settles every case, including the case that looks like a counterexample, since a match consumes its own scrutinee commas before the entry’s mark is reached. But the claim that the two are distinguished by shape was true when it was written and is not now, and a reader of that chapter should know the ground moved under it.
The honest price of the whole change is more punctuation than before. Every statement in every body now ends in a mark that was not there, which is a real amount of ink for a language that had gone out of its way to need none. We think it buys more than it costs, because what it buys is not the semicolons — it is their absence at the one place a reader looks hardest, the end of a trailing block, where the brace now carries the whole signal.
Literal structure and consumer interpretation
The string proposals pulled in two directions at first. We wanted the consumer of a string concept to interpret its text, so a regex such as "\w+" would not need another layer of backslashes just to survive the language. We also wanted \%name to interpolate a caller’s variable, and escaping a double quote still had to let the lexer find the end of the literal. Those jobs cannot all be postponed to a callee.
We separated literal structure from the interpretation of its text. The language recognizes quote and backslash escaping and resolves interpolation; other backslash sequences remain in the literal fragments for the consumer (lexical.md §7.1). Double escaping gives "\\%name" a literal interpolation marker. Recognition happens once, so the backslash it produces does not start another interpolation. Inserted primitive contents are data too, rather than new source for the scanner.
The string decision keeps ordinary strings on the value side and implicit constructors restricted to value or concept sources. We gave an interpolation site one fixed destination, the string primitive, so its coercion uses the existing conversion rule rather than asking the compiler to choose a formatting policy. A string concept can therefore carry runtime copied text without losing the consumer’s role. The small spelling \%name accepts one symbol; a field or call result first needs a binding. A general expression form is not part of this change.
Field privacy moves to the package
The method-based rule held until we wrote core in Zane. core declares each fundamental type as a struct over a storage primitive, holding it in one private _value field, and nearly everything core writes around those types has to reach that field: the arithmetic operators hand left._value and right._value to the machine operations of @operators$, the implicit constructor that carries a Bool back to @primitives$Bool reads the Bool’s field, and the helper that hands a condition to @controlflow$branch reads the field too. None of them is a method. An operator has a symbol as its name and operands, neither of them this; a constructor has no object yet, and a conversion reads the field of a different type from the type it builds. Under the rule of the earlier chapter not one of them could touch _value, and nothing short of making the field public would have let them.
The wall showed what the method rule had been guarding. It was strict where strictness bought nothing, inside the package that declares the type, and loose where it mattered, since any package could write a this method on Bool and read _value. That chapter had accepted that looseness as the price of generality. Writing a real package showed us it was the wrong way round. The verbs of one package are interconnected: an operator, the constructor that builds the value it returns, and the method that later reads it all depend on the same representation, and keeping that dependence in one place is what privacy is for. Code in another package does not take part in it, and that is exactly the code that should see only the public surface.
We weighed two other ways out. We could have added the package to the method rule instead of replacing it, so that a this method anywhere kept its access. That would have fixed core and left the field open to any package willing to write a method, which is no privacy at all. And we could have drawn the line around the whole project’s lib/, since a project’s library packages are written together too. But a leading _ already means “private to its package” on every package-scope declaration (packages.md §4.1), and a project-wide field rule would have given the same prefix a scope it has nowhere else.
So a _ field is now private to the package that declares its type (types.md §2.3). Every declaration in that package reaches it, whatever kind of declaration it is, and no declaration in another package does, an extension method included. The prefix draws one boundary everywhere it appears. The argument from generality that settled that chapter now points the other way: the special case was the field rule, the one use of _ that did not mark the package.
The boundary has two costs. Extension methods still exist, but one written in another package sees only the public surface, so a type’s author decides what extension can reach, and a library that wants its internals extended has to make them public for everyone. And the wall stands around the package, not the type: two types declared in one package see each other’s _ fields, so a large package encapsulates less than a wall around each type would. The functions story records what the this marker kept once it no longer granted access.
Declarations end the way statements do
A package-scope declaration ends with a ; unless it ends in a }, the same rule a statement follows inside a body (lexical.md §6.3). A declaration is written the same wherever it stands.
It started with one declaration. A foreign verb has no body: it ends on the string that names its C symbol, @primitives$I64 next() foreign "zane_counter_next", and the line simply stops. Every other package-scope declaration we had written ended on a closing token, a body’s } or a bracket, and this one ended on nothing. It looked unfinished, and the fix we reached for first was the one C writes after a prototype: a ; after the symbol.
That fix made foreign verbs the one package-scope declaration with a terminator, and the question why only they took one showed the rule we had was not one rule. The statements chapter had given every statement in a body a ;, and a declaration written inside a body is a statement there, so it took one. At package scope the same declaration took none, so moving a constant or a helper from a function body to the top of the file changed how it was spelled. The compiler had meanwhile found that package and import needed a ; at package scope after all, because import core$ main Unit() { } reads two ways, as a whole-package import followed by a declaration of main, or as an import of main followed by a constructor for Unit. So there were already three answers to whether a declaration ends with a ;, depending on the declaration’s form and where it stood, and foreign verbs would have made four.
There were two ways to make it one answer. The first was to require a terminator only where the parser cannot do without it, which is package and import and nothing else: an => verb or a type alias ends on an expression or a type, and the next declaration begins with a type, a binder or a keyword that cannot continue it. On that reading the foreign verb’s ; would have gone back out, since a string literal cannot be continued either. The second was to stop treating package scope as a separate place, and let a declaration end the way a statement does. We took the second. A rule that reads “every declaration and statement ends with a ;, unless it ends in a }” is one sentence a reader learns once, and it already held everywhere but the top of the file. The first rule is minimal for the parser, but a reader has to know which declarations the parser happens to need help with, and that is a fact about the grammar’s corners rather than about the program.
The cost is punctuation the parser does not need. Every => verb, type alias and constant at package scope gains a ; that carries no information a parser lacks, which is a fair amount of ink in a language that had resisted it. What it buys is for the reader: a long => expr has a visible end, an => verb looks like the => expr; arm of a match and the return expr; it stands for, and a declaration copied between a body and the top of a file needs no edit. The brace keeps the role the statements chapter gave it, ending a declaration that closes with one, so a verb with a { } body and a struct declaration keep their spelling unchanged.
Digit groups take the Swiss apostrophe
A long literal needs its digits grouped to be read, and the compiler grouped them before the spec stated any rule for numeric literals. The marks people write between digit groups by hand were the first candidates, and they failed on their own history. American notation writes one thousand and a half as 1,000.5, and German notation writes it as 1.000,5: each tradition uses , and . for exactly the jobs the other gives them. A program that reads 1.000 cannot know which tradition its author grew up in, and in Zane . is already the decimal point and , already separates arguments. Swiss notation writes 1'000.5, and its apostrophe marks grouping and nothing else, in every tradition that uses it.
So a ' stands between two digits before the . and only groups them: 1'000'000 is the integer literal 1000000, with the same value and the same concept type (lexical.md §7). The digits after the . take no separator. The mark was free to take, since the borrow marker and the loose operators that had once used ' were both retired, so 2'*3 is no longer a form to confuse it with.
Two consequences followed. The text that parseI64 and parseF64 accept stays a literal’s digits with no separator, as the runtime had parsed it from the start, so the separator is a mark of source text only (types.md §2.10). And a reader meets one more character in a numeric literal than the digits and the point, which is the whole of the cost.