200sc / bebop

bebop wire format in Go
Apache License 2.0
71 stars 5 forks source link

Support custom @ decorators #43

Open 200sc opened 7 months ago

200sc commented 7 months ago

@ 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:

andrewmd5 commented 4 months ago

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