Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prefer length over size when talking about number of elements vs. bytesize #1372

Merged
merged 1 commit into from
Aug 26, 2020

Conversation

michaelkirk
Copy link
Contributor

These terms can be synonyms, so what's there isn't wrong, but length is a less loaded term.

e.g. the example:

[T; size]

might be misconstrued as:

// two float32's has a size of 8 bytes
let my_array: [float32; 8] = [1.0, 2.0]; // wrong

… bytesize

These terms can be synonyms, so what's there isn't wrong, but `length` is a less loaded term.

e.g. the example:

    [T; size]

_might_ be misconstrued as:

``` 
// two float32's has a size of 8 bytes
let my_array: [float32; 8] = [1.0, 2.0]; // wrong
```
@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @marioidival (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@xiaochuanyu
Copy link
Contributor

I can see why size is chosen probably because that's the terminology is used in std lib docs https://doc.rust-lang.org/std/primitive.array.html.
But yea I also think that "length" is probably better.
Rust book for example also uses length: https://doc.rust-lang.org/book/ch03-02-data-types.html?highlight=array#the-array-type.

@marioidival marioidival merged commit 19f0a03 into rust-lang:master Aug 26, 2020
@marioidival
Copy link
Member

@michaelkirk Thank you!

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Sep 3, 2020
Update books

## reference

4 commits in 1b6c4b0afab97c0230433466c97167bbbe8445f6..25391dba46262f882fa846beefaff54a966a8fa5
2020-08-18 17:04:28 -0700 to 2020-09-02 07:22:55 -0700
- clarify when reading uninititalized memory is allowed (rust-lang/reference#852)
- Update patterns chapter, add rest patterns. (rust-lang/reference#876)
- Improve Type-Coersion Documentation (rust-lang/reference#843)
- Added variable back into example. (rust-lang/reference#880)

## book

3 commits in c0a6a61b8205da14ac955425f74258ffd8ee065d..e5ed97128302d5fa45dbac0e64426bc7649a558c
2020-08-14 14:21:49 -0500 to 2020-08-31 12:53:40 -0500
- Fix type mismatch in listing 10-5 (rust-lang/book#2441)
- Update ppendix-06-translation.md (rust-lang/book#2437)
- Correct no-listing-10-result-in-tests: Take tests module out of the main function (rust-lang/book#2430)

## rust-by-example

3 commits in 80a10e22140e28392b99d24ed02f4c6d8cb770a0..19f0a0372af497b34369cf182d9d16156cab2969
2020-08-08 09:56:46 -0300 to 2020-08-26 09:38:48 -0300
- prefer `length` over `size` when talking about number of elements vs. bytesize (rust-lang/rust-by-example#1372)
- Split out variable shadowing into a separate example (rust-lang/rust-by-example#1370)
- Update extern crate related sections (rust-lang/rust-by-example#1369)

## edition-guide

1 commits in bd6e4a9f59c5c1545f572266af77f5c7a5bad6d1..81f16863014de60b53de401d71ff904d163ee030
2020-07-12 17:37:08 -0500 to 2020-08-27 13:56:31 -0700
- Fix a small typo. (rust-lang/edition-guide#218)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants