frequently asked questions
Here you find the answers to many questions you might have. Is your question not listed here? Feel free to contact me to add your question to the faq.
xoscript™
is a minimalist, cross platform client side scripting language to develop
native apps for desktop and mobile that connect to your backend server.
I created xoscript because I wanted to
build a platform independent, lightweight, all-in-one
scripting language
to build apps for desktop and mobile using
a highly dynamic language that I personally like.
I want it to be like JS and the browser but without
JS and the browser (because I don't like the evolutionary
legacy and overhead).
I want it to be lightweight and simple (implementation)
yet fully
featured through tight integration (from parser to pixel).
So, I don't want to have to use multiple languages to make my
app (i.e. js/css/xml/html/swift/java) and glue everything
together with a framework (otherwise I could have just
used JS/Python bindings for LVGL etc). In a way
I am looking to recreate some of the lost simplicity of
the C64 system where you can control the entire runtime
with just one single language.
I have made it open source to
share it with people having similar taste
(and I am open to collaboration).
Note that xoscript is very different from
mainstream programming languages and might not
appeal to everyone.
- dynamic scoping (see below)
- no type-checking (not really unique)
- functions can only have one exit point,
upon refactoring you can never forget to update other returns
- if a method does not return anything, the receiving
object will be returned so you can send a follow-up message
- if a method does not exist, the message will be ignored and
an instance of the receiving object will be returned, so you
can send a follow-up message
- everything is passed by reference, so you need to make
a copy of an object yourself if you wish to do so
- even True, False and None are references, so True := False
is technically allowed, the outcome is undefined though
- recursion is disabled by default to avoid infinite loops,
to execute a method recursively, send the message recursive first
- empty functions or methods are not allowed and are considered
to be a syntax error
- the grammar rules are very flexible, so you by carefully crafting
your code you can make it look very natural and readable for
non-technical stakeholders
- variables require an init value, declaring variables without
a value is not allowed
- string interpolation is done by replacing a substring with
a replacement string, sending an unknown message to a string
will cause the string represented by the message to be replaced
by the argument
- arguments are interwoven with the method name so you can
never forget the order
- there are no classes, you can extend existing objects though
- you can mimic classes by overriding the new method
- sending an unknown message to a number will attach a unit of
measurement or qualifier to it, this makes it possible to
add uoms on an ad-hoc basis without refactoring
- the opening symbol for a literal string [' differs from the closing
symbol '], this mean you can use the symbol within the string itself
as long as it does not create ambiguity. You also don't have to
escape single quotes or double quotes
- space matters because of binary messages, i.e. '+ 3' sends the
message + with argument 3 while '+3' sends the unary message '+3'
Regarding the use of dynamic scoping:
When I worked with JS, I had trouble wrapping
my head around lexical scoping. This might seem
weird as many people seem to prefer lexical scoping,
but from my perspective it was a very weird way
of working. Maybe I am just wired differently.
I just could not follow the logic. Maybe because
I started coding in machine language on a C64.
I also like the fact that I can inject variables
directly without having to use dependency injector
patterns.
As with all of the listed design decisions,
they reflect my personal taste for a 'scripty'
development experience and
it might not appeal to everyone.
xoscript offers a very 'scripty' development experience,
tailored towards rapid application development,
prototyping and research.
This project is shared openly for those who
resonate with its approach.
The xoscript project has been written in c to ensure maximum portability and compatibility. C provides the low-level access needed to interface cleanly with a wide range of hardware and system libraries. I could have chosen to simply make LVGL/SDL bindings in Python or JS and glue everything together with a framwork, but the point is to avoid as much build tools, glue code, integrations and evolutionary baggage as possible and just deliver a lightweight, yet fully featured package (from parser to pixel) for cross device development of client-side, server connected apps.
At the moment SDL2 is used, because during critical development stages SDL3 was not yet ready yet. Migration to SDL3 will happen at some point though.
Yes, you can use xoscript for commercial apps. xoscript is licensed BSD, so you can include it in both personal and commercial projects and there is no need to open source your own modifications.
I personally use xoscript to build both personal
and commercial apps for desktop and mobile.
However the project is still work-in-progress and
there are some features I still have to implement:
- support for camera, gps, bluetooth etc.
- support for file dialogs
- support for ffi on mobile (ffi on desktop works)
- support for emscripten (so you can run it in the browser)
- there might be bugs
xoscript is a very small community and does not have
a big ecosystem like flutter, react native or
electron.