On Tuesday, November 5, 2019 9:16:27 AM MST ixid via Digitalmars-d-learn wrote: > On Monday, 4 November 2019 at 20:46:41 UTC, H. S. Teoh wrote: > > 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 > > Is this a necessary limitation? It feels inconsistent and clunky.
It's explained at the end of this section of the documentation: https://dlang.org/spec/function.html#pseudo-member - Jonathan M Davis