emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

code annotations


From: Daniel Brooks
Subject: code annotations
Date: Thu, 04 Nov 2021 22:21:11 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Stefan Kangas <stefan@marxist.se> writes:

> Daniel Brooks <db48x@db48x.net> writes:
>
>> Rust also has a very flexible annotation system that allows the
>> programmer to annotate specific statements and language items. If a use
>> of these characters is determined to be legitimate, the programmer can
>> annotate the comment, or the function the comment is in, so that this
>> error is disabled. In projects with strong review culture, seeing that
>> annotation while doing a code review will be a very strong signal that
>> something unusual is going on, and that it needs to be considered
>> carefully. Annotations are are a great feature of Rust that I do not
>> expect Emacs to take into account.
>
> We already have `ignore-errors', `with-suppressed-warnings', etc.
> That sounds as powerful as the annotation system you describe, or am I
> missing something?

`ignore-errors' is not similar, because it operates only a run time. I
had forgotten about `with-suppressed-warnings', which can suppress
warnings while byte compiling; that is indeed similar. Does it operate
at read time though?

On the other hand, Rust annotations are used for a few other things as
well, besides enabling or disabling warnings and errors. They are used
for conditional compilation, telling the compiler to do extra work for
you (derive, for example), specifying linking options (static vs
dynamic linking, for example), code generation (inlining, etc). And the
list can be extended by macros.

The reference is here:
https://doc.rust-lang.org/reference/attributes.html

db48x



reply via email to

[Prev in Thread] Current Thread [Next in Thread]