in reply to I don't like annotation syntax

If people feel annotations for this are alright then I must defer to their judgement. Mostly because I can't think of anything better that doesn't look like C.

There is a my Dog $spot syntax that in some sense declares (at approximately pinky-promise level) that $spot will be isa Dog.

In `perldoc -f my` we see my TYPE VARLIST which is described by:

The exact semantics and interface of TYPE [is] still evolving. TYPE may be a bareword, a constant declared with + "use constant", or "__PACKAGE__". It is currently bound to the +use of the fields pragma

I'm not sure what "bound to the use of the fields pragma" is intended to mean, but you probably don't need to care if your preprocessor is in any case going to strip it out.

(Update: added quote from OP)

Replies are listed 'Best First'.
Re^2: I don't like annotation syntax
by LanX (Saint) on Jul 13, 2022 at 12:44 UTC
    I think that's off topic, it's a type declaration and not an attribute.

    Very different things, type declarations are just stubs and badly documented and I think nothing happened there in the last 20 years.

    > "bound to the use of the fields pragma"

    see fields

    compile-time checking if you use hash keys of a typed Hash/Class.

    also hardly used

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery