JS can become more powerful?

JS can become more powerful?
0.0 0

#1

Hi guys. I have a question about JS. Is it possible for JS to became the most powerful language in programming world? I mean does JS has limits or it can develop itself to the level of python and C when we will be able to write really big projects like games or soft on JS and their performances will be good? All I want to ask is if JS can evolve or its functionality is limited and it is always will be only for web tasks?


#2

man this question is hard to answer, here’s my attempt below


A programming language is an abstract thing, that lets programmers express functionality.

Implementations of programming languages are the tools we use on a daily basis to create the functionality we’re looking for. As an example the official python interpreter (CPython) is one way to implement python, whereas pypy is another.

The implementation maps language to machine code in some way.

In a sense your question is meaningless - programming languages are themself abstractions, and one can imagine identical output from a function written in JS to one written in C.

As all these languages are turing complete, and their implementations can often interface with other libraries, one can imagine writing anything in them - even if it’s a bad idea, like the pc emulator running the linux kernel written in javascript (which really exists! why…)

I’m guessing your question is more like: “Will I be able to use javascript in the future for everything, reasonably?” and the answer is noone knows! (but probably not things like systems programming, that would be so far removed from the original purpose of animating a monkey on a screen that it’s unbelievable to me)


#3

To build on @gebulmer’s excellent answer: If you’re asking whether learning Javascript is worth it, it is like learning English: It sorta lets you learn other C-type languages (analogous to the Romance family of languages: French, Italian, Spanish…) fairly easily. And the unique quirks of the language used to deal with Web tasks or scripting shorthand will be useful when learning languages geared to those (analogous to the Germanic/Imperial roots of English vocabulary).


#4

It’s a single threaded, garbage-collected, pretty limited scripting language. It is extremely unsafe, it’s terrible for writing large applications in, and large-scale software projects (eg things built using Electron) are notoriously taxing with respect to system resources (opening the Slack app almost immediately causes slowdown on most systems, for example). You can’t really get around those issues, they’re inherent to the language, but you can do most everything you’ve mentioned already if you really want to.

You wouldn’t write AAA games in it, and you’d tend to avoid writing a large application in it because that’s not what it’s for. You may well script games in it or script interfaces for software (this is very common - MongoDB would be a good example). The performance will be worse in cases like graphics, numerical processing, data processing, “AI”, networking, embedded systems, systems that need guarantees of safety (ie anything where people could get hurt), etc., where there are languages and runtime environments that will work better, but that doesn’t matter in a load of cases.

But by “powerful” I think you mean “successful” - Python is not a particularly “powerful” language, but it is very pleasant to programme in and you can drop into C and Fortran for heavy tasks (eg NumPy), and there are lots of really good libraries, so it gets used all over the place. JS is similar to Python, and you can do a load of similar things, and gets used all over the place because it’s accessible everywhere. It has huge limitations though.

Most probable case: an ability to make stuff that can live on the web is important because that makes it accessible. So there is a subset of JS called WebAssembly that is now available in all major browsers. It lets you compile languages like C/C++/Rust to a format that will work in the JavaScript VM, ie in the browser. The stuff can be extremely performant - as an example this is compiled directly from Unity. It has limitations, which are being worked on (eg, you now can enable an experimental form of threading in JS in Firefox for example, and that comes directly out of a need to be able to compile code using threading to JS). Other languages are looking at compiling directly to WebAssembly as well. But what this means is is that the aim, if WebAssembly actually takes off, is to not write code for performant applications in JS at all, avoiding all of its issues, and write in a different language instead.


#5

Thanks for answers :slight_smile: