-
Notifications
You must be signed in to change notification settings - Fork 104
Home
daScript is high-performance strong statically typed scripting language, with
- no garbage collection,
- "pure" stateless (it's state survives only one script run)
- "native" machine types (no nan-tagging or anything)
- explicit structs
- cheap "inter-op"
In a real world scenario, it's 10+ times faster than lua-jit without JIT (and even faster than liajit with JIT). It also allows Ahead-of-Time compilation, which is not only possible on all platforms (unlike JIT), but also always faster/not-slower (JIT is known to sometimes slow down scripts).
https://docs.google.com/spreadsheets/d/1y1G4exD4J9o3kPYw6Y-eaVoffbJ5h_mWVG121wp2k9s/htmlview
It's philsophy is build around modified Zen of Python.
- Performance counts.
- But not at the cost of safety.
- Readability counts.
- Explicit is better than implicit.
- Simple is better than complex.
- Complex is better than complicated.
- Flat is better than nested.
Typical Fibonacci sample:
def fibR(n) if (n < 2) return n
else
return fibR(n - 1) + fibR(n - 2)
def fibI(n)
let last = 0
let cur = 1
for i in range(0, n-1)
let tmp = cur
cur += last
last = tmp
return cur
More complicated particles kinematics:
struct NObject position, velocity : float3
def updateParticles(objects:array) for obj in objects obj.position += obj.velocity
def initParticles(objects:array) resize(objects, 50000) let index = 0 for obj in objects let oi = float(index++) let ii = oi*2.0 obj.position=float3(oi+0.1,oi+0.2,oi+0.3) obj.velocity=float3(1.0,2.0,3.0) assert(index==length(objects))
def test() let objects:array initParticles(objects) updateParticles(objects,100)
It's (not)full list of features includes:
- strong typing
- Ruby-like blocks
- tables
- arrays
- string-builder
- native (c++ friendly) interop
- generics
- ECS-friendly interop
- etc, etc
options keyword