Builtin functions must be wrapped in a function.
mbostock opened this issue · 2 comments
mbostock commented
Contrary to the documentation, it appears that if you want to implement a builtin as a function, it has to be wrapped in a function that return this function.
mbostock commented
This is still true:
Line 28 in 3514f26
Furthermore, this is desirable because it allows you to provide lazy definitions of built-in functions. For example, you can define a md
tagged template literal that only loads Marked.js if it’s actually needed.
Another way to avoid the wrapper function is to use a Promise wrapper: Promise.resolve(fun).