Re: Feedback on Átila's Vision for D

Jacob Carlborg doob at
Thu Oct 17 18:18:49 UTC 2019

On 2019-10-16 13:14, Atila Neves wrote:

> What tooling what you like to see developed that doesn't exist now?
> I keep reading online that Go has great tooling, but having used it I 
> don't know what people mean when they say that. Likewise, I read that 
> people want D to have great tooling but I also don't know what they mean 
> then either.

In general the compiler (DMD) needs to be able to be used as a library 
to build various tools on top of it. A great start is to have a full 
working LSP [1] server which uses DMD as a library under the hood. 
Features supported by LSP include:

* Code completion
* Hover (I guess this can show the actual type of an `auto` declaration)
* Signature
* Go to definition
* Find references
* Highlight all references
* Code formatting
* Symbol renaming
* Code folding
* Show documentation for symbol

On top of that there are more advanced refactoring tools:

* Upgrade tool - automatically replace deprecated features and symbols 
with new equivalent

* Modernizer - replaces some language contracts with more modern 
alternatives. Might be combined with the above tool but will not be 
limited to deprecated this. Perhaps replace `in {}` contracts with the 
newer `in()` syntax.

* Code extractor - extract a code snippet to a function/class/struct
* Move a variable to a smaller scope

And other tools:

* Linter

* Compile time lowerer - show how the compiler expands mixins, lowers 
some features to others (i.e. `scope` to `try`/`catch`/`finally`), 
`foreach` to `for` (I assume). This could be implemented as a special 
view in and editor/IDE

* Automatically add attributes to functions

Regarding Go. One huge advantage is that the standard library contains a 
Go frontend [2]. Here is what seems to be the standard Go tools [3]:

* callgraph - a tool for reporting the call graph of a Go program
* eg - The eg command performs example-based refactoring
* goyacc - Goyacc is a version of yacc for Go
* guru - a tool for answering questions about Go source code

* fiximports - The fiximports command fixes import declarations to use 
the canonical import path for packages that have an "import comment" as 
defined by

* godex - The godex command prints (dumps) exported information of 
packages or selected package objects

* goimports - Command goimports updates your Go import lines, adding 
missing ones and removing unreferenced ones

* gomvpkg - The gomvpkg command moves go packages, updating import 

* gopls - The gopls command is an LSP server for Go

* gorename - The gorename command performs precise type-safe renaming of 
identifiers in Go source code

* gotype - The gotype command, like the front-end of a Go compiler, 
parses and type-checks a single Go package


/Jacob Carlborg

More information about the Digitalmars-d mailing list