4 ms·
Deno has replaced shell scripts and Java in a lot of places for me. My reasons: - Types: I simply cannot program without them. Typescript is great. - Single
by sieve 5y ago
Deno has replaced shell scripts and Java in a lot of places for me.
My reasons:
- Types: I simply cannot program without them. Typescript is great.
- Single executable: Write programs that run the same on Linux/Windows without forcing the user to download the entire universe like other runtime environments.
- Built-in bundler: Write front-end code in Typescript and use a single command to bundle all dependencies.
Native JSON support in cli applications is not something you can appreciate if you haven't dealt with the pain surrounding it on the Java side.
- lpcvoid 5y agoThis sounds like something you can get with other languages which compile to native x86_64 or arm or whatever - specially the single executable concept is ages old and predates the entire internet. Why use js, which is slow?
- deleted 5y ago[deleted]
- sieve 5y agoThere is always something that doesn't fit either the use case or the aesthetic sense. > Why use js, For someone working with JS on the front end, the ability to not only use the same language, but also the same libraries/modules/functions is very valuable. > which is slow? Not that slow, once a JS engine takes over.
- innocenat 5y agoThis just don't make sense. People do scripting in sh, bash, python, etc all the time. Why not js?
- specialist 5y agoUsing Java for shell scripts (using a shebang) is on my todo list. IIRC, there's a GraalVM or Truffle or something interpreter that'd work.
- toastal 5y ago> Types There are so many better options if you want a good type system (Elm, PureScript, Rescript, GHCjs, Scala.js, and many more). TypeScript is unsound, and necessarily by it's design, it has to take on weird issues to maintain compatibility with JavaScript (null/undefined, can run effect anywhere, a lot of codebases are filled with any types). Heck, TypeScript doesn't even come with ADTs and proper pattern matching.
- IshKebab 5y agoTypescript definitely has some flaws but it also has some really powerful features that aren't found in any other type systems, like the ones you listed. And in any case I don't think anyone is really saying "Use Deno because it has static type annotations". It's "Use Deno because it has static type annotations and is fast and easy to deploy and has a huge ecosystem and doesn't require a project setup file to use third party libraries and ..."
- sieve 5y ago> There are so many better options if you want a good type system I am looking for basic type checking to prevent me from doing stupid things and catching bugs at "compiletime" instead of runtime. Typescript interfaces with their structural typing do the job just fine. I think people are underestimating the power of ecosystem. I use JS daily. Deno allows me to use it on the server as well without doing crazy things. You have been able to do something similar in Java for a very long time with Mozilla Rhino (and now GraalJs) but without the same level of comfort and convenience.
- iaml 5y ago> TypeScript doesn't even come with ADTs You still can use them [0]. > proper pattern matching [1] is pretty good. [0] https://itnext.io/practical-introduction-to-algebraic-datatypes-adts-in-typescript-1cb6952e4c6d https://itnext.io/practical-introduction-to-algebraic-dataty... [1] https://github.com/gvergnaud/ts-pattern https://github.com/gvergnaud/ts-pattern
- toastal 5y agoThey need to be first-class. Not means the ergonomics aren't great and it won't be the developer default because it requires a library. It's not good enough considering how fundamental these two are in many languages (it's even in Java now)
- clipradiowallet 5y ago> Deno has replaced shell scripts and Java in a lot of places for me. > - Single executable: Write programs that run the same on Linux/Windows without forcing the user to download the entire universe like other runtime environments. OK, I understand your comment wrt Java, but with shellscripts? What universe are you downloading? For that matter - your 3 listed reasons make a very argument for "a normal compiled language". Consider an older/popular one...C++. It's very typed, compiled to a single executable, and "bundling" is "linking"(you can do it any way you like, including staticly linking all your deps). If I understand your comment, are you saying that previously you wrote software 2 ways: shellscripts and Java. You replaced them with...any entirely new interpreted language(JS)? I'm not denigrating JS/deno/node/whatever, I'm pointing out your 3 reasons are built in features to any compiled language in the last 40 years.
- whimsicalism 5y ago> OK, I understand your comment wrt Java, but with shellscripts? What universe are you downloading? Are shell scripts cross-compatible if you haven't installed WSL?
- clipradiowallet 5y agoWSL? Are you asking...is software for one operating system able to run on another operating system without installing a compatibility layer(if it exists)? If so, the answer is "no, of course not".
- whimsicalism 5y ago> - Single executable: Write programs that run the same on Linux/Windows without forcing the user to download the entire universe like other runtime environments. So how is this statement wrong for shell scripts? You can't write a shell script that "runs the same on Linux/Windows without forcing the user to download a runtime" because you can't write a shell script that runs on Linux/Windows.
- sieve 5y ago