File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed
Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -57,13 +57,14 @@ let result = FScript.evalWithExterns [ toUpperExtern ] typed
5757## Loading once and invoking by name
5858
5959Use ` 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
6263open FScript.Language
6364open FScript.Runtime
6465
6566let 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"
6768let result = ScriptHost.invoke loaded "add" [ VInt 1L; VInt 2L ]
6869```
6970
Original file line number Diff line number Diff 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 `
You can’t perform that action at this time.
0 commit comments