'Could TypeScript replace JavaScript?' (zdnet.com) 140
ZDNet asked the question -- pointing to a RedMonk survey which found TypeScript jumped in popularity from #16 to #12 over the last six months (based on its usage in GitHub projects and in questions on Stack Overflow).
The reason for this rise can be found in the latest survey of 33,000 developers from 156 countries who use npm, a hugely popular Node.js JavaScript package manager that's traditionally used to build website features... As per npm developers, a big surprise in last year's survey was that 46 percent of respondents said they used TypeScript. Today, the proportion of developers who use Microsoft's open-source take on JavaScript has ballooned to 62 percent... "Overall, 36 percent of npm users are writing TypeScript some or most of the time. That a third of the users in the JavaScript community are writing a totally new flavor of JavaScript should make everyone sit up and take notice" [according to npm Inc's report].
In other words, TypeScript should be on the list of languages to understand. As RedMonk noted in March, the growing number of projects helps explain why TypeScript's "trajectory is significant and sustainable" and won't just fade away like many other languages.
The article also argues that Microsoft's hit with TypeScript "comes as its open-source cross-platform code editor Visual Studio Code, or VS Code, finds a sweet spot with developers across the world, rising from being used by 500,000 developers in 2016 to 4.5 million in 2019. "
Meanwhile npm Inc. also points out that Slack's desktop application was written in JavaScript, pointing to this as evidence that JavaScript itself "has broken out of the browser and become a general-purpose programming language, put to all the same uses as other programming languages."
The article also argues that Microsoft's hit with TypeScript "comes as its open-source cross-platform code editor Visual Studio Code, or VS Code, finds a sweet spot with developers across the world, rising from being used by 500,000 developers in 2016 to 4.5 million in 2019. "
Meanwhile npm Inc. also points out that Slack's desktop application was written in JavaScript, pointing to this as evidence that JavaScript itself "has broken out of the browser and become a general-purpose programming language, put to all the same uses as other programming languages."
Yes, if it's fully backward compatible with the (Score:3)
Re:Yes, if it's fully backward compatible with the (Score:5, Insightful)
Meanwhile npm Inc. also points out that Slack's desktop application was written in JavaScript, pointing to this as evidence that JavaScript itself "has broken out of the browser and become a general-purpose programming language, put to all the same uses as other programming languages."
Oh God. Put it back! Put it back!
Re:Yes, if it's fully backward compatible with the (Score:5, Insightful)
I get that Javascript has been the only way to get things done on browsers for a couple of decades now, but what I don't understand is why anyone would want to use it as a general purpose language. It's fucking awful, a bizarre hybrid language that had little or no forethought put into it in its initial implementation. I find coding in Javascript to be roughly the equivalent to peddling uphill endlessly on a bike. It's just a bloody terrible language. If it's got to stay alive, then leave it on the browser..
Re: (Score:1)
What's hybrid about it?
Re: (Score:2)
Prototypal inheritance.
It doesn't have proper class inheritance.
Re: (Score:1)
It has prototypal delegation and doesn't inherit anything. The misguided belief that it is not quite a classic OOP language so therefore doesn't get inheritance right is the root cause of confusion.
Re: (Score:3)
Re: (Score:2)
I don't use C++ either.
Re: Yes, if it's fully backward compatible with th (Score:1)
'class' is not the powerful keyword that js was missing... super is our savior
Re: (Score:2)
Excellent compatibility with C code
You are mostly repeating the same thing that I wrote, C++ is alive primarily because there are tons of C/C++ codebases and many people are used to C/C++.
Compilers with very good optimization capabilities
Full access and control of what gets executed, all the way down to the hardware
Most low level optimizations are done in other levels and stages than the source code parsing and should be similar in languages of similar level. Rust has all of that, if you need full control and you are sure what you are doing, Rust provides unsafe blocks. For the remaining 97% of cases the optimizer will fully eliminate the unneeded overhead.
Re: (Score:2)
Lots of people learn JS so they can do web stuff. If you learn to program by learning *a* language then you tend to hang onto that for dear life.
Re: (Score:2)
I find downhill sells better.
Re: (Score:1)
You have reverse-Stockholm-Syndrome. You don't understand how to use javascript, so you bash it - I hope you know that only makes you look ignorant, and not superior in any way.
Re: (Score:3)
I get that Javascript has been the only way to get things done on browsers for a couple of decades now, but what I don't understand is why anyone would want to use it as a general purpose language.
I don't get why an educated programmer would want to, but I do get why someone who had taken a couple of classes in web design and knew a little Javascript would. It would let them write programs without having to learn a new language.
Re: (Score:1)
If so many people want to do as many things with it, it's because it's not an awful language for many of them.
Re: (Score:1)
I get that Javascript has been the only way to get things done on browsers for a couple of decades now, but what I don't understand is why anyone would want to use it as a general purpose language.
It's the only thing a lot of them know. For some reason, a lot of new programmers are afraid to learn new languages, or afraid that they can't.
Re: Yes, if it's fully backward compatible with th (Score:2)
Re: (Score:1)
You haven't used modern javascript. It looks and feels a lot like python at times, it's easy to understand and work with. Try working with a modern Node framework or React. Languages evolve. People hating on javascript sound like people hating on C++ - out of touch.
Re: (Score:2)
Here's the dirty secret:
It's ECMAScript. VBScript is also ECMAScript.
Now does it become clear?
Re: Yes, if it's fully backward compatible with t (Score:1, Interesting)
I code regularly in go, rust, c and php. Php in 219 is a proper language with high quality tooling.
Re: (Score:2)
Since Slack's desktop app pretty much IS a browser, I think it's really still in the box. Definitely chewing through the walls though.
Re:Yes, if it's fully backward compatible with the (Score:4, Informative)
JavaScript does not have classes.
The only reason the keyword "class" even does anything (before it was just a reserved word that threw an error on usage because JAVASCRIPT DOES NOT HAVE CLASSES) is because of lazy developers who couldn't be bothered to learn the prototypal delegation paradigm it uses and bitched for 20 years about how it didn't follow the classic OOP paradigm and have classes. Because that's the only way to develop and anybody who says otherwise is ignorant of How It Is Done and thus worthless.
To shut these whiners up, "class" is now a syntactic sugar keyword that hides what is actually going on. So they whine about some other aspect because that's all that they can really do: they still can't be bothered to learn how the language works.
Re: (Score:3)
Re: (Score:1)
TypeScript is a superset of JavaScript that enables type checking (hence the name) via annotations, not a different language requiring porting.
Re: (Score:2)
TypeScript is a superset of JavaScript
No, it's not a strict superset of JS, there are cases where JS code isn't valid TypeScript code.
For instance, this won't work as TypeScript:
var obj = {};
obj.a = 5;
Re: (Score:1)
Never said strict. Annoyingly, Microsoft do, but examples like the one you gave where what should just work doesn't, means they still have some work to do.
Re: Yes, if it's fully backward compatible with t (Score:3)
If you find it difficult to understand, you might be one of the low quality programmers.
Re: Yes, if it's fully backward compatible with (Score:2, Informative)
I take it you've seldom had to work in a difficult to maintain code base that's sprawling with feature development that had to happen fast. The language should not make it difficult to reason about.
Unfortunately Javascript, like Ruby, PHP, and C++, is difficult to manage. It's far to easy to metaprogram, mix paradigms, introduce action at a distance, and encourage junior/lazy mistakes.
Examples of languages that were designed to be easy for very large scale engineering are Java, C#, Rust, and modern Typescri
Re: Yes, if it's fully backward compatible with (Score:2)
JavaScript doesn't becoming difficult to understand because it lacks strong typing. It becomes difficult to understand because OOP zealots don't know how to do anything but create bloated object hierarchies.
If you think strict typing is going to help your JavaScript, you're probably better off using Java.
No (Score:2, Insightful)
You can't have typscript without javascript.
You might as well ask...
Could Harley Davidson Morotcycles replace Motorcycles?
That will be $.05. Next Question...
Re: No (Score:1)
You can compile TypeScript directly to wasm.
What would TypeScript replace JavaScript with? (Score:2)
Re: (Score:2)
"Could" and "might" headlines are governed by Betteridge's weaker law.
The answer is "But then again, it might not".
Re: (Score:1)
Re: Not as meaningful as it sounds (Score:2)
The term "ghetto" has nothing to do with size; it has to do with cultural interaction. Ghettos are culturally isolated from the surrounding community. Just because you created an urban sprawl doesn't mean you haven't created a ghetto.
Re: (Score:2)
I program in Node.js all the time .
You need to try getting out more. There's a whole world outside of node.js.
Re: Not as meaningful as it sounds (Score:2)
Can't tell if you're being pedantic or presenting a dad joke...
Oh, the Internet!
Re: (Score:3)
It's useful when you have a large project with lots of developers, because Javascript just can't handle that without strong types. Refactoring becomes nearly impossible.
Re: Not as meaningful as it sounds (Score:2)
Sounds like what happens when PHP developers write a Node.js app.
Strong typing is only necessary if you insist on using the outdated paradigm of OOP. Drop OOP and 80% of the code you write goes away.
Re: (Score:2)
Strong typing is only necessary if you insist on using the outdated paradigm of OOP. Drop OOP and 80% of the code you write goes away.
ROTFL sounds like you wrote really horrible OOP code. By correlation, you likely write bad code in every language.
Strong typing is only necessary if
If you have a large project with lots of developers and you want to refactor. Even a simple variable-name change can take hours in Python (or days with bad code), and always takes more time than in Java.
Re: Not as meaningful as it sounds (Score:2)
If you have a large project, 99% of the time it's because it's poor architecture. Modularize, man. Refactoring isn't an issue when you have well defined modular interfaces.
Re: Not as meaningful as it sounds (Score:2)
Ironically, the original idea behind OOP was a lot closer to the concept of modules and micro-services than what the average developer thinks of as OOP today.
Re: (Score:2)
Refactoring isn't an issue when you have well defined modular interfaces.
You might as well say, "Refactoring isn't an issue when you write good code." How many times have you gotten your coworkers all write good code?
If you have a large project, 99% of the time it's because it's poor architecture.
Oh, you've never had many coworkers.
Re: (Score:2)
Re: Not as meaningful as it sounds (Score:2)
You are aware that refactoring can be done with type hints alone, right? You don't need strong typing to perform project-wide refactoring?
Re: (Score:2)
How many Python projects have you worked with that have type hints everywhere?
Re: (Score:1)
I do fullstack and Typescript is becoming common place. Largely because Angular and React mandate the use of Typescript. Some NodeJS frameworks such Meteor and Loopback have also gone over to Typescript. So I'd suggest getting up to speed on Typescript since you'll likely have to deal with it sooner rather than later
Re: Not as meaningful as it sounds (Score:1)
So, that must be it. I work on back-end stuff. Network tools, micro-services, shit like that. TypeScript hasn't come here, and I don't expect it to.
Re: Not as meaningful as it sounds (Score:2)
You are correct sir. Our front-end engineer specifically chose to move us to React from Angular and one of cited reasons was that Angular 2 was pushing TypeScript as the de facto way of doing things, and he had no interest in moving into the TypeScript ghetto.
Re: (Score:2)
I think the last mainframe DOS installations are virtualized, but still lurking in some dank corner of a datacenter.
Paranoid History? (Score:1)
type safety is important (Score:3, Informative)
Re: (Score:3)
Except he still hasn't learnt the lesson as to why almost no other language (only OCCAM springs to mind) uses whitespace for block/scope delimiting.
Re: (Score:2)
Or if you're going to do that, make the size of an indent a required length. Make anything but 4 spaces (or 3, or a tab or whatever) an error. The laisse faire approach combined with lexical meaning just causes massive problems.
Re: (Score:2)
Or if you're going to do that, make the size of an indent a required length. Make anything but 4 spaces (or 3, or a tab or whatever) an error. The laisse faire approach combined with lexical meaning just causes massive problems.
All I ask for is indent-aware-paste - "I see you copied code from a 4 indent place into a place with 8. Let me shift it right for you."
Re: (Score:2)
Vim. So where's it hiding? Never mind, I'll google it.
Re: (Score:2)
An indent-aware paste or TAB key for selections has been standard for.proper programming editors for a long, long time. What crap are you using?
Well it's not supported in vim directly, but this github explains the way to script it and provides a plugin that does it better. https://github.com/sickill/vim... [github.com]
Re: (Score:2)
As a former Inmos employee, I rather like Occam. I like Python too.
Spooky.
Monolithic software / car analogy (Score:2)
One of the reasons type safety is so important is that we still think of software as big, complex monoliths.
Car manufacturing, over the past hundred years, has taught us that loose coupling is preferable to tight coupling. With loose coupling, I can go buy an after-market starter for my car, and it will work fine. What if "type safety" required me to buy only a Honda starter for my Honda car? Overall, the impact to the quality of cars would suffer, if every part required every other part to have strict comp
Re: (Score:2)
Hi - the example you site requires type safety: your example presumes that there is an interface type, called "Starter" or whatever, and that after market starter implementations conform to the "Starter" interface - i.e., those implementations can be type-checked.
This is in sharp contrast to type unsafe language such as Ruby and Python, in which one would merely find a starter in the after market and have to look inside the starter to see if it was compatible.
Go has type safety. But the duck typing makes it
Re: (Score:2)
What the hell are you babbling about? NUL-terminated C strings need to be measured each time they're used, but C++ std::string has a length field and dynamic sizing, and usually one of single instance storage or small string optimisation. Properly-written C++ will beat Object Pascal.
Electron (Score:3)
"pointing to this as evidence that JavaScript itself has broken out of the browser and become a general-purpose programming language, put to all the same uses as other programming languages" ...so that evidence is basically a browser with no UI that's limited to run just a Slack webapp and is well known for excessive and non-justified RAM and CPU usage?
Re: (Score:2)
Great, yet more technical debt in a way managers d (Score:1)
This will create yet more stupid technical debt that no one will bring to the attention of their managers. Iâ(TM)ve seen this before where âoooh, shiny thing over here!â(TM), doesnâ(TM)t tell their manager about the switch, and when they quit, get fired, change jobs, no one else knows about the crap left behind.
Lame.
JavaScript itself has broken out of the browser (Score:2)
Slack client (Score:3, Insightful)
If literally *anything* about Slack, least of all its shambolic Electron desktop monstrosity, is a harbinger of the future, screw this, I'm out of here and buying some goats.
"finds a sweet spot with developers" (Score:3)
For varying definitions of "developers". Web monkeys rarely deserve that title.
Never! (Score:3)
Next question?
TS is a neat programming language (Score:2)
I like it. Very easy to use, yet purpose built for large projects. Strong typing without the suck. What I find particularly notable is that it is a really good entirely FOSS project by Microsoft, along with a powerful IDE/Editor built in TS: VS Code.
As far as transpired JavaScript complementary languages go, TS is the most mature and IMHO the most interesting. Definitely worth a try.
My 2 cents.
The question is misguided (Score:1)
Typescript is the most widely adopted "transpiled" language. Right now it only runs in "compiled to javascript" form as far as I know. Not bytecode for the Javascript interpreter, Javascript code that has to be run. So even if some higher level syntax is used, Javascript will always be there.
Wake me up when other languages host an interpreter on top of WebAssembly and give me full access to the DOM and other APIs directly
The very fact transpiling is a big thing... (Score:2, Interesting)
... is proof enough that JS sucks. The entire term was barely mentioned in computer science before JS infected the world's computers. People keep trying to work with JS, without *really* working with it, because they all know it stucks deep down.
Why can't the big browsers just implement a pluggable script language API, so that languages other than JS can be used in the browser without transpiling? Offer Python, Perl, Go,... whatever sandboxed plugins with the same minimal, browser-centric variant of their s