FAQ
Frequently asked questions...
Questions
In this section I try to answer frequently asked questions.
If you have a question about the XOScript project, and it is not in the list,
feel free to send me an e-mail!
XOScript aims to be a minimalist scripting language, with excellent backward compatibility. Most programming languages have accrued quite some cruft. Xoscript aims to remain compact, simple and scripty.
The most notable differences are: smalltalk-inspired syntax, dynamic scoping, fault tolerant message passing, prototypical inheritance, always pass by reference, recursion is disabled by default, asymetrical string literal boundaries, string interpolation through replacement, unit of measurement through qualifiers and True/False/None are references.
Dynamic scoping is incredibly simple to reason about, if a variable is not found within the function, XOScript will look if it has been defined in one of the calling functions. That's it. Also with dynamic scoping there is no need for dependency injection patterns.
Sending unknown messages (calling non-existant methods) does not result in errors. This allows you to write more compact code without testing for specific conditions or relying on interfaces or contracts.
Messages are space sensitive, i.e. +2 is different from + 2. This is because messages consisting of a single character are written without a colon : therefore the lexer must know if there is a space after the message.
All crypto except PKI is currently quantum resistant. PKI implementation is Ed25519, which is secure for now but not post-quantum proof. I am planning to include a decent post-quantum signing library but the current implementations are too complex and unauditable, conflicting with the core values of XOScript. We are monitoring the situation closely and add post-quantum signing as soon as a suitable library becomes available. Meanwhile, do not use edkeys in Vault for situations where your secrets can be harvested for decryption later.
Classes add unnecessary syntax. In XOScript you can base an object on another object by sending the new message. If you override the new message you basically create a class anyway.
Many languages mix pass by value and pass by reference. Although most people memorize the basic rules per language, XOScript simply passes everything by reference. You need to make copies explicitly by sending the copy message. So this is easy to remember. There is just one rule. Pass by reference. In addition, this is quite memory efficient.
By using asymmetrical string delimiters, you don't have to escape single quotes or single string delimiters within the string literal itself (as long as it does not create ambiguity for the lexer).
You can enable recursive messaging explicitly by sending the recursive message. By default, recursion is blocked to prevent infinite loops.
Async/threading is basically cooperative multitasking, it is fragile and hard. This work is delegated to the OS scheduler.
XOScript does not do type checking because it's meant to be used on a per-file, per-page basis, as a scripting level with low overhead. Type checking requires some sort of compile step or linting step for the project as a whole and adds significant syntactical overhead (types, casts, generics etc..). Runtime type checks don't catch type bugs before execution and are therefore of limited value. Simplicity, readability are considered more important than type checking.
xoscript functions can only have one exit point. This is a consequence of how the lexer/parser works. However, it also keeps your code easy to sync. Upon changing the return value, you never have to update additional exit points as well.
XOScript messages (like smalltalk) use interwoven arguments, the arguments are part of the message. This allows you to always remember the order of arguments.
No. All object properties, as specified by the own keyword are protected (not private). Only methods that are part of the inheritance tree of the object where they are defined can access them. Other objects cannot access them.
CGI is the primary way to connect a XOScript application because of it's simplified programming model (compared to threading) and because on modern multicore hardware it scales well. CGI also provides process level isolation and gives you a share-nothing architecture for free, allowing the use of advanced sandboxing techniques like pledge() on OpenBSD.
XOScript is free of fully LLM-generated code. All XOScript code has been written by hand without LLM-based code generators, except the following modules: utf16-decoder. utf32-decoder. I did not have the energy to write those myself and I could not find suitable libraries or snippets for these tasks. Even though these modules contain LLM generated code, it has been heavily tuned, refactored and redacted. Note that, pure LLM generated code contributions (if detected) will be rejected automatically. LLMs can be used for research or reviewing purposes.