| ▲ | pcthrowaway 3 hours ago | |||||||
I was prepared to appreciate this as a curiosity and move on. Instead I'm nearly sold on it, to the point I might see myself using it. Some questions first, which would inform whether I could practically use this: - Does it have LSP integration? - Can a linter/formatter catch typescript/javascript which isn't valid Civet (needs minor changes to conform to the additional restrictions). Perhaps even an auto-formatter? - I see semicolons are optional but not used in examples.. are there ASI pitfalls as with Javascript? - Is this built from a fork of the Typescript compiler? Or is it compiling Civet -> Typescript -> Javascript (with the ts compiler involved in the second step)? - Whitespace appears significant in Civet... are the rules of whitespace significance documented in one place anywhere? - How does it play with existing ecosystem. I'm immediately wondering about runtime schema validation libs like Zod And for me, the most compelling feature is the potential with switch. Any plans to support switch nesting and algebraic data types a la rust? This would be a killer feature IMO. I guess in the example, there is no type for `x` shown in the demonstration; Is `x` here presumed un-typed? If `x` was typed, would the switch present a compiler error if trying to match a subset of `x` disallowed by its typedef? edit: Another question: what's the rationale behind disallowing whitespace between unary operands? IMO whitespace is useful for readability here. | ||||||||
| ▲ | Yahivin 2 hours ago | parent [-] | |||||||
- Yes there's decent LSP integration - There are some in the community working on linters/formatters but it's an ongoing - We've removed all the ASI pitfalls in the code emit stage - Whitespace is significant, we try to keep it consistent and intuitive but there are probably some subtleties and edge cases. The interactive docs on https://civet.dev are fairly exhaustive. - Compiles directly into cjs/esm via esbuild and other build plugins so has 100% integration with existing JS/TS ecosystem There might be some existing issues about extending switch with more advanced pattern matching / data types. Currently the compiler itself is not very type aware to allow it to run each file independently. A fully type aware compiler opens up lots of opportunities with switch/overloading/etc. but can have challenges depending on what we need to know at compile time. Rationale for disallowing whitespace between unary operands is to keep `a + -b` and friends more consistent. We may be able to add it in if you have some compelling examples. Thanks for the feedback and hope you can give it a shot! If you use LLMs they are surprisingly good at writing Civet considering the paucity of Civet data in the training corpus. | ||||||||
| ||||||||