top | item 16749363

(no title)

tsvetkov | 8 years ago

I think it's not correct to say that Turing-completeness somehow prevents extracting project structure. If a build tool can extract that information, why IDE could not do that? In fact this is how Gradle projects are imported into Intellij and Eclipse: Gradle builds project model by running Groovy or Kotlin scripts, and then IDEs are working with declarative model. The real problem is working with scripts themselves: changing them automatically (applying refactorings), providing good completion, navigation, etc. The dynamic nature of Groovy makes it much harder for IDEs to provide good tooling, but even with statically typed Kotlin it is hard because Gradle APIs are very dynamic in nature (lots of string typed APIs). That does not mean that Turing-completeness prevents good tooling completely, it just requires more efforts and has some limits depending on a build tool`s software model.

discuss

order

lokedhs|8 years ago

To answer your question as to why an IDE can't do it, the reason is that in order to do it you need to solve the halting problem.

Of course, the IDE can do it if you limit yourself to a subset that is not fully Turing complete, which is what IDEA does today.

The issue a lot of people have with Gradle is that this subset is not well defined, and it's very easy to do something that works but will get the tools to have problems, and debugging such issues is not particularly entertaining.

tsvetkov|8 years ago

IDE does not try to analyze Gradle scripts directly, it works with declarative model that is created by executing Gradle scripts. Gradle works in two stages: 1. Configuration: scripts execute and produce software model (DAG of tasks essentially). 2. Execution of necessary tasks in the graph.

IDE cannot get the graph by analyzing scripts, but it does not need to: instead it can ask Gradle for the model. The model itself has nothing to do with Turing completeness.

gleenn|8 years ago

You're not wrong about the halting problem, but the reality is that most people do simple things that the IDE can extract a lot of information about. I.e. it doesn't have to understand a function to make the function fireable from a GUI button, and that is still actually quite useful.