Live data from Hacker News

Civet: A Superset of TypeScript

civet.dev

171–180 of 237 posts

Re: Civet: A Superset of TypeScript

#171

Earlier quoted context omitted.

Coffeescript had some great features: classes, array comprehensions, default parameter values, arrow functions, optional chaining. Many of these eventually made it to ecmascript. And then it ruined us with implicit returns, optional parentheses and brackets, and the isnt vs is not fiasco. I worked a lot with Python and coffeescript at the same time back in the day. In Python you mess up your whitespace and 95% of the…

In case you wondered how Civet compared to CoffeeScript in these regards: * `is not` is the textual equivalent of `!==`. You can use `isnt` if you turn on the feature explicitly (or even the weird CoffeeScript `is not` behavior if you want it, mainly for legacy code) * Implicit returns are turned on by default. They are really useful, most of the time, and don't get in the way much if you use `void` return annotation…

> but you're free to use explicit parentheses and braces as you like

I’ve been eying Civet and I quite like it so far, but I dislike having this option because it means I’ll have to see it in other peoples code. I prefer strict rules for readability.

Regardless, I like pretty much everything else.

Re: Civet: A Superset of TypeScript

#172

Earlier quoted context omitted.

> CoffeeScript made writing and reading things much easier My point is that it kinda didn't. It looked prettier on the surface, but didn't actually solve any of the deeper problems of writing JavaScript. To write CoffeeScript you had to still know JavaScript and all its oddities. TypeScript solved those problems, and that's why it has taken off and had a meteoric rise to the point that it's practically synonymous wit…

Coffeescript had some great features: classes, array comprehensions, default parameter values, arrow functions, optional chaining. Many of these eventually made it to ecmascript. And then it ruined us with implicit returns, optional parentheses and brackets, and the isnt vs is not fiasco. I worked a lot with Python and coffeescript at the same time back in the day. In Python you mess up your whitespace and 95% of the…

> And then it ruined us with implicit returns

What was so ruinous about implicit returns? That's one of the things I missed most when leaving CoffeeScript. ECMAScript only partially adopted it (single statement fat arrow functions) which probably muddies the waters for people trying to learn and understand the language's behavior.

Since it's optional for the caller to use or assign the return value of a function, I don't see much problem with functions defaulting to returning something. Maybe it just fits with my personal preference of functions returning a value and not having side-effects..

Re: Civet: A Superset of TypeScript

#174
post #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.

I think it’s time to reveal the shocking ancient knowledge people weren’t ready to deal with before: textmate snippets.

  foro
    for ($1 of $2) {
      $0
    }

  touc
    toUpperCase()

  le
    length

  map
    map(x => $0)
And so on.

Seriously, typing code is some '90s activity since forever. Using copilot for this is akin to hitting a nail with a microscope.

Re: Civet: A Superset of TypeScript

#175

Earlier quoted context omitted.

Coffeescript had some great features: classes, array comprehensions, default parameter values, arrow functions, optional chaining. Many of these eventually made it to ecmascript. And then it ruined us with implicit returns, optional parentheses and brackets, and the isnt vs is not fiasco. I worked a lot with Python and coffeescript at the same time back in the day. In Python you mess up your whitespace and 95% of the…

> And then it ruined us with implicit returns What was so ruinous about implicit returns? That's one of the things I missed most when leaving CoffeeScript. ECMAScript only partially adopted it (single statement fat arrow functions) which probably muddies the waters for people trying to learn and understand the language's behavior. Since it's optional for the caller to use or assign the return value of a function, I d…

probably gets better with use but having to remember not to put a loop as the last statement of a function, because it would make it return an array of the last statement of the loop body, caught me off guard enough times to get annoying.

easy enough to add an extra line with just 'undefined' as the last statement of the function of course. but then you do need to remember that.

Re: Civet: A Superset of TypeScript

#176

Earlier quoted context omitted.

JSX has a spec. This thing they're doing... I don't know what it is, but it ain't JSX.

The JSX spec hasn't changed for almost 10 years, and I'd guess there will never be a JSX 2.0. On the other hand, ideas for a better JSX are plentiful (check out the issues on the JSX repo, for example). If the spec never changes, how can we improve the JSX experience? Transpilation! Civet's futuristic JSX compiles to actual spec-compliant JSX, to it's compatible with all forms of JSX, including React, Solid, etc. We'…

Not so sure. JSX is already a transpilation language. Why target a language that's only supported as an input language for other compilers? I don't think this is an LLVM-type scenario.

Re: Civet: A Superset of TypeScript

#177

Earlier quoted context omitted.

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.

I think another way to express the same idea in a less business-like language is: it's nice to be able to come back to your side project after 6 months and be able to quickly make sense of it. > Some people don't code for the interns but to have fun. I don't think the person you were replying to necessarily disagrees with you there. But their post was phrased in such a way that seemed like business was the only focus…

If you write all your code in civet, them you'll have no trouble understanding civet code in 6 months. Besides that, there aren't many random symbols as additions, it's mostly logical extensions of the javascript syntax which are easy to understand if you know javascript.

Re: Civet: A Superset of TypeScript

#178
post #41

What does this do? operator {min, max} := Math value min ceiling max floor Is that a declaration or an invocation?

It's doing a few things at once: First line: * `{min, max} := Math` is a destructuring declaration. It's similar to the destructuring assignment `{min, max} = Math` (i.e., `min = Math.min; max = Math.max`), but also declares min and max as const. * The `operator` prefix means to treat min and max as new infix operators in the rest of the program. Second line: Given that min and max are infix operators, `value min cei…

Don't understand the boner for infix notation, you find an usecase for it like... once every year?

Re: Civet: A Superset of TypeScript

#180
post #174
post #108

Earlier quoted context omitted.

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.

I think it’s time to reveal the shocking ancient knowledge people weren’t ready to deal with before: textmate snippets. foro for ($1 of $2) { $0 } touc toUpperCase() le length map map(x => $0) And so on. Seriously, typing code is some '90s activity since forever. Using copilot for this is akin to hitting a nail with a microscope.

I don’t understand your last part of the comment. What are you saying copilot should be used for?
Post reply on HN