Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom @ decorators #43

Open
200sc opened this issue Mar 16, 2024 · 2 comments
Open

Support custom @ decorators #43

200sc opened this issue Mar 16, 2024 · 2 comments

Comments

@200sc
Copy link
Owner

200sc commented Mar 16, 2024

No description provided.

@200sc
Copy link
Owner Author

200sc commented Mar 23, 2024

@ decorations also deprecate classic [flags] style decorations; until it becomes impossible, parsing both forms for the transition from 2 to 3 is a reasonable choice.

Open questions to decide:

  • can you put more than one decoration on a field / top level declaration (presumably yes)
  • are decorations terminated with semicolons (presumably no)
  • can you declare the same decoration twice (presumably no)
  • are reserved decoration names now valid identifiers (presumably yes)
  • are flags/opcode disallowed on fields (presumably yes)
  • are decoration names case sensitive (presumably yes)

@andrewmd5
Copy link

andrewmd5 commented Jun 28, 2024

To answer these for you:

can you put more than one decoration on a field / top level declaration

Yes

are decorations terminated with semicolons

No, they can be just @flags if there are no parameters, or @opcode(2000)

can you declare the same decoration

Yes, if the decorator itself allows it. For example, a contributed decorator (one an extension registers with the compiler) can declare it allows for multiple declarations on a target. None of the builtin ones support it though.

are reserved decoration names now valid identifiers

Yes

are flags/opcode disallowed on fields

Yes, they are disallowed. See decorator targets & definitions

are decoration names case sensitive

Yes

Another thing, decorators now support named and optional arguments, similar to C# https://learn.microsoft.com/en-us//dotnet/csharp/programming-guide/classes-and-structs/named-and-optional-arguments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants