Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

IDE with advanced code analysis?

Name: Anonymous 2016-02-21 11:23

/prog/, what's the IDE with the most advanced code analysis features out there? I'm talking about things like:

- listing all the free variables that occur in selected code term
- warning the user when he shadows a binding from the outer scope
- finding all the places where a variable gets mutated
- showing all possible execution paths through a code term

Name: Anonymous 2016-02-21 11:24

emacs

Name: Cudder !cXCudderUE 2016-02-21 11:44

Your brain.

Name: Anonymous 2016-02-21 12:23

Emacs

Name: Anonymous 2016-02-21 12:39

Isn't a report for each of these features going to take longer to grok than simply figuring it out by yourself?

Name: Anonymous 2016-02-21 12:43

>>5
No.

>>4
I'm a woman, I don't have any.

Name: Anonymous 2016-02-21 12:44

>>6
Citation needed, mothafuckaaaaa!

Name: Anonymous 2016-02-21 13:22

>>7
Very often I need to take a chunk of code and make it into a separate function. Going through the code and checking what free vars there are to make them all into function parameters would be a chore, might as well rewrite it from scratch. An IDE could help a lot here.

Name: Anonymous 2016-02-21 14:51

>>8
Write smaller functions. If you're too stupid to do that, split your chunk into its own function anyway and then deal with the unbound variables.

Name: Anonymous 2016-02-21 15:19

>>9
split your chunk into its own function anyway
That's what I would like to do. Is there an IDE smart enough to help me?

Write smaller functions
You're another idiot who mindlessly applies "design patterns" regardless of whether they're appropriate or not.

Name: Anonymous 2016-02-21 15:34

>>10
Is there an IDE smart enough to help me?
Yes, Notepad can do this. You select the lines you want to put into a function, hit Ctrl-X, move the cursor out of the function, and then hit Ctrl-V. You will have to write a function signature around it, though. Then all of your code-specific tools (including your IDE -- the above steps are not specific to Notepad!) will show you where the free variables in your new function are.

Alternatively, all of the top DDG search results for "ide refactor" which mention a specific IDE give you step-by-step instructions on how to do what you are trying to do.

"design patterns"
Bzzt! Wrong again! Explain how, exactly, "write smaller functions" is a "design pattern", because it just sounds like common fucking sense to me.
Perhaps you are not using a language particularly conducive to writing small helper functions in order to break down your problem into its component parts?

Name: Cudder !cXCudderUE 2016-02-21 15:36

>>11
Perhaps you are not using a language particularly conducive to writing small helper functions in order to break down your problem into its component parts?

Or how about just writing it all in one place so you don't have to jump all over the fucking file(s) to figure out how it works?

Name: Anonymous 2016-02-21 15:39

>>11
What I'm trying to say, >>10, is that you should just stick with today's special.
If moving a chunk of code into its own function is a daunting task to you, then there's something wrong with either you or your code that a magical IDE will not help you with.

Name: Anonymous 2016-02-21 15:43

>>12
That's why you write the functions next to each other, asshole. Do you order your functions alphabetically or something?

Name: Anonymous 2016-02-21 17:56

>>12
This, exactly. Functions don't need to be small. The purpose of a function is reusability and abstraction boundaries, not splitting code into small chunks which only makes it harder to read code.

Name: Anonymous 2016-02-21 17:57

>>13
It's not a daunting task, it's a chore that I'd like automatized so I can do it instantly. Notepad won't help because it won't write the function arguments for me.

Name: Anonymous 2016-02-21 18:03

>>6
Women are not allowed anywhere near the Emacs!

Name: Anonymous 2016-02-21 18:09

>>15
Code is meant to be read. Make it readable. That is the only thing that should guide function size.
Modules, not functions, are for abstraction boundaries and reusability.

Name: Anonymous 2016-02-21 18:55

>>18
You haven't even heard that a function may be called in two places, have you?

Name: Anonymous 2016-02-21 19:10

>>19
Read the rest of the thread before you start moving the goalposts.

Name: Anonymous 2016-02-21 20:31

>>20
When someone says that functions are not for reusability, that's a miss no matter where the goalposts are. It's just plain wrong.

Name: Anonymous 2016-02-21 20:54

So to sum up the thread, in 2016 there is not a single IDE in the world advanced enough to understand what free variables, scopes or execution paths are.

Name: Anonymous 2016-02-21 20:59

>>21
You are talking past yourself. There is a difference between reusability on the module level and reduction of duplication within each module. You started out in >>15 on the former, and stumbled over to the latter in >>19,21.

Modules are the unit of reuse and abstraction, and what is a module if not a collection of functions and types? (You cannot reuse a function from outside of a module without also requiring the types the function operates over, also within that module. Thus, you cannot pull an arbitrary function out of a module; you must use the module in its entirety.)

Name: Anonymous 2016-02-21 21:00

>>22
Save the summary until >>999 please!

Name: Anonymous 2016-02-21 21:04

>>22
emacs

Name: Anonymous 2016-02-21 21:19

>>24
YOU MENA >>1001

Name: Anonymous 2016-02-24 20:28

>>24,26
U MENA >>1111

Name: Anonymous 2016-08-28 4:40

Write smaller functions
This is bad advice. Smaller functions means MORE functions, and each function regardless of size has some fixed overhead in code generated and space allocated on the stack. This is the problem with ``design patterns" and ``maintainable code"; in writing code that can be easily understood and modified by idiot programmers, you make it harder for the compiler to generate efficient machine code. Even the best optimizing compilers can't match the quality of hand-written assembly, confusing them with unnecessary function calls is just going to make things worse. At the very least, you should use macros or inline functions, to avoid the overhead of a function call.

Name: Anonymous 2016-08-28 6:18

Check em

Name: Anonymous 2016-08-28 6:40

Programmer's Notepad

Name: Anonymous 2016-08-28 10:11

>>28
Programmer time is more expensive than computer time in the vast majority of computer applications. Maintainable, extendible and composible code is normally more desired by the people paying the programmers than minuscule improvements in CPU time.

Name: Anonymous 2016-08-28 10:33

Programmer time is expensive
Sir, this is not true anymore

Name: Anonymous 2016-08-28 11:02

Check em

Name: Anonymous 2016-08-29 1:52

>>28
each function regardless of size has some fixed overhead in code generated and space allocated on the stack
in writing code that can be easily understood and modified by idiot programmers, you make it harder for the compiler to generate efficient machine code.

You're a shithead locked into Cudder-level dicking around with C. None of this is true for a recompiling JITted language.

Even the best optimizing compilers can't match the quality of hand-written assembly,

False for anything but stupid microbenchmarks. Compilers can match Real Work to the processor better than you can.

confusing them with unnecessary function calls is just going to make things worse.

You really don't know anything, you fucking moron. Die.

Name: Anonymous 2016-08-29 2:28

None of this is true for a recompiling JITted language.

Compilation is always going to be a computationally intensive task. JIT compilation means you're either going to have to deal with a compilation delay at startup, or turn off/reduce optimization to allow your code to be JIT-compiled quickly. Besides, JIT compilation isn't even done with most languages - most are either distributed as pre-compiled binaries, or interpreted. JIT is the exception, rather than the rule.

False for anything but stupid microbenchmarks. Compilers can match Real Work to the processor better than you can.

Okay, if you're talking about the average programmer, who doesn't understand low-level programming. But that's kind of like a self-fulfilling prophecy - the reason the average programmer can't write good assembly is because for the last forty years we've been training them to focus on learning how to write good high-level code, and letting the compiler worry about the low-level detail. But in all honesty, where compiled HLL beats hand-written assembly is in speed, not quality. An assembly programmer might be able to write very highly optimized code, but it will take them 8 days, and 2 days to write unoptimized assembly code. While the compiler's output isn't as highly optimized as what the assembly programmer can do, it's considered worthwhile since the time is much less (30 seconds or so).

You really don't know anything, you fucking moron. Die.
Compilers are still fairly limited in the circumstances under which they can optimize away unnecessary function calls (e.g. TCO). When output of a function call is passed to another function, that means both functions' local variables will need to be allocated on the stack, even if both functions have local variables that refer notionally to the same object. This is where macros have an advantage - they have the same syntax as functions, and are equally useful in breaking down a complex computation into smaller parts, but don't instruct the compiler to construct a stack frame. Functions do make sense in cases where making separate local variables are called for by the algorithm (say you want to repeat some action n times, without changing the value of n, so the logical way of doing this is copying n into i and doing while(i--). This could be done either as
#define REPEAT(n) (int i = n; while(i--) dosomething)
or
void repeat(n) {
while(n--) dosomething;
}

In this case the function is better, because you need a "local variable" in either case, and the function deallocates the local variable as soon as it's done with it, which the macro does not.)

Name: Anonymous 2016-08-29 5:07

JIT languages with ridiculously thorough recompilers include Java and JavaScript. The languages may be shit, but the compilers rock and these aren't some "exception" languages.

And holy fuck, stop thinking the world is as fucking stupid as C.

Name: Anonymous 2016-08-29 5:10

>>35
#define repeat(N) for(int i=N;i--;)
variables in scope of for loop exist only within the loop.
https://stackoverflow.com/questions/7880658/what-is-the-scope-of-a-while-and-for-loop

Name: Anonymous 2016-08-29 5:12

>>35
This is where macros have an advantage - they have the same syntax as functions
C macros barely have syntax at all, and the unfathomable uselessness of your example belies your inadequacy in even understanding C.

Name: Anonymous 2016-08-29 5:14

Example for >>37
repeat(60) a_state=refresh()?1:r_1();
converts to
for(int i=60;i--;) a_state=refresh()?1:r_1();

Name: Anonymous 2016-08-29 5:42

>>38
Syntax as in the general pattern of functionname(arg1,arg2). I don't know what you mean by saying they "barely have syntax at all", because the main difference from functions as far as source code syntax is concerned is that macros are typeless. It is necessary to write macros in different syntactical styles (such as by surrounding arguments with parentheses in the expanded form, to avoid things like:

#define TIMES_TWO(n) n*2

int a = TIMES_TWO(2 + 7) /* value stored in a is 16, not the expected 18 */

)
But that doesn't mean it makes sense to say they don't have syntax.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List