Syntax for Static Import of User Define Attributes

Steven Schveighoffer schveiguy at gmail.com
Fri Jul 28 11:54:12 UTC 2023


On 7/28/23 4:15 AM, Vijay Nayar wrote:
> On Thursday, 27 July 2023 at 21:24:44 UTC, Dennis wrote:
>> On Thursday, 27 July 2023 at 21:19:08 UTC, Vijay Nayar wrote:
>>> Attempted Fix 2: Enclose the entire attribute name in parenthesis.
>>> ```
>>> static import vibe.data.serialization;
>>>
>>> class ChatCompletionFunctions {
>>>   @(vibe.data.serialization.name)("name")
>>>   ...
>>> }
>>> ```
>>
>> Try:
>>
>> ```D
>> @(vibe.data.serialization.name("name"))
>> ```
> 
> This one causes a different error, because it invokes the 
> template-argument syntax: https://dlang.org/spec/attribute.html#uda

I tried it and it worked for me. The template-argument syntax is normal. 
It's just a list of types or expressions (i.e. not a function argument list)

What is the error?

-Steve


More information about the Digitalmars-d-learn mailing list