7,416 karma · joined October 23, 2009
Email: charles@codemix.com
You're making me blush!
The list of integers could be replaced by using tuples and reading their lengths to do basic arithmetic. Might run into recursion limits though.
The errors aren't really errors, just warnings about unused types
Also the decision to split React's createElement() into jsx() and jsxs() means that to maintain compatibility all libs would have to do the same, and provide both functions, all because of an implementation quirk in React.
JSX should be a standalone thing. It's not intrinsically React, and shouldn't bend to React's needs alone.
function MyThing() {
return (
el(A, {value: 123}, [
el(B, {value: 456, foo: true}, [
el(C, {awesome: true}),
el(D, {awful: false})
])
])
);
}
but there's a reason people prefer JSX syntaxJSX is really a way to describe a hierarchy of deferred function calls independent of their callers. This could be tremendously useful in a number of different contexts, not just UI. What would a state machine look like if the states could be described in JSX? What would rx.js look like if this mechanism was available?
The current tooling makes experimenting with possible alternate use cases pretty awkward, and so basically no one is doing work in this area.
I believe that these changes, particularly the `jsx` and `jsxs` auto import, will make it even harder to separate JSX as a concept from React and React-like libraries. It'll make it harder to standardise JSX, which is frustrating as it's the most supported ECMAScript syntax extension by a long way.
My modest proposal is that a JSX element desugars to a call to a block scoped identifier called `jsx`, so I can do something like this:
import { jsx } from 'react';
import { elementCreator } from 'somelib';
const someFunction = () => {
const { jsx } = elementCreator();
return <iAmNotAReactElement />;
};
const MyReactComponent = () => <div>cool</div>;
Taking this alternative approach would give developers a widely supported syntax extension that could allow for some really innovative solutions. The current path is going to do the opposite.I understand that there are perf optimisations that React can do if they control all of this. But I feel like they're looking at this too narrowly, from only the perspective of UI. They have the power to open up a lot more opportunities.
This isn't true - Benchmark.js will repeatedly rerun benchmarks until it gathers statistically meaningful results.
> There's no portion of code that "blackholes" the results to keep the JIT from optimizing away the code under benchmark.
True, and there's actually nothing benchmark.js can do to ensure that doesn't happen in the general case but when this does happen the results are usually pretty obvious - we'd see billions of ops/sec. Incidentally the left-pad benchmarks do not suffer from this issue.
Maybe "infomorph"?
- 63ms (async)
- 100ms (casync)
so it's almost twice as slow as native async await in this example.
Supply chains are intact but they can't deal with this level of demand immediately and so there's going to be a period in which there are shortages. How long those shortages last depend not only demand but on other factors, e.g. how many people in the supply chain are directly or indirectly affected by the virus.