Hacker News new | ask | show | jobs
by jfengel 63 days ago
Can you elaborate on that? I'm not following. What makes return variables special?

I'd expect that much of the time, the return variable is closely linked to the name of the function. So closely linked that it risks being redundant.

1 comments

Not JS but I like having explicit return var assignments because it's easier to break on and inspect. I don't know why tools don't make this easier.
Ah, yes, I've had that problem. With some debuggers I can place a breakpoint after the return, but it won't tell me the value on the stack to return. I can look up the stack and hope at some point I'll be able to get a handle on it (assignment to a variable, passed in as an argument, etc) but sometimes I can't.

I probably won't adopt this as a convention, just because most of the time when I have access to a debugger I'll also have access to the source code and handle it myself. But I'm going to keep it in mind, and perhaps get fed up at some point and decide to adopt the idea. Thanks.