[Submission] D Slices
eles
eles at eles.com
Sat Jun 11 09:08:14 PDT 2011
> This is not practical. It would be too expensive to check because
the
> hardware does not support it.
neither does for bounds checking. expensiveness does not matter so
much in the debug version.
> As has been said, multiple times, UTYPE_MAX is not a valid index,
and that
> is not because of the open-interval on the right. It's because of
> addressing in a zero-based index world, you simply can't have an
array
> bigger than your address space. An array with UTYPE_MAX as a valid
index
> must have at least UTYPE_MAX + 1 elements.
well, on unsigned nbits=3, UTYPE_MAX =7 and that's a valid index, as
you write a[0]..a[7]. the array has UTYPE_MAX+1 elements (ie.
"length", aka "$") and this is exactly why mentioning "$" as "length"
instead of "last element" is inconsistent when you write a[0..$] (the
second index is, *with this syntax* UTPE_MAX+1 and is not
representable)
> But, it's not really important anyways. The open-right indexing
ship has
> not only sailed, it's made it across the ocean, formed several
colonies,
> and is currently declaring independence.
Even if independence is acquired, empires are doomed to fall in the
end. See China rising.
> You're about a decade too late
> with this argument.
well, C++ standards gave the same answers when changes were proposed,
this is why the need for D in the first place. age of a choice does
not make it any better. there are good and bad habits. see the famous
"< <" *recommendation* for writing in templates in order to not
conflict with "<<" operator.
> How much of a possibility would you think Matlab has of changing its
> indexing scheme to be like D's? About the same chance as D adopting
> Matlab's, I'd say.
what about multi-dimensional slicing?
> If this is a reason you will not use D, then I'm sorry
> that you won't be with us, but that's just life.
I do not much use it anyway. My job (both work and teaching, is C and
OpenCL). What I was doing was to recommend it as next language to my
students, when they ask about what OOP to learn (they had some
choices, among C++ and Java). I find it very difficult to further
recommend a language that I do not believe in. Well, I still have two
weeks to think about that, semester ends on June 20 (exam of C).
More information about the Digitalmars-d
mailing list