DLP - D Language Processing 0.3.0 - infer attributes

Jacob Carlborg doob at me.com
Fri Dec 18 20:07:25 UTC 2020


I would like to announce a new release of DLP, 0.3.0.

For those not familiar with DLP, it's a tool collecting commands/tasks 
related to processing the D programming language. It uses the DMD 
frontend as a library to process D code.

The major new feature in this release a new command that has been added: 
`infer-attributes`. This command will print the inferred attributes of 
all functions that are normally not inferred by the compiler. These are 
regular functions and methods. Templates, nested functions and lambdas 
are inferred by the compiler and will not be included by this command. 
By default, virtual methods are not inferred. Use the flag 
`--include-virtual-methods` to enable inferring of virtual methods.

The attribute inference is enabled only on the file that is currently 
being processed. This is to avoid the tool outputting attributes that 
would not be valid unless other files are modified. For example, your 
code is calling a third-party function. The third-party function is 
inferred to be `pure`. Now your function is inferred to be `pure` as 
well. But if you only change your function to be `pure`, it will fail to 
compile because the third-party function has not been updated.

The intention of this command is to help you in adding attributes to 
your code. You don't have to figure out exactly which attributes you can 
add to a function, just have the compiler tell you instead. It's 
recommend to run DLP in an iterative process. Run it on a file, update 
the file with the new attributes, run it again and repeat the process 
until the tool doesn't output any more inferred attributes.

The release is available here [1]. Pre-compiled binaries are available 
for macOS, FreeBSD and Linux 64bit and Windows 32bit and 64bit.

For the full change log, see [1].

[1] https://github.com/jacob-carlborg/dlp/releases/tag/v0.3.0


-- 
/Jacob Carlborg


More information about the Digitalmars-d-announce mailing list