Douglas Crockford Envisions A Post-JavaScript World (infoworld.com)
JavaScript developer (and JSON proponent) Douglas Crockford recently described "a theoretical post-JavaScript World," according to InfoWorld. Crockford "believes the web development staple needs a successor that can fix multiple programming nuances." An anonymous reader summarizes their report:
Despite its status as the world's most popular language, Crockford told an audience at the Oracle Code conference, "It would be sad if JavaScript turns out to be the last language." He complained that JavaScript has two different ways of declaring variables -- let and var -- as well as two different "bottom variables" with no value -- both null and undefined. "There's an argument among language designers, should we have bottom values at all? But there's nobody who thinks you should have two of them."
According to InfoWorld, Crockford "also presented a scenario with JavaScript being turned into a purely functional programming language by getting rid of 'impurities' like date, the delete operation, math.random and object.assign. Afterward, he stressed replacing JavaScript rather than adding functional capabilities to it... The next language also should be better able to deal with multiple cores. Most languages have followed the sequential model of Fortran, executing one operation after another, he said. 'That's not how the world works anymore. We now have lots of cores available to us, which all want to be running at the same time.'"
In other news, Crockford also proposed ending the "spaces vs. tabs" debate by simply eliminating tabs altogether.
According to InfoWorld, Crockford "also presented a scenario with JavaScript being turned into a purely functional programming language by getting rid of 'impurities' like date, the delete operation, math.random and object.assign. Afterward, he stressed replacing JavaScript rather than adding functional capabilities to it... The next language also should be better able to deal with multiple cores. Most languages have followed the sequential model of Fortran, executing one operation after another, he said. 'That's not how the world works anymore. We now have lots of cores available to us, which all want to be running at the same time.'"
In other news, Crockford also proposed ending the "spaces vs. tabs" debate by simply eliminating tabs altogether.
>also presented a scenario with JavaScript being turned into a purely functional programming language by getting rid of 'impurities' like date, the delete operation, math.random and object.assign.
Getting rid of those things does not make JS a functional programming language.
Also, writing in purely functional languages just fucking sucks, they aren't and won't ever be a multi-core-coding panacea, and if highly-parallel-performance computing is your concern for the future, being ignorant to how parallel processing environments work by "letting the compiler decide" isn't going to make things better.
We need a standardised virtual machine that languages can be compiled to run on, that way the language of choice is more free to change. And Web browsers developers can deal with a simpler virtual machine language to translate.
In the last 40 years I've used lots of languages from BASIC to Z80 assembly, 8080 assembly, 8086 assembly, 68k, C, awk, sed, sh, perl, C++, TCL/Tk, ADA, Python, Java, Javascript. Some I really liked (assembly, C), some I used with trepidation (C++, perl), some I actively hated (TCL/Tk, ADA).
But the one and only language that I felt was actually working against me was javascript. Damned script would pass all my tests, then fail on someone else's machine because they chose different options when installing, or had a different version, or just reasons. Note my scripts wouldn't actually fail, as in an error message. No, they just gave the wrong damned results.
I fucking hate Javascript with a passion and wish it would die by the end of the year.
Tabs should be completely eliminated. They are a obsolete vestige left over from mechanical teletypes.
"Completely" is a strong word. I can understand using spaces for indentation, but if you "completely" eliminate tabs, you break compatibility with POSIX Make. Furthermore, if you "completely" eliminate tabs, then what format for delimited flat files? In my experience, tab-separated values format is more efficient than comma-separated values format because a value is far more likely to need escaping because it contains a comma than because it contains a tab.
Okay, so this might be a bit of a ramble. Hi, I'm one of the developers of Monte https://monte.rtfd.org/, a new programming language based on E. E http://erights.org/ is a language from the 90s. Crockford worked on E. E's TermL mini-language became JSON. Another person who worked on E was Mark Miller. Miller's thesis project was formalizing and describing systems built with E. Crockford and Miller both are part of the committees that steer JS.
Now, to bring it all together: Object capability security is a security discipline based on the principle of least authority and perfect encapsulation. It allows us to build secure distributed computations with pretty good security properties; wf-stringe can prove that certain data cannot be exfiltrated, that certain I/O cannot happen, and that certain computations are arbitrarily safe to evaluate. It's not perfect, but it's a massive improvement on the state of things.
E and Monte, as well as a few other languages like Caja, Pony, and Waterken, are object-capability languages. Just like languages without manual memory management cannot misbehave in certain ways, these languages also promise that they cannot fail in certain desirable security-related ways.
Crockford, Miller, and others have been deliberately steering JS towards more capability-safe constructions. The object model has been tightened up, and tools like weakmaps, promises, and "template strings" (we call them quasiliterals in the literature) have been added. However, JS is still defined by its weak points, and those points are weak indeed.
Obviously, my bias is towards Monte. It's my preferred language and I want it to be popular. But, more importantly, I want the ideas that went into Monte to be popular. So, in that spirit, I'm going to give you a short list of questions. I want you to think, "How can I do that in my favorite language? Why would I want it?" Monte is meant to be the next Blub http://wiki.c2.com/?BlubParadox, the next language that is mediocre but built on a good foundation, and part of that is trying to see how Monte answers questions like:
~ C.
I've read all comments as of this time and nobody seems to have taken note of his suggestion about bottom vars:
"There's an argument among language designers, should we have bottom values at all? But there's nobody who thinks you should have two of them."
I would like to _strongly_ disagree, you _do_ need two different kinds:
undefined (Not a Number/Not a Result) which traps if you try to use it, and none which means empty/ignore!
In the Mill cpu architecture (http://millcomputing.com/) we have those two different kinds and they make coding both easier/more elegant/more compact, and at the same time faster and more secure!
Another example:
I am currently on the group that works on the 2018 revision of the IEEE 754 (i.e. floating point) standard. In the original '754 version the "Not a Number" (NaN) type was defined as a way to create a "sticky" error marker in a numeric calculation. I.e. if you accidentally try to calculate 0/0 or Inf/Inf the result will be undefined, the operation might trap or not depending upon how your language runtime is setup, but the result will always be a NaN. There are two kinds of NaNs, Signaling NaN and Quiet NaN, the only difference is that the next time a SNaN is taken as input to an operation it will trap and then be converted to the equivalent QNaN while a QNaN as input will just propagate to the output.
It should be obvious that if your runtime initializes all FP variables to NaN, then any accidental use-before-load should be detected, right?
The problem is that for the 2008 (current) revision of the standard, enough people wanted a totally different behavior when searching for the maximum value in an array, typically used to scale a matrix: They managed to define minNum(a,NaN)/maxNum(NaN,b) so as to ignore any quiet NaN val
ues, always returning the other value. I.e. in those functions they got NaN to behave as None!
The real problem, and the main reason these functions are going away is how the definition above interact with the SNaN/QNaN rules:
maxNum(1.0, QNaN) -> 1.0
maxNum(QNaN, 1.0) -> 1.0
maxNum(1.0, SNaN) -> QNaN
maxNum(SNaN, 1.0) -> QNaN
So if you look for the maximum of 4 values, one of them a SNaN, the result will depend on the order of comparisons, i.e. if you do them pairwise you get this result:
max(1.0, SNaN, 2.0, 3.0) -> maxNum(maxNum(1.0, SNaN), maxNum(2.0, 3.0)) -> maxNum(QNaN, 3.0) -> 3.0
while taking alternate inputs results in
maxNum(maxNum(1.0, 2.0), maxNum(SNaN, 3.0)) -> maxNum(2.0, QNaN) -> 2.0
I.e. we would have been much better off here with a single bit pattern meaning None which would never propagate.
"almost all programming can be viewed as an exercise in caching"