Project

General

Profile

Actions

Bug #18765

closed

Wrong description introduced by https://github.com/ruby/ruby/pull/4938/files

Added by sawa (Tsuyoshi Sawada) almost 2 years ago. Updated about 1 year ago.

Status:
Closed
Assignee:
burdettelamar@yahoo.com (Burdette Lamar)
Target version:
-
[ruby-core:108487]

Description

Commit https://github.com/ruby/ruby/pull/4938/files introduced problems and made the description wrong.

  1. For methods slice_after and slice_when, it introduces expressions like "partition elements into arrays ('slices')", and for method chunk_while, "partition elements into arrays ('chunks')". It suggests to call the resulting elements using different words depending on the name of the method. But that does not make sense. They are all simply arrays, and there is no need to distinguish a "slice array" from a "chunk array". (They can all be called an "array", "slice", or "chunk", or whatever.)

    Perhaps, it is attempting to explain where the method names came from, under the assumption that the words "slice" and "chunk" in these method names are nouns. If so, that is wrong. The succeeding parts "when (block)" and "while (block)" are (to correspond to English) adverbial clauses, not adjectival (relative) clauses; hence, these "slice" and "chunk" must be interpreted as verbs, not nouns. In fact, "a slice when y is not a successor of x" or "a chunk while y is a successor of x" does not make sense, whereas "slice it when y is not a successor of x" and "chunk them while y is a successor of x" do make sense.

    The difference between the "slice" and "chunk" methods lies in the process, not the return value. If you want to use these words, it can be something like "slice the receiver into arrays when the block returns a truthy value" and "chunk the elements together while the block returns a truthy value".

  2. In the description of slice_when and chunk_while, it says "it calls the block with each element and its successor", but that is not true. If you are going to phrase it that way, then it only calls each element except for the last one.

  3. In the description of slice_when, it says "begins a new slice if and only if the block returns a truthy value", but that is not true. Regardless of the value of the block, the first element always begins a new "slice".

  4. Most crucially, in the description of chunk_while, the expression "begins a new chunk if and only if the block returns a truthy value" is entirely wrong.

Actions #1

Updated by sawa (Tsuyoshi Sawada) almost 2 years ago

  • ruby -v set to 3.1.0

Updated by hsbt (Hiroshi SHIBATA) almost 2 years ago

  • Status changed from Open to Assigned
  • Assignee set to burdettelamar@yahoo.com (Burdette Lamar)
Actions #3

Updated by sawa (Tsuyoshi Sawada) almost 2 years ago

  • Description updated (diff)
Actions #4

Updated by jeremyevans0 (Jeremy Evans) almost 2 years ago

  • Status changed from Assigned to Closed
Actions #5

Updated by nagachika (Tomoyuki Chikanaga) almost 2 years ago

  • Backport changed from 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN to 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED

Updated by nagachika (Tomoyuki Chikanaga) about 1 year ago

  • Backport changed from 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED to 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONE

ruby_3_1 9f072e9ae1bae2d76334c9e97a47280779768859 merged revision(s) 8038d5e40a079d60dfcf7cab1155528959760c28.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0