| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [View Raw Code] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
Call code from other language runtimes transparently - use Python's pandas from TypeScript, or TypeScript's fs module from Ruby.
Forthic enables cross-runtime execution where code in one language can seamlessly call modules and functions from another language runtime. This allows you to:
import { Interpreter } from '@forthix/forthic';
import { JsonRpcClient, RemoteModule } from '@forthix/forthic/jsonrpc';
const interp = new Interpreter();
// Connect to Python runtime
const client = new JsonRpcClient('localhost:8765');
const pandas = new RemoteModule('pandas', client, 'python');
await pandas.initialize();
interp.register_module(pandas);
// Now use Python pandas from TypeScript!
await interp.run(`
["pandas"] USE-MODULES
# Create data in TypeScript, process in Python
[
[["name" "Alice"] ["age" 30]] REC
[["name" "Bob"] ["age" 25]] REC
]
DF-FROM-RECORDS # Runs in Python!
`);
const df = interp.stack_pop(); // pandas DataFramePerfect for:
Use cases:
Best for: Node.js ↔ Python ↔ Ruby communication
Advantages:
Requirements:
See: JSON-RPC Guide
Best for: Browser ↔ Rails communication
Advantages:
Requirements:
See: WebSocket Guide
| Feature | JSON-RPC | WebSocket |
|---|---|---|
| Environment | Node.js only | Node.js + Browser |
| Use case | Server ↔ Server | Browser ↔ Server |
| Streaming | Request/response | Server → Client |
| Setup | Easy | Easy |
Decision guide:
Note: A gRPC transport existed through v0.15.0 and was removed in v0.16.0. JSON-RPC is the supported server-to-server transport.
| Runtime | Status | JSON-RPC | WebSocket | Notes |
|---|---|---|---|---|
| TypeScript | ✅ Available | Client + Server | Client + Server | Full support |
| Python | ✅ Available | Client + Server | - | JSON-RPC only |
| Ruby | ✅ Available | Client + Server | Server (ActionCable) | Rails integration |
| Rust | 🚧 In Development | In progress | - | Coming soon |
| Java | 📋 Planned | - | - | Future |
| .NET | 📋 Planned | - | - | Future |
See Configuration Guide for:
Check out working examples:
┌─────────────┐ ┌─────────────┐ │ TypeScript │ │ Python │ │ Runtime │ │ Runtime │ │ │ │ │ │ ┌───────┐ │ JSON-RPC / WebSocket │ ┌───────┐ │ │ │pandas │◄─┼────────────────────────┼──│pandas │ │ │ │remote │ │ │ │module │ │ │ └───────┘ │ │ └───────┘ │ │ │ │ │ │ Interpreter │ │ Interpreter │ └─────────────┘ └─────────────┘
Process:
All Forthic types are automatically serialized across runtimes:
Type conversion is automatic and transparent.
Multi-runtime communication uses versioned protocols:
| Back | FazBrowse Home | New Git URL |