3 ms·
Side note but it is sad as hell that arguments.callee is gone (in esm, a long with arguments in general), which was such an excellent way for functions to take
by jauntywundrkind 2y ago
Side note but it is sad as hell that arguments.callee is gone (in esm, a long with arguments in general), which was such an excellent way for functions to take whatever bindings it has & turn them into accessors. I miss like hell the JS world where functions could easily show off some internals.
function add(a) {
return a + arguments.callee.amount
}
add.amount = 2
console.log(add(2)) // => 4
(In this simple eread-only example arguments.callee could be be replaced with add, but if one is doing inline function definitions or other cases that's not possible.)
And that was something devs explicitly had to do in their libraries! But in guile there's some automatic capability to expose your bindings.
> Guile programs can use first-class accessors on the module systems to pull out bindings.
In general, I strongly feel like the ability for the language to let developers explore the bindings is like "the" missing piece of programming language systems, is one of the primary gates to good metaprogramming ever emerging. I wish the runtime would be observable.
- LegionMammal978 2y agoYou can still emulate this to an extent with a wrapper function: function selfBind(f) { return function g(...args) { return f.call(this, g, ...args); }; } let add = selfBind(function (callee, a) { return a + callee.amount; }); add.amount = 2; /* ... */ Though obviously it isn't quite as straightforward as 'arguments.callee'.
- e12e 2y agoCOMEFROM considered harmful?