[Issue 7177] $ should forward to length by default

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 29 13:49:19 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=7177



--- Comment #4 from Don <clugdbug at yahoo.com.au> 2011-12-29 13:49:15 PST ---
(In reply to comment #3)
> Let me add that it's not impossible there are ranges that do have
> multi-dimensional slicing but possibly no notion of "length". Sparse matrices
> come to mind.

Yes. Another difference is that length is generally an integer. opDollar
doesn't need to be, it could be any object. It can also be cheap to calculate
opDollar but expensive to determine length.

I guess the question is, for what fraction of use cases will opDollar and
length coincide?

It seems to be true for most ranges, which is interesting because they didn't
even exist when this feature was first implemented -- it was designed for
matrices -- yet they're now shaping us an important use of it. I don't think
that there will be much application code that uses multi-dimensional opDollar,
so it doesn't matter so much if those cases have a fair bit of boilerplate.

How commonly will people declare new ranges in application code?

-- 
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