feat(text): Text.to_float; a void function's return <value> is an error

Text.to_float reads a leading decimal number (strtod), the twin of Text.to_int, for data files.
A return with a value in a function that returns nothing now says so where it is, instead of
reaching clang as 'store void'. Seed regenerated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-23 19:19:28 +03:00
parent f5ab5cf88a
commit c57eafcacc
8 changed files with 38133 additions and 37958 deletions

View file

@ -0,0 +1,27 @@
---
id: text-to_float
name: Text.to_float
category: text
kind: namespace-method
tokens: Text.to_float
sig: Text.to_float(s) -> float
tip: Parse a leading decimal number from a string.
order: 11
ns: Text
member: to_float
---
Reads an optional sign, the leading digits, a decimal point and an exponent from <code>s</code> and returns them as a <code>float</code>, stopping at the first character that cannot continue a number - so <code>Text.to_float("0.25 m")</code> is <code>0.25</code>. A string with no leading number yields <code>0.0</code>. It is the float twin of <code>Text.to_int</code>, for reading a data file or a typed value.
Parameters:
- `s` — the string to parse
```ludic
program ParseSpeed {
var typed: string = "3.2"
handler Apply phase Update {
let speed = Text.to_float(typed) # 3.2
}
}
```