I just learned FPC has scoped enums, which is nice, but they lack what you 
could call “relative inference” based on the type being passed. In the example 
below the parameter “t” is TMyType but passing “A” doesn’t work. Doesn’t the 
compiler know the type and can infer “A” is relative to the scoped enum? I 
understand there’s a possibility for name conflicts but you could just use the 
full name in that case.

Is this a missing feature or do you need to enable it or something?

{$scopedenums on}
type
        TMyType = (A, B, C);
{$scopedenums off}

procedure DoThis (t: TMyType);
begin
end;

DoThis(A);


Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to