Skip to content

bug or feature? sliced.elementCount != arr.length #313

Description

@mw66
  // http://mir-algorithm.libmir.org/mir_ndslice_slice.html#sliced
  auto arr = [
      1, 2, 3,
      4, 5, 6];
  auto s = arr.sliced(2, 1);
  Assert.equal(s.elementCount, arr.length);  // failed
  s.prettyArr.writeln;

Expected:6
Actual:2

When user turn an array into a slice, I think most of the time they want turn the whole array into a N-d slice; if this is a feature, I'd think it's a mis-feature, should be better documented (so no surprise to the user), and maybe also issue a run-time warning by default, if the converted sliced.elementCount != arr.length

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions