Hi guys.
I wrote a language with help of Jules in many things.
It is really fully designed by me and required me months in designing.
Rescript is also mature and much powerful than ZScript.
But just want some suggestions from you guys.
Also ZScript is currently open that means you can propose for a language feature
Just curious, what are your goals and plans with ZScript?
Actually ZScript is quite powerful giving comptime execution and variables.
Powerful macros.
I want to make ZScript next cross runtime allowing from one codebase writing libs for bun and deno both using comptime like this:
comptime {
if (ZScript.runtime == "Deno") {
ZScript.emit("let runtime = "deno");")
}
}
Something like this in fact currently ZScript like this support for os,arch,cpu specific code using bun.
Some examples of comptime power:
The fetch in this one is amazing: zscript/examples/advanced/comptime_power.zs at main · zscriptlang/zscript · GitHub
zscript/examples/advanced/comptime_multiline.zs at main · zscriptlang/zscript · GitHub
Is it fully typed without annotations like ReScript?
I could not get the arm64 macos binary to run btw. Not sure if it’s a security issue or if the binary is indeed corrupted.
There is a lot to love here
comptime– Execute arbitrary async logic during compilation. Inline API data or Platform-Specific code or pre-calculate complex math before the code even reaches the user.
We want something like this and we have some ideas about it, especially @jfrolich
macro– Native compile-time code generators. Splice logic directly into your source at call sites with!syntax.
ReScript will use a different approach here. https://github.com/rescript-lang/rescript/blob/dabd22381b389c95c9e6fd6e4029d95ad3b98c1c/docs/EmbedLang.md
defer/queue– Reliable scope-exit cleanup (LIFO/FIFO), similar to Go and Zig.
Does it compile to using by any chance?
- Pipe Operator (
|>) – Clean, functional chaining for readable data processing.
This should be default in all modern languages and I find it weird that it’s not the case. Is this piping the first argument like ReScript or the last, like most other functional languages?
matchExpressions – A powerful, expression-based version ofswitchthat returns values directly.
So it’s not mainly expression-based then? One switch/match keyword ought to be enough in practice. Except if you want to be a superset of JS like TS?
- Ergonomic Loops – Built-in
repeat N,forever, andunlessfor cleaner control flow.
Inspiring. Loops are still not as ergonomic in ReScript as in plain JS and I am not sure if being familiar for JS is still a good bet anyways.
- Native Escape Hatch – Use
js { ... }blocks to write raw JavaScript without the compiler interfering.
similar to ReScript’s %raw
is it also sound, or gradually typed?
I would recommend to check trying baseline version once if your os dont support avx2 or modern cpu things bun use so once try baseline version.
Sorry you were saying about arm sorry.
I am really alone developing ZScript and I don’t have os or vps to check the binaries even they are compiled using GitHub actions so I will make a testing action soon.
I am in need of some devs whom I can add as contributors to repo so they can help
So I will reply one by one to your message:
1)Macro: I read the doc you showed of rescript it is good design.
My macro are somewhat different like they are function like and even they can be exported from libs also biggest thing they are basically exported comptime + args.
which means you can do anything in macro which you can in comptime also macro in ZScript can recive infinite args from user github.com/zscriptlang/zscript/blob/main/examples/showcase/v2_features.zs is logall and logargs in this
And the feature plan for which I made macro is for .dsx which will be moder alternative to tsx and jsx it will be different from them in tsx jsx tag becomes code but in ZScript tag becomes macro which will make ZScript more powerful and I will explain whole of its structure someday.
2)no defer and queue not use “using” in fact they are placed at end of block in compilied js automatically.
3)pipes into the first argument rescript style:
value |> map(fn) |> filter(pred)
// → filter(map(value, fn), pred)
4)match is fully expression-based in ZScript.
It returns a value, unlike JS switch.
let x = match v {
1 => "one"
2 => "two"
_ => "other"
}
5)These are syntax sugar, not new semantics.
They compile to standard loops.
Making ZScript same as js is not main target.
6)js escape hatch is raw and unsafe.
ZScript is gradually typed, not unsound
Why my post have been flagged I recieved a message saying it is flagged by system
Sorry, spam detection does not like it when you link to too many github links, apparently.