refactor(lang): rename the str type (and stringify builtin) to string
Expand the abbreviated string type and its conversion builtin to the full
word everywhere:
str -> string (the immutable-string type)
str(x) -> str -> string(x) -> string (the stringify builtin;
what `{…}` interpolation calls)
Types are recognized by identifier, and llty maps both spellings to LLVM
`ptr`, so this is an atomic source rewrite: type annotations, the Ludic
type tags, the builtin name/dispatch, and the interpolation desugar, plus
the grammars, LSP, docs (type-str -> type-string, fn-str -> fn-string), and
inventory. int/bool stay (universally accepted, like Math).
Reseeded; C-free fixpoint holds; all suites green (45/24/29); site + check.py OK.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
4c48077d68
commit
b7745a4600
70 changed files with 207 additions and 207 deletions
|
|
@ -4,7 +4,7 @@ name: arg
|
|||
category: builtins
|
||||
kind: builtin
|
||||
tokens: arg
|
||||
sig: arg(i) -> str
|
||||
sig: arg(i) -> string
|
||||
tip: The i-th command-line argument as a string.
|
||||
order: 50
|
||||
---
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ name: getenv
|
|||
category: builtins
|
||||
kind: builtin
|
||||
tokens: getenv
|
||||
sig: getenv(name) -> str
|
||||
sig: getenv(name) -> string
|
||||
tip: Read an environment variable, returning empty when it is unset.
|
||||
order: 23
|
||||
---
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
---
|
||||
id: fn-str
|
||||
name: str
|
||||
id: fn-string
|
||||
name: string
|
||||
category: builtins
|
||||
kind: builtin
|
||||
tokens: str
|
||||
sig: str(x) -> str
|
||||
tokens: string
|
||||
sig: string(x) -> string
|
||||
tip: Convert an int, bool, or fixed value to text; a string passes through unchanged.
|
||||
order: 1
|
||||
---
|
||||
|
||||
Converts a value to its textual form: an <code>int</code>, <code>bool</code>, or <code>fixed</code> becomes a string, and a value that is already a string is returned unchanged. This is what backtick <code>`{…}`</code> interpolation calls under the hood, so most of the time you can interpolate directly instead of calling <code>str</code> yourself. Reach for the explicit form when you need to store or pass around the text, or build a string in pieces. The result can be printed, drawn with <code>Screen.draw_text</code>, or concatenated.
|
||||
Converts a value to its textual form: an <code>int</code>, <code>bool</code>, or <code>fixed</code> becomes a string, and a value that is already a string is returned unchanged. This is what backtick <code>`{…}`</code> interpolation calls under the hood, so most of the time you can interpolate directly instead of calling <code>string</code> yourself. Reach for the explicit form when you need to store or pass around the text, or build a string in pieces. The result can be printed, drawn with <code>Screen.draw_text</code>, or concatenated.
|
||||
|
||||
Parameters:
|
||||
- `x` — the value to convert to text
|
||||
|
|
@ -19,7 +19,7 @@ program LabelValue {
|
|||
var score: int = 250
|
||||
|
||||
handler ReportScore phase Start {
|
||||
let label = str(score)
|
||||
let label = string(score)
|
||||
print(label)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue