Performance and Intellectual Property

I have been designing web sites since 1993, back in the days of NCSA Mosaic, and so long before Mr. Eich donated his language to the community. I am frustrated that after three decades there does not seem to be an alternative to JavaScript which addresses my primary issues: performance and protection of intellectual property. Back in the 90s I could write code in Java to be executed in a browser, but this capability was eliminated, so I now feel intensely frustrated that I am limited by the capabilities of JavaScript, even if I would like to use a more secure, higher performance, language. I greatly appreciate the improvements introduced since ES2015, but the basic language remains IMHO severely deficient. Why has there been no significant improvement in over 25 years?

I fail to see what JavaScript has to do with intellectual property. When you write code, you own the copyright on it, and may be able to file patents for your inventions, no matter what language you are using.

You might be looking for web assembly though, which is bytecode running in the browser, just like your 90s Java Applet (but without the security problems).

That’s clearly subjective; most of us feel there has been.

As for performance, not only is JS incredibly fast, but WASM exists if you need more perf than JS offers.

For “protection of intellectual property”, i believe that a license is the most effective means of doing this with any program that executed on someone else’s machine - what do you suggest a language could do about this?

1 Like

I wish to remind the community as they read my messages that I am a very senior developer. I wrote my very first computer program in 1966! I taught computer programming in 1967 because I knew more about it than the paid teachers. So when I complain about features of a language which you love, it is because I have been using it for almost three decades, and have three more DECADES of experience in software development before that. I am sick and tired of the limitations of JavaScript. I want a better programming language for writing the dynamic code of my websites. I want an explanation for why I am forced to use what I consider a temporary solution introduced by a well-intentioned employee of Netscape 28 years ago. By the time Netscape came along I had already been using the NCSA Mosaic browser for over a year. I had even written server scripts in C to run to the Common Gateway Interface (CGI) on the NCSA httpd server in 1994.

I am pleased with the enhancements in recent versions of JavaScript although I find it laborious to make the necessary changes to be compatible with eslint or TypeScript. However as someone who believes that interpreted languages have no legitimate role in a Web Server, Node.js makes absolutely no sense to me and I resent being asked to install a copy just so I can run eslint. I understand that eslint is itself written in JS and therefore demands a run-time environment, but I still do not believe that this has been justified to those programmers who will NEVER run node.js as part of a web server. And, of course, I have the option of exploiting TypeScript to perform additional validation checks on my code. But TypeScript "transpiles" to the unavoidably inefficient JavaScript source code.

With regard to intellectual property JavaScript is the only procedural programming language I know of which demands that the source code be delivered to the end user, who then is required to compile that code to use it. How can anyone protect their proprietary algorithms and data structures from being copied by competitors if they are required by the browsers to hand them a copy of my source code? I understand why declarative languages like HTML and CSS must be delivered to the browser. I do not understand why procedural logic must also be delivered to the browser in a human readable, even if obfuscated, format. No competitor is going to copy my source code literally, because then they can be traced by preserved comments and variable names. I have been a witness in software copyright cases, so I know whereof I speak.

My concern for performance is primarily that because Javascript does not provide the option to inform the language compiler of the data type of variables, although with ES2015 I am now advised to "declare" them so that I can be warned if I have not "declared" them even though this "declaration" is empty! The Javascript compiler therefore cannot exploit knowledge of data types to emit more efficient code to the VM like C or Pascal or Java can.

When I go to I want to… - WebAssembly I am instructed to use JavaScript to load the compiled program into the browser. I did not have to do that before the browser suppliers dropped support for Java. I appreciate that Microsoft went to great lengths to exterminate Java in favour of its own C#, but I do not program for the Microsoft environment, and I do not understand why all of the browser suppliers cooperated with this assassination!

Why is there no universally supported compiled procedural language for implementing the logic of web pages? For example why can I not write all of the logic of a web page in C or Pascal or Java. As the documentation clearly states "WebAssembly is a different language from JavaScript, but it is not intended as a replacement. Instead, it is designed to complement and work alongside JavaScript" It seems to me that WebAssembly is just another VM for running intermediate code from interpreted languages like JavaScript and Ruby which provide poor performance and a lack of programmer support tools. Waiting until the code is already loaded into the browser to run it through the JavaScript debugger is an inefficient programming methodology. It reminds me of NASA which waited until its Space Shuttles were already in orbit before checking to see whether the heat shield was still intact! I wonder how NASA broke it to the crew of Columbia that they were ALREADY DEAD and should call their loved ones to say goodbye!

I am posting in this forum because I want the companies which have paid their staff to work on this "language" to explain to me why there has been so little improvement in the Web development programming environment in THREE DECADES.

You don’t have to compile JS to use it, and it works the same as PHP, Python, Ruby, and many other typically interpreted languages.

Again, JS is extremely efficient for many use cases. If that doesn’t include yours, that’s unfortunate for you, and I’d suggest looking into wasm.

Either way, this isn’t the right venue for this discussion - web browsers’ choices are their own, and this discourse is only for the JS language itself, which has no ability to force itself to be implemented anywhere. You may want to look at WHATWG.

Thank you.

I have complete control of what goes to my web server. Nobody else can see that code even if I choose to use an interpreted language like PHP, Python, or Ruby. I also have the choice to use a compiled language like C.

JavaScript source code MUST be delivered to anybody that uses my sites, and I am not given a choice. WASM provides a mechanism for part of the application which is particularly performance sensitive, for example game animation, to be implemented in a compiled module which is called by JavaScript.

Once in the browser JavaScript is compiled into intermediate code for a virtual machine. Each browser supplier can implement a different intermediate code and its own virtual machine implementation, but this is inefficient. Why does JavaScript not support pre-compilation into intermediate code and the transmission of just that intermediate code to the browser? Admittedly that would break the debugger which depends upon the ability to display the source code to the programmer. But I would not expect my end-users to ever invoke the debugger. It is almost impossible to interpret what is happening in the debugger if the code is obfuscated in any event.

There was a proposal for effectively that but it hasn't made much progress. GitHub - tc39/proposal-binary-ast: Binary AST proposal for ECMAScript

I'm not sure what the browsers latest thoughts on that proposal are.

1 Like