The most surprising of these is his spelling of "one," yes, yes, that eye of Kelly, that inefficient multiplier, that name that Prince Charles calls himself, that he, Crockford, insists on rendering " wun ". And again. With all the adorable variations released for free: somewun anywun no wun I wunce wrote a builder, wunth and, get ready for it, two .
This is quite annoying and distracting, but no more than an economy-class transatlantic flight in a narrow seat in the middle aisle in front of a poorly disciplined ADD child whose kicks in the seat back are distributed by Poisson with Lambda around 4.7 per minute
I am sure I have seen that spelling "wun" before, in the writings of Daisy Ashford, Alan Alexander Milne, or some other child author. We have greeted "goodbye" to the wild world web. We have landed at Wun Hundred Acre Wood.
Eeyore & # 39; s Gloomy Place
A decade later, thanks in large part to Crockford's contributions, the importance of language has increased n -doblez. A consequence of this: in recent times, language has undergone serial manipulation, culminating in annual revisions of its standard. Good Parts has become obsolete.
- Callbacks, promises and async / wait – that is, the three code sequence structures used by the old and modern Node.js programmers. These Crockford styles are "the three errors"
- ES6 generators ("added during the time when the standards process suffered serious Python envy." The Crockford code snippet that demonstrates an alternative looks much more orderly and elegant, he should have the standards committee slapping his forehead together and shouting "Oh!")
- They revoked exceptions ("a terrible practice that C ++ made popular")
- The fat arrow
=>("Farts [sic] is an abbreviated way of writing functions." Given reasons for disgust: a problem with ambiguous keys when a thick arrow is used to return an object, and the danger of confusing it with
> =. Really?)
- The keyword
class("The coders who use the class
There are some newer JS Functions that they receive a warmer welcome: the method
Array.reduce is r Ated as "kind of bright". But such enthusiasm is spent frugally.
By the way, the TypeScript language is not mentioned, the current toast of many of those fashionable children of React, the inventor of the Ryan Dahl node, and in fact myself. Given Mr. Crockford's low opinion about type safety ("Types can induce us to adopt cryptic, complex and doubtful coding practices") and his advice in italics "Transpilators should never be used in production" I think we can safely assume that TypeScript is firmly buried in its "garbage" heap. Boo hoo.
Tigger bounces in
The book is not pessimistic at all; rather it is sadness and remedy.
0.1 + 0.2 === 0.3 // false, obv
so it is reasonable for Crockford to highlight it. (On the other hand, I suspect your report of this wrinkle
(1/0) === (1 / -0) // also false
is there just to entertain readers. It works for me.)
The next bit is smart: disapproving a standard proposal to complement
number with a
BigInt takes the lower 24 bits of the doubles and ordinary tortures to be become the basis of a library of arbitrary precision integers. Not satisfied with this, he extends his library of integers to make a "large floating point" library, designed cleverly so that the tenths add up correctly, and then take it further to create a "large rational" library that works with fractions, although vulgar
Everything is very ingenious … but building a model of the SS Titanic with worn Vestas is also ingenious. And one is concerned about performance (of arithmetic, not coincidences). Again, my data sources rarely give me up to 14 bits of accuracy on a sunny day; I dare to say that those who do financial calculations will be duly grateful.
This general approach sets the template: identify a problem in the language, then provide a solution.
… but I am not convinced that the solution is always necessary. "Applicants" are Crockford's alternative to callbacks, promises and asynchronous / pending functions from Node.js. That the first two are problematic is indisputable; But Crockford's objection to async / wait, as I understand it, is that it hides its underlying mechanism from its users, who consequently do not understand its operation.
This seems to me the old argument, presented long ago by the smoking pipes and generation of leather patches on the elbow, so that no one is allowed to use C until he dominates the assembly of Z80. I am not buying it. Also, miserably conservative that I am, I feel reluctant to be a pioneer in a fourth callback mechanism when my base code is already plagued by a confusing mix of the other three.
A much more promising innovation is JSCheck, a powerful variation of the usual unit testing framework. Instead of forcing the programmer to write tests a tedious
affirm Equals () at the same time according to the lumpen prescription of the TDD crowd, the JSCheck tests are configured using predicate functions that indicate true when the results are good ones. When activated, the target code is bombarded with automatically generated random values. It seems much more blurry than conventional unit tests, and I'm eager to try it with anger.
 ==  // false  ==!  // true
provide hours of fun for children.
Tonstant Weader doesn't fly up
Crockford has always been happily iconoclastic, and has always followed the Third Doctor. dictum about being serious on purpose, if not approaching.
These are admirable qualities, but the relentless joke tends to blur the lens. He could do with an editor. My services are available and have an incredibly good value. If it is taken, I will fix the problem of wun in wunce. ®
Verity Stob is the pseudonym of a London-based software developer. Since 1988, he has written his "Verity Stob" column for the .EXE, Dr. Dobb & # 39; s Journal and, since 2002, The Register .
What follows after Netezza?