Repository navigation
Conversation
`fetch(url, status: $s, text: $page, code: $c, response_headers: $h, headers: […]) { … }`
reads an address in the background, writes the response into state, then runs its
block with the names around the call as they were when it was made. `json_text(json,
path)` reads a value out of JSON, and strings gain `contains`, `starts_with`,
`ends_with`, `find`, `slice`, `split`, `replace` and `trim`, counting characters as
`len` does.
Every surface has them: the checker tables, the interpreter, compiled apps (the block is
compiled as an action over a copy of the caller's frame), the language server, the four
highlighters, the reference docs and syntax decisions, the roadmap, and a `preview.nf`
fixture that a test runs both ways. Built-in calls move out of the interpreter's `eval`
and codegen's `expr`, which also leaves each interpreted call using less stack than
before.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
fetch(url, status: $s, text: $page, code: $c, response_headers: $h, headers: […]) { … }reads an address in the background, writes the response into state, then runs its block with the names around the call as they were when it was made (syntax decision row 29).json_text(json, path)reads one value out of JSON as text (row 31).contains,starts_with,ends_with,find,slice,split,replaceandtrim, counting characters aslendoes;findgives-1when nothing is found andsliceoutside the text is a runtime error, like a list position (row 30).Every surface
fetchandjson_textrows inFUNCTIONS(functions gain ablockfield, as elements have); string methods inMETHODSwith a receiver and typed parameters.returnin an action block gets its own message.nifty-runtime/src/text.rsandnifty-download/src/fetch.rs. In compiled apps the block is compiled as an action over a copy of the caller's frame, withforaliases read into it, defined once the enclosing function is.ABI_VERSIONis now 6.fetchblock offers what an action does; function snippets add a block when one is needed; hover shows method parameters.functions.md(fetch,json_text), a string methods section invalues.md,language.md,cheat-sheet.md, the source-code map and the roadmap. The newfixtures/preview.nfis included in the docs and run by tests both ways.Built-in calls move out of the interpreter's
evaland codegen'sexpr. Onmain, an interpreted call took about 15.5 KB of stack in debug builds, so the 128-deep recursion test sat at 1.98 MB of a 2 MB thread; it now takes about 14.4 KB.Checked
cargo fmt --all --check,cargo clippy --workspace --all-targets -D warnings(also--target x86_64-pc-windows-msvc),cargo build --workspace,cargo test --workspace, Tree-sitter and VS Code tests, andmdbook build docsall pass on macOS.json_textand the string methods, and saved it withdownloadand the page's cookies. The HD (1080p HEVC, decodes cleanly with ffmpeg), SD, watermarked and sound (.m4a) files were all saved. Removed videos, profile links and non-TikTok links gave their messages. The same app compiles withnf build.fetchuses the same ureq + native TLS client asdownload.