3 ms·
Name return variables bro. This is a solution that people fixed 25 years ago with detailedReturnObjectNames.
by khelavastr 6mo ago
Name return variables bro.
This is a solution that people fixed 25 years ago with detailedReturnObjectNames.
- jfengel 6mo agoCan 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.
- foobarian 6mo agoNot 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.
- jfengel 6mo agoAh, 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.