6 ms·
Why don't you use an IDE that shows you the type? I do agree that jumping into a new code base can be slightly more trickier if type inference is used, but it'
by nawitus 12y ago
Why don't you use an IDE that shows you the type?
I do agree that jumping into a new code base can be slightly more trickier if type inference is used, but it's a minor point compared to the benefits in my opinion.
If you cherry pick something like Vec2i, type inference doesn't look that good, but the benefits are clearer from more complex code.
- serge2k 12y agobecause the code base has several million lines and eclipse is a horrific user experience? The example posted is a horrible use of autocomplete. >const int calculated = [&] { auto l = lock(); auto first = stage1(); auto second = stage2(); return combine(first, second); }() No idea what that does. It takes 2 variables of some type and does something too them. There is some sort of lock there too. I guess.
- nawitus 12y agoSo is the core problem that there's no decent IDE for C++ which can identify the "autocompleted" types to the developer?
- SamReidHughes 12y agoNo, the core problem is a developer that thought "auto" exists to make code easier to write instead of existing to make code easier to read.
- serge2k 12y agoI use sublime text and it works fine, combined with a robust code search tool. The problem here is poorly written code. I shouldn't need an IDE to tell me what is going on, the code should do it.
- Stasis5001 12y agoThe problem there is not with auto, it's with the function naming. If you don't know what the function lock does, how would writing Lock l = lock() help? Also, stage1 and stage2 are awful function names in this context.
- cechner 12y ago> stage1 and stage2 are awful function names in this context Clearly that was an example created to demonstrate the lambda idiom, it wasnt real code
- bcoates 12y agoDoes return combine( stage1(), stage2() ) bother you too? because that infers the return-types of stage1() and stage2() as well.
- serge2k 12y agoyes, for different reasons.
- forrestthewoods 12y agoIf I'm reading a new function I shouldn't have to mouse over, or f12, a dozen variables to figure out what they are. I should be able to tell just by looking at text.
- EliRivers 12y agoThat's alleviating the symptom, rather than fixing the problem. When one needs an IDE to read a plain text file, it's time to stop. Why don't I use an IDE to read it? No, how about why doesn't the original coder write the code for other people to read, instead of forcing me to use an entire IDE just to piece together what they're doing, like I'm some kind of code archaeologist. I'm debugging this thing across a flaky modem line through which I'm getting an echoed terminal, I've managed to get gdb running and narrowed it down to a handful of suspicious lines of code, and the gimboid who wrote it assumed that everyone who ever looked at it would actually be using Visual Studio 20-whatever with all the plug-ins, rather than plain text a line at a time. Brilliant.