I've just fixed UFCS for the experimental type function branch

Paul Backus snarwin at gmail.com
Thu Sep 10 21:08:31 UTC 2020

On Thursday, 10 September 2020 at 18:44:46 UTC, Meta wrote:
> It looks like it depends on the order of fields:
> struct S
> {
>     int a;
>     mixin("int b;"); //No error
>     enum size = S.sizeof;
> }
> Ideally `enum size = S.sizeof` could be delayed until after all 
> mixins are "evaluated" (is that during one of the semantic 
> phases? I don't know much about how DMD actually works), but I 
> imagine that would take some major re-architecting. Really 
> though, is it even necessary to be able to "freeze" a type like 
> this when evaluating type functions?

Sometimes there is no way to avoid "evaluating" one part of the 
program before another. For example:

struct S
     int a;
     static if (S.sizeof < 8) {
         int b;

Because of the way static if works, the compiler *must* do 
semantic analysis on S.sizeof before it does semantic analysis on 
the declaration of b. There is no way to avoid it by re-ordering 
or deferring the analysis of certain declarations.

More information about the Digitalmars-d mailing list