I was responding to the person responding to you mostly, but thanks for clarifying, I'd not taken your issue seriously in my reply.
Having just a deprecated macro seems very narrow and special case to me.
Something like FF's getSource would work.
var deprecated = function(fn) {
console.warn("Function "+fn.name+" deprecated (at "+fn.getSource()+")");
fn.apply(this, arguments);
};
but obv. isn't useful in real code at the moment because it is FF-only (afaik).I'm generally quite nervous of 'special forms' in languages that don't allow you to define them yourself. Part of why scheme is so powerful is that most of it can be implemented in the same tools it gives you. I'd like to see that approach.
What I really want, and what can't be achieved with your purely in-language solution (and it really is a great solution considering the constraints), is a special form for things like @deprecated such that it straight-up can capture not only the function it's decorating, but also meta-data about the function (e.g. where it's declared, the caller / callee, etc.)