modular / modular/modular

[Feature Request] general warning annotations on declarations

Open
#5,706 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement mojo Needs Triage
Dominant language
Mojo
Stars
29.8k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

Review Mojo's priorities
What is your request?

Add a general purpose annotation that allows attaching custom warnings to declarations (functions, methods, structs, traits, etc.), surfaced when the symbol is used.

This would generalize the existing @deprecated mechanism without implying removal, allowing library authors to communicate information such as experimental status or behavioral notes.

What is your motivation for this change?

A general warning annotation would improve API clarity and user experience while keeping changes without breaking.

Any other details?
@mark(status="experimental", "May change without notice")
struct Foo:
    ...

or

@status("experimental", "May change without notice")
struct Foo:
    ...

or

@warning("private", "This is intended for internal use and is not part of the public API.")
fn internalHelper():
    ...

Exact naming, syntax are open for discussion.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing Mojo's existing @deprecated mechanism and how declaration-use warnings are surfaced. The issue is complete when an agreed general-purpose annotation design can attach custom warnings to declarations and display them when the symbol is used; naming and syntax remain open for discussion.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.