Daslang is a [[BSD-3]] licensed [[Programming Languages|Programming Language]] written in [[C++]] (with [[C]]-like headers).
- [Website](https://daslang.io/)
- [Source](https://github.com/GaijinEntertainment/daScript)
- [Documentation](https://daslang.io/doc/index.html)
> Daslang (former daScript) is a high-level programming language that features strong static typing. It is designed to provide high performance and serves as an embeddable 'scripting' language for C++ applications that require fast and reliable performance, such as games or back end/servers. Additionally, it functions effectively as a standalone programming language.
\- website
Formerly known as `daScript`.
# Notability
Used by [[Dagor Engine]] and [[Gaijin Entertainment]] games.
Has extremely optimistic performance [[#Interpreted, JIT, and AOT|claims]].
# Philosophy
## GenAI Slop
> when u talk to github copilot - it tells stories. who am i to disagree
\- creator's commit message from [[2022-01-29]]
> There is GitHub Copilot. Its good for C++. It works so well with daScript. It writes a lot of code for me
\- creator's blog post[^1] from [[2023-03-20]]
> In the ideal scenario I would like to just copy-paste my unit tests for each type of the pattern matching available, and the documentation magically appears.
>
> Turns out that in 2023 the reality is not that far. I occasionally had to ask ChatGPT to stick to correct daScript syntax and well formed rst format.
\- creators blog post[^2] from [[2023-02-07]]
> Why new syntax?
>
> It’s simple, really. We use AI more and more. And AI likes to write code a certain way.
\- creator's blog post[^6] from [[2025-05-04]]
Since [[2022]] the creator has used many major LLMs to generate code[^5] and documentation for Daslang. This means that any documentation you read was likely generated and not written by anyone. Watch out for both code example and explanation errors!
Starting in [[2025]] the syntax of Daslang was altered to specifically support the kind of code that LLMs generate. There are now at least 3 different syntaxes supported by Daslang as a result of this.
## History
- [[2018]] - Developed by [[Boris Batkin]] upon request from [[Anton Yudintsev]] from [[Gaijin Entertainment]][^4]
# Platform Support
# Features
## Interpreted, JIT, and AOT
Daslang can be pre-compiled or at runtime can run in JIT or interpreted modes.
A language's internal benchmarks are always suspect, but these are wild. If they were true, I'd be surprised that more people haven't been talking about it - but literally nobody is.
This note, if it is public, would be one of the extremely few mentions of it anywhere online.
### Interpreted
Daslang's benchmarks purport that that in interpreted mode, it is generally faster than [[Lua#LuaJIT]]. Big if true. LuaJIT has consistently been at the top of my own benchmarks.
### JIT
Daslang's benchmarks show JIT as competitive with [[C++]] code, take that for what you will.
They're not using any novel techniques, just [[LLVM]] JIT. I haven't seen anyone else claim that [[LLVM]] JIT is faster than raw [[C++]]. Maybe it is, but if so, I feel like it should be a much bigger deal.
### AOT
Oddly, Daslang's own benchmarks show that JIT is almost always faster than AOT compilation.
The AOT system converts the Daslang code into [[C++]] and then compiles that using a standard compiler.
## Memory Management
Daslang uses a "linear heap allocator" by default[^3] but also supports a mark-and-sweep [[Garbage Collector]].
# Syntax
## Indent-Based
```python
# Daslang Python-style
def fibR(n)
if (n < 2)
return n
else
return fibR(n - 1) + fibR(n - 2)
def fibI(n)
var last = 0
var cur = 1
for i in range(0, n-1)
let tmp = cur
cur += last
last = tmp
return cur
```
## Curly-Bracket-Based
```python
# Daslang with curly-braces, note that semi-colons are *REQUIRED* here
def fibR(n) {
if (n < 2) {
return n;
} else {
return fibR(n - 1) + fibR(n - 2);
}
}
def fibI(n) {
var last = 0;
var cur = 1;
for i in range(0, n-1); {
let tmp = cur;
cur += last;
last = tmp;
}
return cur;
}
```
# Tips
# References
[^1]: https://borisbat.github.io/dascf-blog/2023/03/20/a-matter-of-multipliction/
[^2]: https://borisbat.github.io/dascf-blog/2023/02/07/pattern-matching/
[^3]: https://borisbat.github.io/dascf-blog/2024/04/16/gc-in-the-wild/
[^4]: https://80.lv/articles/a-look-at-the-current-state-of-independent-gamedev-software-production
[^5]: https://github.com/GaijinEntertainment/daScript/commit/073bc29145207b39180069ae60f00ed43fad6ea7
[^6]: https://borisbat.github.io/dascf-blog/2025/05/04/gen2-syntax/