What is the difference between this and using TypeScript?
I don't really understand which TypeScript features are not supported. Since functions and string interpolation are included, how is this different from TypeScript itself? Maybe it would be helpful to specify what is not included in TSON.
In other words, is a JS runtime needed to parse TSON?
A lightweight runtime is required but it is bundled as part of the TySON libraries, so that users of TySON don't need any external dependencies (no dependencies on Node or V8). I'll work on documenting the differences w/ full TypeScript, but at a high-level, TySON only supports ES5-ES6 features.
As an example, async/await is not part of TySON.
It'd also be nice to have a comparison with deno, as it share some similarities with tyson's. for example, deno runs scripts sandboxed by default, and require fine-grained permission control:
~/r/e/deno-security ξ° deno run --no-prompt io.ts 2023λ
08μ 11μΌ (κΈ) μ€ν 05μ 59λΆ 50μ΄
hello
error: Uncaught PermissionDenied: Requires read access to "io.ts", run again with the --allow-read flag
const text = await Deno.readTextFile('io.ts')
^
at Object.readTextFile (ext:deno_fs/30_fs.js:749:29)
at file:///home/scarf/repo/etc/deno-security/io.ts:2:25
! ξ° ~/r/e/deno-security ξ° deno run --no-prompt net.ts
error: Uncaught PermissionDenied: Requires net access to "www.example.com", run again with the --allow-net flag
await fetch("https://www.example.com")
^
at opFetch (ext:deno_fetch/26_fetch.js:73:14)
at mainFetch (ext:deno_fetch/26_fetch.js:182:59)
at ext:deno_fetch/26_fetch.js:461:9
at new Promise (<anonymous>)
at fetch (ext:deno_fetch/26_fetch.js:424:18)
at file:///home/scarf/repo/etc/deno-security/net.ts:1:7
! ξ° ~/r/e/deno-security ξ° deno run --no-prompt run.ts
error: Uncaught PermissionDenied: Requires run access to "deno", run again with the --allow-run flag
await new Deno.Command("deno", { args: ["--version"] }).output()
^
at spawnChildInner (ext:runtime/40_process.js:162:17)
at spawn (ext:runtime/40_process.js:348:10)
at Command.output (ext:runtime/40_process.js:421:12)
at file:///home/scarf/repo/etc/deno-security/run.ts:1:57
tho deno is quite heavy (109MiB as of in v1.36.1) due to V8 and tools being built-in, so tyson definitely have advantages here. interested to see how tyson grows!
It'd also be nice to have a comparison with deno, as it share some similarities with tyson's. for example, deno runs scripts sandboxed by default, and require fine-grained permission control:
~/r/e/deno-security ξ° deno run --no-prompt io.ts 2023λ 08μ 11μΌ (κΈ) μ€ν 05μ 59λΆ 50μ΄ hello error: Uncaught PermissionDenied: Requires read access to "io.ts", run again with the --allow-read flag const text = await Deno.readTextFile('io.ts') ^ at Object.readTextFile (ext:deno_fs/30_fs.js:749:29) at file:///home/scarf/repo/etc/deno-security/io.ts:2:25 ! ξ° ~/r/e/deno-security ξ° deno run --no-prompt net.ts error: Uncaught PermissionDenied: Requires net access to "www.example.com", run again with the --allow-net flag await fetch("https://www.example.com") ^ at opFetch (ext:deno_fetch/26_fetch.js:73:14) at mainFetch (ext:deno_fetch/26_fetch.js:182:59) at ext:deno_fetch/26_fetch.js:461:9 at new Promise (<anonymous>) at fetch (ext:deno_fetch/26_fetch.js:424:18) at file:///home/scarf/repo/etc/deno-security/net.ts:1:7 ! ξ° ~/r/e/deno-security ξ° deno run --no-prompt run.ts error: Uncaught PermissionDenied: Requires run access to "deno", run again with the --allow-run flag await new Deno.Command("deno", { args: ["--version"] }).output() ^ at spawnChildInner (ext:runtime/40_process.js:162:17) at spawn (ext:runtime/40_process.js:348:10) at Command.output (ext:runtime/40_process.js:421:12) at file:///home/scarf/repo/etc/deno-security/run.ts:1:57tho deno is quite heavy (109MiB as of in
v1.36.1) due to V8 and tools being built-in, so tyson definitely have advantages here. interested to see how tyson grows!
Yeah, I can write up a comparison with deno, but I think you have similar thought to mine already. Basically, deno is awesome, and I whole-heartedly recommend it for someone developing a typescript application. If you are writing an application instead of configuration, go use deno, not tyson. But as an embedded interpreter that can be used from a host-language, deno is very heavy.
tyson is exclusively focused on configuration, so that might lead to other differences down the road too: say, the tyson "standard library" might include utilities useful for defining and validating schemas (something like https://github.com/colinhacks/zod or https://github.com/sinclairzx81/typebox)