D Language Foundation May 2026 Monthly Meeting Summary
Johan
j at j.nl
Tue Aug 11 20:59:56 UTC 2026
On Tuesday, 11 August 2026 at 13:13:22 UTC, Mike Parker wrote:
>
> ### `pragma(lint)` and linting
> [...]
> If there were a plug-in architecture where individuals and
> companies could add their own linting features, that seemed
> fine. The question remained whether it should be done via a
> pragma or a UDA.
LDC has plugin capability for this exact purpose. And it's used,
I believe with great success, at Weka. See Luis's linter:
https://github.com/ljmf00/ldclint
and have a look at the tests for examples of what it does.
If you want to pursue something akin to this, I strongly
recommend to discuss Luis's experience with it.
> Martin said that implementing linting through plugins would be
> tricky, especially
> on Windows. Anyone who had played with D shared libraries knew
> that a plugin would
> need to use the same host compiler that had built the compiler
> itself. If the
> plugin needed to share the GC with the compiler, then the
> compiler would likely
> need to be built with a shared DRuntime. That was all messy.
What's more, the AST API and ABI are very unstable, changing with
each dmd version. So you have to recompile/match the plugin for
each new compiler version anyway. It's not a big problem, but it
is an annoyance.
LDC provides the `ldc-build-plugin` tool to deal with the plugin
build trickery, but IIRC it is still giving linker issues with
Luis's ldclint on macOS.
Regardless, I still believe LDC's plugin capability has been very
useful and has helped catch very hard-to-spot bugs.
Example:
```
struct BadAligned
{
// Warning: Variable `p` is misaligned and contains pointers.
Use `@nogc` to be explicit.
align(1) int* p;
}
```
cheers,
Johan
More information about the Digitalmars-d-announce
mailing list