No UFCS with nested functions?

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Nov 4 20:46:41 UTC 2019


On Mon, Nov 04, 2019 at 07:51:26PM +0000, Tobias Pankrath via Digitalmars-d-learn wrote:
> Why does the following not work? It works, if I move the 'prop' out of
> 'foo'.

UFCS is only supported for module-level functions, as far as I know.


> ---
> struct S {
> 	ubyte[12] bar;
> }
> 
> bool foo (ref S s)
> {
>    static bool prop(const(ubyte)[] f) {
>       return f.length > 1;
>    }
> 	return s.bar[].prop;
> }
> ---
[...]


T

-- 
I am not young enough to know everything. -- Oscar Wilde


More information about the Digitalmars-d-learn mailing list