You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Easy-to-use language similar to JavaScript+Rust with dynamic typing.</p>
175
175
</li>
176
176
<li>
177
-
<p>Tight integration with native Rust <ahref="/rhai/language/functions.html">functions</a> and <ahref="/rhai/rust/custom.html">types</a> including <ahref="/rhai/rust/getters-setters.html">getters/setters</a>,
178
-
<ahref="/rhai/rust/custom.html">methods</a> and <ahref="/rhai/rust/indexers.html">indexers</a>.</p>
177
+
<p>Tight integration with native Rust <ahref="/book/language/functions.html">functions</a> and <ahref="/book/rust/custom.html">types</a> including <ahref="/book/rust/getters-setters.html">getters/setters</a>,
178
+
<ahref="/book/rust/custom.html">methods</a> and <ahref="/book/rust/indexers.html">indexers</a>.</p>
179
179
</li>
180
180
<li>
181
-
<p>Freely pass Rust variables/constants into a script via an external <ahref="/rhai/engine/scope.html"><code>Scope</code></a> – all clonable Rust types are supported seamlessly
181
+
<p>Freely pass Rust variables/constants into a script via an external <ahref="/book/engine/scope.html"><code>Scope</code></a> – all clonable Rust types are supported seamlessly
182
182
without the need to implement any special trait.</p>
183
183
</li>
184
184
<li>
185
-
<p>Easily <ahref="/rhai/engine/call-fn.html">call a script-defined function</a> from Rust.</p>
185
+
<p>Easily <ahref="/book/engine/call-fn.html">call a script-defined function</a> from Rust.</p>
186
186
</li>
187
187
<li>
188
188
<p>Very few additional dependencies – right now only <ahref="https://crates.io/crates/smallvec/"><code>smallvec</code></a> plus crates for procedural macros;
189
-
for <ahref="/rhai/start/features.html"><code>no-std</code></a> and <code>WASM</code> builds, a number of additional dependencies are pulled in to provide for missing functionalities.</p>
189
+
for <ahref="/book/start/features.html"><code>no-std</code></a> and <code>WASM</code> builds, a number of additional dependencies are pulled in to provide for missing functionalities.</p>
190
190
</li>
191
191
<li>
192
-
<p><ahref="/rhai/plugins/index.html">Plugins</a> system powered by procedural macros simplifies custom API development.</p>
192
+
<p><ahref="/book/plugins/index.html">Plugins</a> system powered by procedural macros simplifies custom API development.</p>
<p>Fairly efficient evaluation (1 million iterations in 0.3 sec on a single core, 2.3 GHz Linux VM).</p>
202
202
</li>
203
203
<li>
204
-
<p>Scripts are <ahref="/rhai/engine/optimize/index.html">optimized</a> (useful for template-based machine-generated scripts) for repeated evaluations.</p>
204
+
<p>Scripts are <ahref="/book/engine/optimize/index.html">optimized</a> (useful for template-based machine-generated scripts) for repeated evaluations.</p>
<p>Organize code base with dynamically-loadable <ahref="/rhai/rust/modules/index.html">modules</a>.</p>
216
+
<p>Organize code base with dynamically-loadable <ahref="/book/rust/modules/index.html">modules</a>.</p>
217
217
</li>
218
218
<li>
219
-
<p>Dynamic dispatch via <ahref="/rhai/language/fn-ptr.html">function pointers</a> with additional support for <ahref="/rhai/language/fn-curry.html">currying</a>.</p>
219
+
<p>Dynamic dispatch via <ahref="/book/language/fn-ptr.html">function pointers</a> with additional support for <ahref="/book/language/fn-curry.html">currying</a>.</p>
220
220
</li>
221
221
<li>
222
-
<p><ahref="/rhai/language/fn-closure.html">Closures</a> that can capture shared variables.</p>
222
+
<p><ahref="/book/language/fn-closure.html">Closures</a> that can capture shared variables.</p>
223
223
</li>
224
224
<li>
225
-
<p>Some support for <ahref="/rhai/patterns/oop.html">object-oriented programming (OOP)</a>.</p>
225
+
<p>Some support for <ahref="/book/patterns/oop.html">object-oriented programming (OOP)</a>.</p>
226
226
</li>
227
227
<li>
228
-
<p>Hook into variables access via <ahref="/rhai/engine/var.html">variable resolver</a>.</p>
228
+
<p>Hook into variables access via <ahref="/book/engine/var.html">variable resolver</a>.</p>
<p>Relatively little <code>unsafe</code> code (yes there are some for performance reasons).</p>
235
235
</li>
236
236
<li>
237
-
<p>Sand-boxed – the scripting <ahref="/rhai/engine/hello-world.html"><code>Engine</code></a>, if declared immutable, cannot mutate the containing environment unless
<p>Sand-boxed – the scripting <ahref="/book/engine/hello-world.html"><code>Engine</code></a>, if declared immutable, cannot mutate the containing environment unless
<p>Protected against malicious attacks (such as <ahref="/rhai/safety/max-call-stack.html">stack-overflow</a>, <ahref="/rhai/safety/max-string-size.html">over-sized data</a>,
245
-
and <ahref="/rhai/safety/max-operations.html">runaway scripts</a> etc.) that may come from untrusted third-party user-land scripts.</p>
244
+
<p>Protected against malicious attacks (such as <ahref="/book/safety/max-call-stack.html">stack-overflow</a>, <ahref="/book/safety/max-string-size.html">over-sized data</a>,
245
+
and <ahref="/book/safety/max-operations.html">runaway scripts</a> etc.) that may come from untrusted third-party user-land scripts.</p>
246
246
</li>
247
247
<li>
248
-
<p>Track script evaluation <ahref="/rhai/safety/progress.html">progress</a> and manually terminate a script run.</p>
248
+
<p>Track script evaluation <ahref="/book/safety/progress.html">progress</a> and manually terminate a script run.</p>
<p>Re-entrant scripting <ahref="/rhai/engine/hello-world.html"><code>Engine</code></a> can be made <code>Send + Sync</code> (via the <ahref="/rhai/start/features.html"><code>sync</code></a> feature).</p>
254
+
<p>Re-entrant scripting <ahref="/book/engine/hello-world.html"><code>Engine</code></a> can be made <code>Send + Sync</code> (via the <ahref="/book/start/features.html"><code>sync</code></a> feature).</p>
255
255
</li>
256
256
<li>
257
257
<p>Serialization/deserialization support via <ahref="https://crates.io/crates/serde"><code>serde</code></a>.</p>
258
258
</li>
259
259
<li>
260
-
<p>Support for <ahref="/rhai/start/builds/minimal.html">minimal builds</a> by excluding unneeded language <ahref="/rhai/start/features.html">features</a>.</p>
260
+
<p>Support for <ahref="/book/start/builds/minimal.html">minimal builds</a> by excluding unneeded language <ahref="/book/start/features.html">features</a>.</p>
261
261
</li>
262
262
<li>
263
-
<p>Supports <ahref="targets.html">most build targets</a> including <code>no-std</code> and <ahref="/rhai/start/builds/wasm.html">WASM</a>.</p>
263
+
<p>Supports <ahref="targets.html">most build targets</a> including <code>no-std</code> and <ahref="/book/start/builds/wasm.html">WASM</a>.</p>
264
264
</li>
265
265
<li>
266
-
<p>Surgically <ahref="/rhai/engine/disable.html">disable keywords and operators</a> to restrict the language.</p>
266
+
<p>Surgically <ahref="/book/engine/disable.html">disable keywords and operators</a> to restrict the language.</p>
267
267
</li>
268
268
<li>
269
-
<p>Use as a <ahref="/rhai/engine/dsl.html">DSL</a> by defining <ahref="/rhai/engine/custom-op.html">custom operators</a> and/or extending the language with <ahref="/rhai/engine/custom-syntax.html">custom syntax</a>.</p>
269
+
<p>Use as a <ahref="/book/engine/dsl.html">DSL</a> by defining <ahref="/book/engine/custom-op.html">custom operators</a> and/or extending the language with <ahref="/book/engine/custom-syntax.html">custom syntax</a>.</p>
Copy file name to clipboardExpand all lines: book/about/non-design.html
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -179,27 +179,27 @@ <h1><a class="header" href="#what-rhai-isnt" id="what-rhai-isnt">What Rhai Isn
179
179
</li>
180
180
<li>
181
181
<p><strong>No structures/records/tuples</strong> – define your types in Rust instead; Rhai can seamlessly work with <em>any Rust type</em>.</p>
182
-
<p>There is, however, a built-in <ahref="/rhai/language/object-maps.html">object map</a> type which is adequate for most uses.
183
-
It is possible to simulate <ahref="/rhai/patterns/oop.html">object-oriented programming (OOP)</a> by storing <ahref="/rhai/language/fn-ptr.html">function pointers</a>
184
-
or <ahref="/rhai/language/fn-closure.html">closures</a> in <ahref="/rhai/language/object-maps.html">object map</a> properties, turning them into <em>methods</em>.</p>
182
+
<p>There is, however, a built-in <ahref="/book/language/object-maps.html">object map</a> type which is adequate for most uses.
183
+
It is possible to simulate <ahref="/book/patterns/oop.html">object-oriented programming (OOP)</a> by storing <ahref="/book/language/fn-ptr.html">function pointers</a>
184
+
or <ahref="/book/language/fn-closure.html">closures</a> in <ahref="/book/language/object-maps.html">object map</a> properties, turning them into <em>methods</em>.</p>
185
185
</li>
186
186
<li>
187
187
<p><strong>No first-class functions</strong> – Code your functions in Rust instead, and register them with Rhai.</p>
188
-
<p>There is, however, support for simple <ahref="/rhai/language/fn-ptr.html">function pointers</a> to allow runtime dispatch by function name.</p>
188
+
<p>There is, however, support for simple <ahref="/book/language/fn-ptr.html">function pointers</a> to allow runtime dispatch by function name.</p>
189
189
</li>
190
190
<li>
191
191
<p><strong>No garbage collection</strong> – this should be expected, so...</p>
192
192
</li>
193
193
<li>
194
-
<p><strong>No first-class closures</strong> – do your closure magic in Rust instead: <ahref="/rhai/engine/call-fn.html">turn a Rhai scripted function into a Rust closure</a>.</p>
195
-
<p>There is, however, support for simulated <ahref="/rhai/language/fn-closure.html">closures</a> via <ahref="/rhai/language/fn-curry.html">currying</a> a <ahref="/rhai/language/fn-ptr.html">function pointer</a> with
194
+
<p><strong>No first-class closures</strong> – do your closure magic in Rust instead: <ahref="/book/engine/call-fn.html">turn a Rhai scripted function into a Rust closure</a>.</p>
195
+
<p>There is, however, support for simulated <ahref="/book/language/fn-closure.html">closures</a> via <ahref="/book/language/fn-curry.html">currying</a> a <ahref="/book/language/fn-ptr.html">function pointer</a> with
196
196
captured shared variables.</p>
197
197
</li>
198
198
<li>
199
199
<p><strong>No byte-codes/JIT</strong> – Rhai has an optimized AST-walking interpreter which is fast enough for most casual
200
200
usage scenarios. Essential AST data structures are packed and kept together to maximize cache friendliness.</p>
201
201
<p>Functions are dispatched based on pre-calculated hashes and accessing variables are mostly through pre-calculated
202
-
offsets to the variables file (a <ahref="/rhai/engine/scope.html"><code>Scope</code></a>), so it is seldom necessary to look something up by text name.</p>
202
+
offsets to the variables file (a <ahref="/book/engine/scope.html"><code>Scope</code></a>), so it is seldom necessary to look something up by text name.</p>
203
203
<p>In addition, Rhai’s design deliberately avoids maintaining a <em>scope chain</em> so function scopes do not
204
204
pay any speed penalty. This particular design also allows variables data to be kept together in a contiguous
205
205
block, avoiding allocations and fragmentation while being cache-friendly. In a typical script evaluation run,
@@ -211,8 +211,8 @@ <h1><a class="header" href="#what-rhai-isnt" id="what-rhai-isnt">What Rhai Isn
211
211
<p><strong>No formal language grammar</strong> – Rhai uses a hand-coded lexer, a hand-coded top-down recursive-descent parser
212
212
for statements, and a hand-coded Pratt parser for expressions.</p>
213
213
<p>This lack of formalism allows the <em>tokenizer</em> and <em>parser</em> themselves to be exposed as services in order
214
-
to support <ahref="/rhai/engine/disable.html">disabling keywords/operators</a>, adding <ahref="/rhai/engine/custom-op.html">custom operators</a>,
215
-
and defining <ahref="/rhai/engine/custom-syntax.html">custom syntax</a>.</p>
214
+
to support <ahref="/book/engine/disable.html">disabling keywords/operators</a>, adding <ahref="/book/engine/custom-op.html">custom operators</a>,
215
+
and defining <ahref="/book/engine/custom-syntax.html">custom syntax</a>.</p>
216
216
</li>
217
217
</ul>
218
218
<h2><aclass="header" href="#do-not-write-the-next-4d-vr-game-in-rhai" id="do-not-write-the-next-4d-vr-game-in-rhai">Do Not Write The Next 4D VR Game in Rhai</a></h2>
<tr><tdalign="center"><code>as</code></td><td>alias for variable export</td><tdalign="center"><ahref="/rhai/start/features.html"><code>no_module</code></a></td><tdalign="center">no</td><tdalign="center"></td></tr>
194
-
<tr><tdalign="center"><code>private</code></td><td>mark function private</td><tdalign="center"><ahref="/rhai/start/features.html"><code>no_function</code></a></td><tdalign="center">no</td><tdalign="center"></td></tr>
<tr><tdalign="center"><code>Fn</code> (capital <code>F</code>)</td><td>create a <ahref="/rhai/language/fn-ptr.html">function pointer</a></td><tdalign="center"></td><tdalign="center">yes</td><tdalign="center">yes</td></tr>
197
-
<tr><tdalign="center"><code>call</code></td><td>call a <ahref="/rhai/language/fn-ptr.html">function pointer</a></td><tdalign="center"></td><tdalign="center">yes</td><tdalign="center">no</td></tr>
198
-
<tr><tdalign="center"><code>curry</code></td><td>curry a <ahref="/rhai/language/fn-ptr.html">function pointer</a></td><tdalign="center"></td><tdalign="center">yes</td><tdalign="center">no</td></tr>
199
-
<tr><tdalign="center"><code>this</code></td><td>reference to base object for method call</td><tdalign="center"><ahref="/rhai/start/features.html"><code>no_function</code></a></td><tdalign="center">no</td><tdalign="center"></td></tr>
<tr><tdalign="center"><code>as</code></td><td>alias for variable export</td><tdalign="center"><ahref="/book/start/features.html"><code>no_module</code></a></td><tdalign="center">no</td><tdalign="center"></td></tr>
194
+
<tr><tdalign="center"><code>private</code></td><td>mark function private</td><tdalign="center"><ahref="/book/start/features.html"><code>no_function</code></a></td><tdalign="center">no</td><tdalign="center"></td></tr>
<tr><tdalign="center"><code>Fn</code> (capital <code>F</code>)</td><td>create a <ahref="/book/language/fn-ptr.html">function pointer</a></td><tdalign="center"></td><tdalign="center">yes</td><tdalign="center">yes</td></tr>
197
+
<tr><tdalign="center"><code>call</code></td><td>call a <ahref="/book/language/fn-ptr.html">function pointer</a></td><tdalign="center"></td><tdalign="center">yes</td><tdalign="center">no</td></tr>
198
+
<tr><tdalign="center"><code>curry</code></td><td>curry a <ahref="/book/language/fn-ptr.html">function pointer</a></td><tdalign="center"></td><tdalign="center">yes</td><tdalign="center">no</td></tr>
199
+
<tr><tdalign="center"><code>this</code></td><td>reference to base object for method call</td><tdalign="center"><ahref="/book/start/features.html"><code>no_function</code></a></td><tdalign="center">no</td><tdalign="center"></td></tr>
200
200
<tr><tdalign="center"><code>type_of</code></td><td>get type name of value</td><tdalign="center"></td><tdalign="center">yes</td><tdalign="center">yes</td></tr>
<tr><tdalign="center"><code>debug</code></td><td>print value in debug format</td><tdalign="center"></td><tdalign="center">yes</td><tdalign="center">yes</td></tr>
0 commit comments