▲ 72 ▼ Introducing Predictive Debugging: A Game-Changing Look into the Future (blog.jetbrains.com) submitted 3 years ago by agilob@programming.dev to c/programming@programming.dev 22 comments fedilink hide all child comments
[+] ImpossibleRubiksCube@programming.dev 2 points 3 years ago* (last edited 2 years ago) (2 children) [deleted] permalink fedilink source hideshow 4 child comments replies: [–] snowe@programming.dev 4 points 3 years ago (1 child) The code is already compiled. what do you mean it's preemptively compiled? If you're talking about executed, they explicitly called that out.. A prediction can also end at a function call the debugger is cautious about evaluating. That is for your own (or your software’s) well-being. Since code is executed during debugging, the debugger has to be sure that it’s not causing any mutations. When running the above example, we must confirm the evaluation of the int.TryParse method (more about that later): As mentioned in the previous section, the predictive debugger won’t evaluate possibly impure functions to avoid side effects. As a human developer, you most certainly have more knowledge about the code, which is why we give you the possibility to forcefully evaluate a call by clicking the hint: permalink fedilink source parent hideshow 2 child comments replies: [+] ImpossibleRubiksCube@programming.dev 2 points 3 years ago* (last edited 2 years ago) (2 children) [deleted] permalink fedilink source parent hideshow 4 child comments replies: [–] jvisick@programming.dev 4 points 3 years ago By necessity, when you’re in the debugger your code has already been compiled either way, no? Or am I missing something here? This isn’t executing your code as you’re writing it (though it does support Edit & Continue), this is preemptively executing the next lines in your code when you’re already paused in the debugger - which means it’s been compiled and already running. permalink fedilink source parent [–] snowe@programming.dev 2 points 3 years ago (1 child) you're misunderstanding. this is a function of the debugger. Your code has already been compiled and is currently running if you are using this feature. permalink fedilink source parent hideshow 2 child comments replies: [+] ImpossibleRubiksCube@programming.dev 1 point 3 years ago* (last edited 2 years ago) [deleted] permalink fedilink source parent [–] RonSijm@programming.dev 3 points 3 years ago* (1 child) preemptively running source as it was written It's not preemptively running source as it's being written, it's preemptively evaluating methods as you're debugging it This looks like it's preemptive compiling, which isn't just unwise, it's potentially dangerous. So I think what you might mean is preemptively evaluating methods at runtime? - which would be unwise / potentially dangerous - since it could cause side effect For example, evaluating a method that increments something and modifies the state. So if it's preemptively called by the debugger, the state would be modified, and the actual invocation would be different I installed the Resharper RC, and this is how it looks like in a small project that parses an excel file: https://i.imgur.com/g4s0P3h.png So, in the example my debugger is still on the allTheFieldsEmpty line and hasn't ran it yet, but resharper already evaluated it to false. Then it also greyed out everything in the if(allTheFieldsEmpty) block, since it knows it wouldn't hit that The next line you can see there was a warning, "Possible impure evaluation" - which is that I assume you were talking about, and it didn't evaluate that yet. I can click the box and make it evaluation it. The debugger inspects the method, as the article mentions, it check for the PureAttribute - indicating that it's safe to use After I marked that GetMappingField method as Pure, it actually did evaluate it without any interaction, and it predicted it would throw an exception https://i.imgur.com/zQ0K3Ge.png - seems pretty useful so far permalink fedilink source parent hideshow 2 child comments replies: [+] ImpossibleRubiksCube@programming.dev 1 point 3 years ago* (last edited 2 years ago) (1 child) [deleted] permalink fedilink source parent hideshow 2 child comments replies: [–] RonSijm@programming.dev 1 point 3 years ago I don't think this will necessarily help solve issues you wouldn't be able to solve without this, though I used similar tools in the past (Ozcode) and it did make debugging easier / faster permalink fedilink source parent
[–] snowe@programming.dev 4 points 3 years ago (1 child) The code is already compiled. what do you mean it's preemptively compiled? If you're talking about executed, they explicitly called that out.. A prediction can also end at a function call the debugger is cautious about evaluating. That is for your own (or your software’s) well-being. Since code is executed during debugging, the debugger has to be sure that it’s not causing any mutations. When running the above example, we must confirm the evaluation of the int.TryParse method (more about that later): As mentioned in the previous section, the predictive debugger won’t evaluate possibly impure functions to avoid side effects. As a human developer, you most certainly have more knowledge about the code, which is why we give you the possibility to forcefully evaluate a call by clicking the hint: permalink fedilink source parent hideshow 2 child comments replies: [+] ImpossibleRubiksCube@programming.dev 2 points 3 years ago* (last edited 2 years ago) (2 children) [deleted] permalink fedilink source parent hideshow 4 child comments replies: [–] jvisick@programming.dev 4 points 3 years ago By necessity, when you’re in the debugger your code has already been compiled either way, no? Or am I missing something here? This isn’t executing your code as you’re writing it (though it does support Edit & Continue), this is preemptively executing the next lines in your code when you’re already paused in the debugger - which means it’s been compiled and already running. permalink fedilink source parent [–] snowe@programming.dev 2 points 3 years ago (1 child) you're misunderstanding. this is a function of the debugger. Your code has already been compiled and is currently running if you are using this feature. permalink fedilink source parent hideshow 2 child comments replies: [+] ImpossibleRubiksCube@programming.dev 1 point 3 years ago* (last edited 2 years ago) [deleted] permalink fedilink source parent
[+] ImpossibleRubiksCube@programming.dev 2 points 3 years ago* (last edited 2 years ago) (2 children) [deleted] permalink fedilink source parent hideshow 4 child comments replies: [–] jvisick@programming.dev 4 points 3 years ago By necessity, when you’re in the debugger your code has already been compiled either way, no? Or am I missing something here? This isn’t executing your code as you’re writing it (though it does support Edit & Continue), this is preemptively executing the next lines in your code when you’re already paused in the debugger - which means it’s been compiled and already running. permalink fedilink source parent [–] snowe@programming.dev 2 points 3 years ago (1 child) you're misunderstanding. this is a function of the debugger. Your code has already been compiled and is currently running if you are using this feature. permalink fedilink source parent hideshow 2 child comments replies: [+] ImpossibleRubiksCube@programming.dev 1 point 3 years ago* (last edited 2 years ago) [deleted] permalink fedilink source parent
[–] jvisick@programming.dev 4 points 3 years ago By necessity, when you’re in the debugger your code has already been compiled either way, no? Or am I missing something here? This isn’t executing your code as you’re writing it (though it does support Edit & Continue), this is preemptively executing the next lines in your code when you’re already paused in the debugger - which means it’s been compiled and already running. permalink fedilink source parent
[–] snowe@programming.dev 2 points 3 years ago (1 child) you're misunderstanding. this is a function of the debugger. Your code has already been compiled and is currently running if you are using this feature. permalink fedilink source parent hideshow 2 child comments replies: [+] ImpossibleRubiksCube@programming.dev 1 point 3 years ago* (last edited 2 years ago) [deleted] permalink fedilink source parent
[+] ImpossibleRubiksCube@programming.dev 1 point 3 years ago* (last edited 2 years ago) [deleted] permalink fedilink source parent
[–] RonSijm@programming.dev 3 points 3 years ago* (1 child) preemptively running source as it was written It's not preemptively running source as it's being written, it's preemptively evaluating methods as you're debugging it This looks like it's preemptive compiling, which isn't just unwise, it's potentially dangerous. So I think what you might mean is preemptively evaluating methods at runtime? - which would be unwise / potentially dangerous - since it could cause side effect For example, evaluating a method that increments something and modifies the state. So if it's preemptively called by the debugger, the state would be modified, and the actual invocation would be different I installed the Resharper RC, and this is how it looks like in a small project that parses an excel file: https://i.imgur.com/g4s0P3h.png So, in the example my debugger is still on the allTheFieldsEmpty line and hasn't ran it yet, but resharper already evaluated it to false. Then it also greyed out everything in the if(allTheFieldsEmpty) block, since it knows it wouldn't hit that The next line you can see there was a warning, "Possible impure evaluation" - which is that I assume you were talking about, and it didn't evaluate that yet. I can click the box and make it evaluation it. The debugger inspects the method, as the article mentions, it check for the PureAttribute - indicating that it's safe to use After I marked that GetMappingField method as Pure, it actually did evaluate it without any interaction, and it predicted it would throw an exception https://i.imgur.com/zQ0K3Ge.png - seems pretty useful so far permalink fedilink source parent hideshow 2 child comments replies: [+] ImpossibleRubiksCube@programming.dev 1 point 3 years ago* (last edited 2 years ago) (1 child) [deleted] permalink fedilink source parent hideshow 2 child comments replies: [–] RonSijm@programming.dev 1 point 3 years ago I don't think this will necessarily help solve issues you wouldn't be able to solve without this, though I used similar tools in the past (Ozcode) and it did make debugging easier / faster permalink fedilink source parent
[+] ImpossibleRubiksCube@programming.dev 1 point 3 years ago* (last edited 2 years ago) (1 child) [deleted] permalink fedilink source parent hideshow 2 child comments replies: [–] RonSijm@programming.dev 1 point 3 years ago I don't think this will necessarily help solve issues you wouldn't be able to solve without this, though I used similar tools in the past (Ozcode) and it did make debugging easier / faster permalink fedilink source parent
[–] RonSijm@programming.dev 1 point 3 years ago I don't think this will necessarily help solve issues you wouldn't be able to solve without this, though I used similar tools in the past (Ozcode) and it did make debugging easier / faster permalink fedilink source parent