Live data from Hacker News

CoffeeScript for TypeScript

civet.dev

71–80 of 143 posts

Re: CoffeeScript for TypeScript

#71

please just use rescript it addresses every problem with js/ts and is simpler and you get a sound type system please.

I took a look at rescript's facillities for migration from JS and at step 1 ( https://rescript-lang.org/docs/manual/latest/converting-from... ), it tells you: > First, copy the entire file content over to a new file called src/Main.res by using our %%raw JS embedding trick: > %%raw(`const school = require('school'); etc. `) I stopped reading there - I'm sorry but that is horrifying. Wrapping JS in in a big backtick s…

That is not how you normally do interop in Rescript.

Re: CoffeeScript for TypeScript

#72
post #26

Way back in the early 2010s I was very "excited" about coffee script and similar projects. They sounded like they should be great for productivity. When I actually tried to write a project in coffee script, the results were the opposite of what I expected. The code was harder to read, harder to modify, harder to understand, harder to reason about. There's something about removing stuff from syntax that makes programm…

As terse as possible for me, I think you underestimate the human brain.

Re: CoffeeScript for TypeScript

#73
I feel like this would be great as another Emmet style tool for the modern day - write code really quickly and have it convert to production grade typescript following all eslint / prettier rules, and use it as a personal speed up tool for writing instead of reading.

Re: CoffeeScript for TypeScript

#74
post #45

Hello! I created Civet ask me anything. Or just curse me for keeping the dream of CoffeeScript alive :P

Hey Yahivin! I love the idea and would love to use it and spread it. I think the best way to jumpstart that is a VS Code extension that allows Civet to be used as an Emmet style tool for the modern developer - write code really quickly and have it convert to production grade typescript following all your eslint / prettier rules, and use it as a personal speed up tool for just writing. When your coworkers start asking how you're moving so fast you tell them about Civet!

Re: CoffeeScript for TypeScript

#75
post #45

Hello! I created Civet ask me anything. Or just curse me for keeping the dream of CoffeeScript alive :P

Hey Yahivin! I love the idea and would love to use it and spread it. I think the best way to jumpstart that is a VS Code extension that allows Civet to be used as an Emmet style tool for the modern developer - write code really quickly and have it convert to production grade typescript following all your eslint / prettier rules, and use it as a personal speed up tool for just writing. When your coworkers start asking…

Thanks! Sounds like a good idea and a nice way to make it easier for people to get started playing around with Civet.

Re: CoffeeScript for TypeScript

#76

Earlier quoted context omitted.

+1 for tofeescript. 'Civet' certainly implies your code is being processed, but I'm not sure the connotation is desirable. And all IMHO of course, but significant-whitespace is the worst idea ever.

> significant-whitespace is the worst idea ever Hear hear! I never heard a single argument for significant invisible characters that makes sense, ever. Who would want to have a program that fails because you used invisible character X instead of invisible character Y?

A distinction between invisible character X and invisible character Y is a terrible idea. But indentation is very much visible; it's generally more significant to the reader than braces are, so it should be that significant to the computer too.

Re: CoffeeScript for TypeScript

#77

If I were going to do this, I’d probably go all the way to using ReScript, but it’s a nice idea. I’m quite surprised it’s not called ToffeeScript though.

+1 for tofeescript. 'Civet' certainly implies your code is being processed, but I'm not sure the connotation is desirable. And all IMHO of course, but significant-whitespace is the worst idea ever.

Wait, what's wrong with making sure indentation and code structure are always the same? Lying indentation structure is always wrong.

Re: CoffeeScript for TypeScript

#78
post #34

Earlier quoted context omitted.

I didn't mind the coffeescript experience, but it's deeply hurtful to productivity to dev in a platform that doesn't end up winning.

Is it? I find most of the "winning" tech deeply unproductive. Have you tried developing in a project with Webpack and Redux? It's kind of its own little hell. Everything is way too slow and complicated. Tasks that should take 20 minutes take 3 hours.

Try again with Vite and useReducer and prepare to have your socks blown off.

Re: CoffeeScript for TypeScript

#79

Under "Everything is an Expression": items = (() => { const results = []; for (const item of items) { if (item.length) { results.push(item.toUpperCase()); } else { results.push(" "); } } return results; })(); Seems like they are purposely making the JS version extra long. It could be: items = items.map(x => x.length > 0 ? x.toUpperCase() : ` `) Edit: Just realised the code on the right is the compiled code, not the "…

Given than in JS an empty string is a falsy value you can go even shorter: items = items.map(x => x.toUpperCase() || ` `)

The original ternary "fixes" the cases where `x` is "wrong" (e.g., is not a string - `x.length` does not fail, but evaluates to false, and thus you still get ``).

This even more terser code will fail if `x.toUpperCase()` fails with an exception (such as when x is not a string).

Post reply on HN