Skip to content

Consider whether const generics supersedes the Token! macro #1252

Open
@dtolnay

Description

@dtolnay

Something like:

pub struct Token<const A: char, const B: char = '\0', const C: char = '\0'>;

Then you'd use Token<'+'> for what used to be Token![+], and Token<'+', '='> instead of Token![+=], etc.

The custom_punctuation! macro (https://docs.rs/syn/1.0.105/syn/macro.custom_punctuation.html) would no longer be necessary because you could instantiate a Token with any arbitrary punctuation without needing to give it a name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions