12-Mar-2013 17:12, Dmitry Olshansky пишет:
12-Mar-2013 14:36, Andrej Mitrovic пишет:
On 3/12/13, Dmitry Olshansky <[email protected]> wrote:
struct match //ditto for replace
{
//current behavior
static auto opCall(.....);
}
For a second I was worried this would break UFCS, but actually it
still works. Pretty kewl.
Actually it does... but only partially:
[snip]
So with my initial idea being **cked up by UFCS on 'b' in case of
'a.b.c' resolution chain.
The problem is not anything new BTW as there is no way to do a fully
qualified call with UFCS. something.std.ascii.isWhite also won't work.
Darn UFCS. Maybe we can discover some sane rule to cover both corner cases?
There's got to be some way out of it that doesn't involve alias this and
proxies...
And w/o proxies I can get at least match(...).all and match(...).first.
But not replace as it used to return a naked array and thus it would
need to be a proxy... and proxies have another problem.
Again the problem is not anything new but I believe is flaw in any
proxies design in D. It's the fact that auto type inference on
intialization sees proxies for what they are:
auto x = replace(...); // now typeof(x) is some ugly proxy junk
auto y = replace(...).all; //fine - typeof(y) is array
auto z = replace(...)first; //fine - typeof(z) is array
Would it make sense to somehow tweak the langauge to allow proxies to
decay to some 'default' type (of thier choice) on initialization?
It seems to me that any container (or whatever) that builds on proxies
is going to hit this wall.
--
Dmitry Olshansky