sorting hidden data.
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Wed Sep 29 13:37:34 PDT 2010
On 9/29/10 13:10 PDT, Jacob Carlborg wrote:
> Would that be the uniform function call syntax that I've been waiting
> for since I first heard of it?
Yah. One unpleasant issue I found with it (as it's already implemented
for arrays) is a chicken-and-egg thing: say I want to provide operation
moveFront only if the type doesn't define it yet. Without UCF (Uniform
Call Syntax) things are simple:
auto moveFront(R)(ref R r)
if (!is(typeof(r.moveFront())) && !hasElaborateCopy!(ElementType!R)) {
return r.front;
}
With UCF things get messy because introducing moveFront at global level
does make r.moveFront() legit, so the if clause returns true, which is
weird because the function shouldn't have been introduced yet. So the
compiler gets confused by this lying Cretan riddle - it recurses forever
(when R is an array).
The solution would be probably to not consider the symbol introduced
until the if-clause has cleared.
Andrei
More information about the Digitalmars-d
mailing list