Skip to content

Commit 2835436

Browse files
committed
document export bindings and script host visibility
1 parent 88038cb commit 2835436

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

docs/embedding-fscript-language.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,14 @@ let result = FScript.evalWithExterns [ toUpperExtern ] typed
5757
## Loading once and invoking by name
5858

5959
Use `FScript.Runtime.ScriptHost` when a host needs reusable loading and direct function invocation.
60+
Only top-level exported bindings are exposed through this API.
6061

6162
```fsharp
6263
open FScript.Language
6364
open FScript.Runtime
6465
6566
let externs = Registry.all { RootDirectory = "." }
66-
let loaded = ScriptHost.loadSource externs "let add x y = x + y"
67+
let loaded = ScriptHost.loadSource externs "export let add x y = x + y"
6768
let result = ScriptHost.invoke loaded "add" [ VInt 1L; VInt 2L ]
6869
```
6970

docs/syntax-and-indentation.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This document describes the concrete syntax accepted by the interpreter and the
88
- Top-level statements are:
99
- `type` / `type rec` declarations
1010
- `let` / `let rec` bindings
11+
- `export let` / `export let rec` bindings
1112
- expressions
1213
- Parsing is layout-aware: the lexer emits `Indent`/`Dedent` tokens from leading whitespace.
1314
- Comments use `//` line-comment syntax.
@@ -23,6 +24,7 @@ This document describes the concrete syntax accepted by the interpreter and the
2324
- `let x = expr`
2425
- `let rec f x = ... and g y = ...`
2526
- nested via blocks
27+
- `export` is only valid on top-level `let` bindings
2628
- Conditionals:
2729
- `if cond then a else b`
2830
- `elif` desugars to nested `if`

0 commit comments

Comments
 (0)