[Issue 7177] $ should forward to length by default
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Mar 21 08:32:45 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7177
--- Comment #19 from monarchdodra at gmail.com 2013-03-21 08:32:44 PDT ---
(In reply to comment #14)
> Yes, it makes sense in some cases for opDollar not to be length.
>
> [SNIP]
Note though that opDollar would *fallback* to length if you did not implement
opDollar. You are still free to implement your own opDollar if you wish, so
your DCollections would still be fine.
(In reply to comment #15)
> (In reply to comment #14)
> > Another example is int[int]:
> >
> > int[int] x;
> > x[1] = 14;
> > x[100] = 42;
> > assert(x[$-1] == 14);
>
> That's a strong case. If compiler tries to translate $ to length automatically,
> library AA implementation will become impossible.
>
> I'll close my pull request.
No need! Please don't close it quite yet. A simple "@disable opDollar();" or
"private opDollar();" should shut down this problem.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list