I previously wrote about the minefield that is Java Script programming and several possible answers to the problem. It’s an Open Source project from Microsoft and the language “is a typed superset of Java Script that compiles to plain Java Script”.It builds on Java Script by adding classes, modules, interfaces and optional type declarations.
The problem is not the result, which is expected, but the choice of using floating point number to represent numbers, and this is a lazy language designer choice. Obviously in C, the "else" statement actually applies to the second if() statement, despite the misleading indentation, this would not be the case in Python, instead of learning how logic flow works, you indent to indicate the relation.
That is, even though an expression of the form a.b() looks like a method call, it is not always so ; arguably this is against the policy of "everything must be explicit and predictable as much as possible" python so vehemently tries adhering to .
Obviously, because of the halting problem, it's not possible to rule out programs that do certain things without also ruling out programs that actually don't.
However, it's interesting that there's such a hard-line rule about certain kinds of bugs that aren't even the worst kinds of bugs in existance.
When compiled, the type declarations are erased and ECMAScript 3 compatible code is generated.
When possible, Type Script tries to match syntax and semantics to proposals for ECMAScript 6.
SEGV is far better than CRIME, and Rust could not have predicted that. Bernstein about why optimizing compilers for memory-safe languages are the wrong answer.
In summary, Rust's "safety" makes it harder to make mistakes in laughably simple code, and does not help with code that has any complexity.
A module is very much like a namespace except it can directly contain a method, or variable.