| 1 | #ifndef wren_core_h |
| 2 | #define wren_core_h |
| 3 | |
| 4 | #include "wren_vm.h" |
| 5 | |
| 6 | // This module defines the built-in classes and their primitives methods that |
| 7 | // are implemented directly in C code. Some languages try to implement as much |
| 8 | // of the core module itself in the primary language instead of in the host |
| 9 | // language. |
| 10 | // |
| 11 | // With Wren, we try to do as much of it in C as possible. Primitive methods |
| 12 | // are always faster than code written in Wren, and it minimizes startup time |
| 13 | // since we don't have to parse, compile, and execute Wren code. |
| 14 | // |
| 15 | // There is one limitation, though. Methods written in C cannot call Wren ones. |
| 16 | // They can only be the top of the callstack, and immediately return. This |
| 17 | // makes it difficult to have primitive methods that rely on polymorphic |
| 18 | // behavior. For example, `IO.write` should call `toString` on its argument, |
| 19 | // including user-defined `toString` methods on user-defined classes. |
| 20 | |
| 21 | void wrenInitializeCore(WrenVM* vm); |
| 22 | |
| 23 | #endif |
| 24 | |