Hi Bengt,
In general, I like the idea of @decorator, but there are several implications that needs to be considered:
> We just added the @ character and as far as I can see the semantics is exactly
> the same as the Python counterpart.
Not really. In Python @decorator def func means to literally pass the returned value from func to the decorator function. In potential-future-P0707, @decorator func means to pass the entire token
sequence of the body of func to the decorator function. Therefore I don’t think the analogy actually makes sense.
> Or maybe even a
> blanket allowance: Wherever you can put ^^ before a contruct you can put
> @function-name instead and let the consteval function adjust the contents of
> the following entity.
How is @decorator some_entity different from just decorator(some_entity)? AFAIK the semantics of the former is just to pass some_entity to the decorator…
> As long as we haven't used @ for something else there should be no parsing
> issues. I can imagine that someone wants @ to be an identifier character but I
> haven't seen a proposal for this.
In fact, there are. @keyword is used in Objective-C[++] specifically because that avoid clashes with C++ keywords, so things like @interface cannot work. Also, there exists a proposal (P3254)
that proposes to use @something as annotation tokens instead of [[=something]] currently proposed.
Just my 2c.
Best regards,
Yihe Li