Microsoft wants to make a potentially huge change to JavaScript

Microsoft has backed a proposal to bring optional and erasable type syntax to JavaScript in an effort to make its TypeScript language both faster and easier to use.

In a new blog post, the software giant provided further insight on the proposal and what it aims to do. Essentially, the proposal is calling for type annotations to be added to JavaScript code that can be checked by external type checkers and treated as comments by a JavaScript engine at runtime.

A set of syntax for types that engines would ignore but TypeScript, Flow and other tools could use would also need to be created as part of the proposal.

If the proposal is approved, developers would be able to run programs in TypeScript, Flow and other static typing supersets of JavaScript without the need for transpilation according to InfoWorld.

Type syntax in JavaScript

The new Stage 0 proposal was written and put forth by Gil Tayar, Microsoft's Daniel Rosenwasser, Igalia's Romulo Cintra and Bloomberg's Rob Palmer and is available to read in its entirety on GitHub.

The reason behind the proposal is that over the past decade, static type checking has proven to be fairly successful. In addition to Microsoft's TypeScript, Google created its Closure Compiler while Facebook built Flow to provide syntax for declaring and using types in JavaScript.

At the same time, 69 percent of respondents in the 2021 State of JavaScript survey said that they use TypeScript to compile JavaScript and static typing was voted as the number one feature missing from the programming language.

It's worth noting that Microsoft isn't calling for TypeScript's type checking to be added to every browser and JavaScript runtime. Instead, the company has proposed a JavaScript syntax compatible with TypeScript that could be used by any type checker while being ignored by JavaScript engines.

Via InfoWorld

TechRadar – All the latest technology news

Read More

Python could soon rival JavaScript for web applications

There’s a new project that’ll reportedly enable the Python programming language to run within web browsers with the help of WebAssembly.

The CPython on WASM project, which will build the default and most popular implementation of the Python language written in C is developed by Berkeley-based software developer, Ethan Smith.

According to The Register, the project was created with the help of core Python developer Christian Heimes, and could make Python a viable alternative to JavaScript, at least for some web applications.

Python on the web

“The new project which Christian Heimes and I are working on has a goal of making the web a supported platform for CPython, just like Windows or macOS,” Smith told The Register.

WebAssembly has taken the world by storm thanks to its promise of bringing the performance of native applications to the web, to the level that isn’t possible with JavaScript.

However, The Register notes that at this point, the goal of the project to bring Python to the browser through WebAssembly’s  Emscripten compiler, is more about enabling the use case, rather than performance.

The project reportedly comes in the wake of another project, called Pyodide, which too enables Python code to run in the browser.

“My hope is that this will enable a wider ecosystem of Python developers targeting the web, and allow for easier integration with existing Python tools and processes, many of which Pyodide has had to reinvent like micropip to replace the standard pip package installer,” explained Smith. 

Smith hopes that his project can help facilitate web-based cross-platform app development, but is quick to add that CPython on WASM is still in the early stages of development.

TechRadar – All the latest technology news

Read More