Files
five/examples/test_frb_scope.prg
Charles KWON OhJun 59568f3301 Five v0.9 — Harbour + Go fusion language
- Compiler: PP → Lexer → Parser → Analyzer → Gengo pipeline
- Parser: 232/236 (98%) Harbour compatibility, registry-based dispatch
- RTL: 351 Harbour-compatible functions
- RDD: DBF/NTX/CDX engines with Rushmore bitmap optimization
- Go Interop: IMPORT + pkg.Func() + obj:Method() with FastPath (15M calls/sec)
- HB_FUNC API: Full Harbour C API compatible Go bridge
- Concurrency: SPAWN/LAUNCH/GOROUTINE, <-, WATCH, PARALLEL FOR, ASYNC/AWAIT
- Extensions: Multi-return, DEFER, Slice, f-string, Nil-safe ?:, CONST
- Macro Compiler: Runtime AST parsing and evaluation
- Debugger: TUI debugger with source display, breakpoints, stepping
- FRB: Native + Pcode dual mode runtime binary
- Tests: 13 packages ALL PASS

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 09:41:50 +09:00

37 lines
882 B
Plaintext

// Test FRB symbol scoping — load/unload isolation
FUNCTION Main()
LOCAL pMod
? "=== FRB Symbol Scope Test ==="
? ""
// Host program has its own Add function
? "Host Add(1,2):", Add(1, 2)
? ""
// Load FRB module that also has Add
? "Loading pcode module..."
pMod := FrbLoad("mylib_pc.frb")
// FrbDo uses MODULE scope — calls module's Add (string concat)
? "Module Hello:", FrbDo(pMod, "HELLO", "Test")
? "Module Add:", FrbDo(pMod, "ADD", 100, 200)
? ""
// Host Add still works (not overwritten by module)
? "Host Add(1,2) after load:", Add(1, 2)
? ""
// Unload — module symbols removed
FrbUnload(pMod)
? "After unload:"
? "Host Add(1,2):", Add(1, 2)
? ""
? "=== Done ==="
RETURN NIL
// Host's Add function — returns sum * 10 (different from module's Add)
FUNCTION Add(a, b)
RETURN (a + b) * 10