If someone writes a useCoolMemo hook which has a similar signature of useMemo, there should be a generic macro which gives access to the inputs array. A proposed syntax is:
import { auto } from 'hooks.macro';
useCoolMemo(someOtherArg, ...auto(() => x * y));
Which could become:
useCoolMemo(someOtherArg, ...[
() => x * y,
[x, y]
]);
Special cases
We could also treat some special cases in a different way for performance reasons.
Array destructuring
const [ impl, inputs ] = auto(() => x * y);
Becomes:
const impl = () => x * y;
const inputs = [x, y];
Arguments spread
useSomething(...auto(() => x * y));
Becomes:
useSomething(() => x * y, [x, y]);
If someone writes a
useCoolMemohook which has a similar signature ofuseMemo, there should be a generic macro which gives access to the inputs array. A proposed syntax is:Which could become:
Special cases
We could also treat some special cases in a different way for performance reasons.
Array destructuring
Becomes:
Arguments spread
Becomes: