https://issues.dlang.org/show_bug.cgi?id=18124
Steven Schveighoffer <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |ddoc Status|RESOLVED |REOPENED CC| |[email protected] Resolution|WONTFIX |--- Summary|Over-use of `auto` return |std.regex.RegexMatch's |type in std.regex |front property is | |under-documented Severity|enhancement |trivial --- Comment #4 from Steven Schveighoffer <[email protected]> --- (In reply to Seb from comment #1) > Advantage of `auto`: > - we can change the API No, you can't change the API. People depend on the API being the way it is. You can change the result's innards (read: private members) whether it's auto or not, but what auto does allow is changing the NAME of the result, and not break any code. In other words, it forces you to use auto when receiving the result. But this is only for private or voldemort types. In this case, we are defining the type publicly, so using auto here just avoids writing out the type itself. Another advantage of auto is when you want to return different types based on static introspection. This allows a much DRYer mechanism than somehow generating the return type (and the result can look a lot worse than using auto). > - less visual clutter (that's subjective though) Well, we need to describe what the result actually can do. In this case, it seems the result is under-documented, so we should do *something* to fix that. Looking at the code, it seems it's returning a defined struct in the file itself, so we should just document it properly. (In reply to Neia Neutuladh from comment #2) > Just a tip: emoticons can make an otherwise professional comment seem smarmy > or condescending. If you do not intend to seem smarmy or condescending, you > may wish to avoid them. Just another tip: you may want to avoid taking unnecessary offense at innocuous things for no reason. Most people in our organization are friendly and cheerful people, including Seb. Thanks! ;) --
