typeof(func!0) != typeof(func!0())

Paul Backus snarwin at gmail.com
Mon Aug 22 16:35:46 UTC 2022

On Monday, 22 August 2022 at 16:06:37 UTC, Andrey Zherikov wrote:
> On Monday, 22 August 2022 at 15:15:22 UTC, Paul Backus wrote:
>> My first instinct is to say that this is the user's mistake. 
>> UDAs are not evaluated like normal expressions, and anyone 
>> using UDAs is going to have to learn that sooner or later.
> My feeling was that UDA expression is just an expression that's 
> evaluated at compile time. Am I wrong? Where can I read about 
> the differences between UDA and 'normal' expressions?

A UDA can be either an expression or a symbol. Here are some 
examples of symbol UDAs that are not valid expressions:

import std.stdio;
struct S;
template t() {}

@S           // a type
@(std.stdio) // a module
@t           // a template
int n;

More information about the Digitalmars-d-learn mailing list