http://d.puremagic.com/issues/show_bug.cgi?id=7177
--- Comment #44 from Andrei Alexandrescu <[email protected]> 2013-03-24 08:24:46 PDT --- I gave this long thread a read and reached a decision. Sorry for the dictatorial approach but this seems to be a matter in which reasonable people may disagree so at some point we need to just choose a way and stick with it. Among my priorities in choosing a behavior is that of simplicity - we can't require people to mind a trait such as supportsOpDollar, or require them to define an alias for opDollar in casual ranges. So, there are a few cases to look at. Given a type T: 1. hasLength!T || isNarrowString!T, but T does not define a member opDollar. Then ALL uses of expr.$ in indexing expressions involving values of type T will automatically alias themselves to expr.length. This includes UFCS, i.e. if user code defines a module-level property length(T), then expr.$ lowers into expr.length which in turn may lower to length(expr). (Note that hasLength!T currently does work with UFCS.) 2. T defines opDollar. Great - nothing to do, it's all explicit. 3. expr.length has no meaning and T does not define opDollar. In this case there is a compile-time error. =========== Regarding having opDollar and/or other operators work as UCSF, this would be desirable from a completeness/expectability/consistency standpoint. I don't quite buy the argument that that opens a can of worms. However, seeing as there's already a compiler change for that, I suggest we go this least-committal route for now and defer that decision for later. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
