News for hackers. Stuff that matters.
Re:Typical: Data interchange with algebraic data types by throwaway290 on Monday May 22, 2023 @12:30AM (#36027471)
Really cool! Does it work in browser if I want to compile .t spec using JS/TS?
Re:Typical: Data interchange with algebraic data types by stepchowfun on Monday May 22, 2023 @01:08AM (#36027676)
Yes! We have comprehensive integration tests that run in the browser to ensure the generated code only uses browser-compatible APIs. Also, the generated code never uses reflection or dynamic code evaluation, so it works in Content Security Policy-restricted environments.

See this section of the README for more info: https://github.com/stepchowfun/typical#javascript-and-typesc...

Re:Typical: Data interchange with algebraic data types by throwaway290 on Monday May 22, 2023 @01:38AM (#36027821)
It's nice that generated code works in browser but I was curious whether it's possible to actually generate code from .t syntax all in browser.

By the looks of it typical is only a CLI tool, so I guess not for now. Maybe unless it is ported to WASM...

Re:Typical: Data interchange with algebraic data types by stepchowfun on Monday May 22, 2023 @02:00AM (#36027940)
A wasm port doesn't seem too farfetched. What's the use case for running the code generator in the browser?
Re:Typical: Data interchange with algebraic data types by throwaway290 on Monday May 22, 2023 @02:41AM (#36028200)
Something that could involve giving the end user some control over schema...