This proposal defines new syntax for destructuring binding with tagged template literals.
Not submitted.
| const lookupTable = [] | |
| export function record (fields) { | |
| for (const storedRecord of lookupTable) { | |
| if (shallowEqual(fields, storedRecord)) { | |
| return storedRecord | |
| } | |
| } | |
| const newRecord = Object.freeze({ ...fields }) | |
| lookupTable.push(newRecord) |
| let lookupTable = Immutable.Map({}) | |
| export function record (fields) { | |
| let key = Immutable.Map(fields) | |
| let storedValue = lookupTable.get(key) | |
| if (storedValue) { return storedValue } | |
| let newValue = Object.freeze({ ...fields }) | |
| lookupTable = lookupTable.set(key, newValue) | |
| return newValue | |
| } |
| const isolate = (scope) => | |
| new Proxy(scope, { | |
| has: () => true, | |
| get: (target, key) => { | |
| if (key === Symbol.unscopables) { | |
| return undefined | |
| } | |
| if (key in target) { | |
| return target[key] | |
| } |
| function * example (resource) { | |
| resource.open() | |
| yield _finally(function * () { | |
| resource.close() | |
| }) | |
| yield _catch(function * (error) { | |
| if (error.message === 'foo') { | |
| return resume('bar') | |
| } |
Context is "just" a prop with special behavior, like children or key. It implicitly propagates from elements to their children, unless it is explicitly overridden.
Context can be provided as a prop (to elements) or via the children object's withContext method. Context can be consumed as a prop (to components) or by using a function in children.
This component:
| function useTransition (isActive, onEnter = noop, onExit = noop) { | |
| const ref = useRef() | |
| useEffect(() => { | |
| if (!ref.current) return | |
| if (isActive) onEnter(ref.current) else onExit(ref.current) | |
| }, [isActive]) | |
| return ref | |
| } | |
| // ----- |
Zebu https://github.com/modernserf/zebu
Constraints - Crista Lopes tagide.com/blog/research/constraints
Little Languages - Jon Bentley staff.um.edu.mt/afra1/seminar/little-languages.pdf
Purpose-Built Languages - Mike Shapiro
| // This code should have been transformed, right?? | |
| import styled from 'styled-components'; | |
| const Foo = styled.div` | |
| color: pink; | |
| `; | |
| export { Foo }; | |
| :- discontiguous gender/2. | |
| :- discontiguous balls/2. | |
| :- discontiguous age/2. | |
| :- discontiguous gender_pair/2. | |
| :- discontiguous position/2. | |
| % positions: [sled] -> wheel -> team -> swing -> lead | |
| % TODO: what is the significance of the wind? | |
| % hari |