Compiler attributes
The compiler applies these attributes to the IL it emits, so that C# tooling and the Amethyst compiler itself can recover Amethyst-specific information from compiled assemblies. You rarely write them by hand.
AmethystName
Section titled “AmethystName”@[AmethystName(original_name: String)]Records the original Amethyst name of a member whose .NET name was transformed, such as
valid? emitted as IsValid. Applies to methods, types, properties, fields and
parameters. When the compiler looks up a member of a .NET type, a member whose
AmethystName matches wins over the usual name mapping.
AnonymousArgument
Section titled “AnonymousArgument”@[AnonymousArgument]Marks a parameter as positional (name: Type): no label at call sites.
KeywordArgument
Section titled “KeywordArgument”@[KeywordArgument]Marks a parameter as a keyword argument (name:: Type): the label is required at call
sites. See Parameter Kinds.
AmethystEnumData
Section titled “AmethystEnumData”@[AmethystEnumData(tag_enum_type: Type)]Marks the generated data class of a complex enum.
tag_enum_type is the paired tag enum.
AmethystEnumTag
Section titled “AmethystEnumTag”@[AmethystEnumTag(data_class_type: Type)]Marks the integer tag enum of a complex enum. data_class_type is the paired data class.
AmethystAsync
Section titled “AmethystAsync”@[AmethystAsync]Marks an async method. Its IL return type is Task<T>, while its Amethyst signature
declares the unwrapped T.
AmethystLibrary
Section titled “AmethystLibrary”@[AmethystLibrary]Marks a static class whose methods the compiler makes available to Amethyst code. Its
extension methods become methods of the extended types, and the public static methods
of the Kernel class can be called anywhere without a receiver. Applies to classes.
AmethystPreferred
Section titled “AmethystPreferred”@[AmethystPreferred]Marks a library extension method that takes precedence over an instance member with the
same Amethyst name. For example, Regex#match resolves to the extension that returns
Match? rather than to Regex.Match, which never returns nil. Applies to methods.