C++ Logo

sg7

Advanced search

Re: Attributes introspection

From: Fabio Alemagna <falemagn_at_[hidden]>
Date: Sat, 20 Apr 2024 13:26:06 +0200
Il giorno sab 20 apr 2024 alle ore 10:13 Corentin via SG7
<sg7_at_[hidden]> ha scritto:
> [...]
> - In the general case, arguments cannot be reflected because they are token soup with complete disregard for C++ grammar.

<lurking mode="off">

I trust you on that, but I'd like to understand more: if the compiler
can parse them, why couldn't it reflect them?

Till now I thought attribute arguments could be literals only, but
reading the draft it appears they can be any sequence of 4 types of
tokens: identifier, keyword, literal, operator-or-punctuator [1].

Do I get that right? If so, what makes it impossible to reflect that?

Fabio

[1] https://eel.is/c++draft/dcl.attr#nt:balanced-token-seq

Received on 2024-04-20 11:26:20