Writing JavaScript libraries that are stable is hard, too hard. The extreme level of modularity we practice has only made things worse, as it's become very easy to depend on quirks/bugs that exist in other libraries.
The approach that is most often taken to increase stability in a programming language is to introduce Types. That is, trade expressiveness for better static reasoning. The point being, the compiler should be able to find bugs in your program.
I'm interested in another approach; make it easier for the developer to find bugs themselves. To that end, the motivation for this language is to be easy to test. What if everything within a programs closure was available to be mocked.
exports.getName = function(person){
return upperCase(person.name);
};
function upperCase(txt) { ... }
What if we could replace the upperCase
function when testing, to ensure that the function we are testing adjusts behaves according to that change.
The idea is to have much more robustly tested code. Code that is tested against all possible scenarios, if possible.
Aside from this type of dependency injection, I'd also include features such as Monads and Immutability that ensure tested code always produces the same outcome.
- Immutable by default
a = 1
is immutable. Maybe provide a fallback, maybe not. - Must be targeted at JavaScript from the start, written in JS.
- Good source map support
- Good interfaces - must be easy to write tests for.
- Built-in support for dependency injection. Not sure what this means, but it probably means that all of the imports are some how available to you for manipulation.
- Some way to do type signatures. Not sure if this will be required (maybe) but at least as good as Haskells.
Sorry to jump in on your thoughts here but I think
a = 1
is already immutable. Nothing can be done to change the value 1, only thing that can change is whata
is assigned to.const a = 1
is immutable and constant.const a = {...}
is constant but not immutable, the properties ofa
can change.const a = Object.freeze({...})
is constant and immutable.