Live data from Hacker News

Civet: A Superset of TypeScript

civet.dev

101–110 of 237 posts

Re: Civet: A Superset of TypeScript

#101
post #33
post #8

Really redminds me of coffeescript, lots of special syntax that doesn't really help readability? I have a hard time understanding the motivation of this project other than syntactic sugar-maxxing JS/TS.

Languages like this don't make sense anymore. You can just pick a mature, feature-rich language you like (Rust, Kotlin, Python, probably many more) and transpile to JS.

That approach only makes any sense if you have broadly compatible semantics; otherwise execution will pay a heavy penalty (CPU usage, memory usage, bundle size). And let me tell you, your “Rust, Kotlin, Python, probably many more” don’t transpile to JS well. If you genuinely mean transpiling as distinct from compiling, I think you could even reasonably say that it’s simply not possible for many languages due to fundamental and incompatible differences. I’d count Rust as that due to things like resolution and aliasing.

If you’re interested in targeting JavaScript, languages like this are your only reasonable alternative to JavaScript itself. (If you’re interested in targeting the web more generally, WebAssembly is a better target.)

Re: Civet: A Superset of TypeScript

#102
post #98
post #33

Earlier quoted context omitted.

Languages like this don't make sense anymore. You can just pick a mature, feature-rich language you like (Rust, Kotlin, Python, probably many more) and transpile to JS.

All those mature feature-rich languages started as "languages like this make no sense"

That’s certainly not true of Rust: Rust had a particular goal, easily recognised as worthwhile, which wasn’t possible with any existing languages. Everyone sensible agreed the language made a lot of sense, even if they weren’t sold on the practicality of its specific approach.

Re: Civet: A Superset of TypeScript

#103
I tried to build the braceless syntax some years back (after I worked on CoffeeScript and it mostly died):

https://xixixao.github.io/lenientjs/

But this was before Prettier.

The real challenge in languages now is flawless LSP implementation, auto-formatter and AI completion. It’s possible for CoffeeScript like syntax, but just the existence of an auto-formatter mostly removes the need for dropping all the syntax.

I’d maybe take dropping of parens from if, to align with Rust, but even some of Rust’s syntax makes the language hard to read (if let bindings for example, which switch the flow from right to left), so I don’t consider it a golden standard to strive for anymore.

The other thing I would take is custom operators, not for any production code, but for building games and simulations, to simplify vector math.

I’ll check out the Civet IDE experience, but I suspect it’ll have large cons compared with TS.

Re: Civet: A Superset of TypeScript

#104

Some of these seem good to me: - "everything is an expression" is a nicer solution for conditional assignments and returns than massive ternary expressions - the pipe operator feels familiar from Elixir and is somewhat similar to Clojure's threading macros. - being able to use the spread operator in the middle of an array? Sure, I guess. I want to like the pattern matching proposal, but the syntax looks slightly too…

I'll pass on the pipe operator, but it's not particularly objectionable.

Agree there's some good ideas. Pattern matching looks like a great idea with the wrong syntax - let's just get a match statement similar to the switch statement - if we can't reuse switch.

String dedent and chained comparisons look nice. Though I think the latter is a breaking change if it were done in js. I'd also be fine with default const for loop variables.

"Export convenience" is going to confuse people. The syntax looks different than named exports and looks closer to the export form of default imports which is begging for trouble.

Re: Civet: A Superset of TypeScript

#105

I tried to build the braceless syntax some years back (after I worked on CoffeeScript and it mostly died): https://xixixao.github.io/lenientjs/ But this was before Prettier. The real challenge in languages now is flawless LSP implementation, auto-formatter and AI completion. It’s possible for CoffeeScript like syntax, but just the existence of an auto-formatter mostly removes the need for dropping all the syntax. I’d…

The other thing that was hard to do with Lenient was to pass the thousands of tests in Babel to ensure the syntax handles every edge case.

Re: Civet: A Superset of TypeScript

#107

I know this hasn't been updated, and I know it's a fork of CoffeeScript, but https://livescript.net/ has had a lot of the "magic" syntax here for quite a while.

Yes, Civet has taken a lot of syntactic inspiration from LiveScript. At this point, I think we have most of the good features, but we might be missing some. Let us know what you think! The big difference, of course, is that Civet fully supports TypeScript, and is up-to-date with the latest JavaScript and TypeScript features.

Nice!

I loved LiveScript, but it got kinda lost in the wake of ES6.

They planned to add types, but never got around doing it (at least the last time I looked).

Re: Civet: A Superset of TypeScript

#108

Its not about how concise or short your code looks, its how about much time the new intern coming tomorrow needs to understand those 1000 line files. I find the syntax very hard to remember and confusing

And in times of Copilot & others writing become less and less a problem, as code completion works very well.

Like this example: https://civet.dev/#everything-is-an-expression `items = for item of items`, in js you type `for`and copilot wrote nearly the full correct for-code. So you have to type not much and can read it easy.

Re: Civet: A Superset of TypeScript

#109

Its not about how concise or short your code looks, its how about much time the new intern coming tomorrow needs to understand those 1000 line files. I find the syntax very hard to remember and confusing

Some people don't code for the interns but to have fun. But I agree this isn't a very enterprise programming language, à la Java or Golang.

Re: Civet: A Superset of TypeScript

#110
post #92

Its not about how concise or short your code looks, its how about much time the new intern coming tomorrow needs to understand those 1000 line files. I find the syntax very hard to remember and confusing

Pretty much what I feel about Rust

Explain more?
Post reply on HN