Skip to content

Array slice sample #1

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

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft

Array slice sample #1

wants to merge 9 commits into from

Conversation

JoelMarcey
Copy link
Owner

No description provided.

Copy link

@hawkinsw hawkinsw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really, really like the work that you did! I sincerely hope that at least a few of these suggestions are helpful! Please, please feel free to reject any/all.

@@ -0,0 +1,137 @@
An array is a numbered, fixed-size sequence of elements of a single [type](link to type spec), called the element type. The element type of an array can be any Rust [type](link to type spec).
Copy link

@hawkinsw hawkinsw Jan 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the size of the element type of an array need to be known at compile time? I am not sure that this is even applicable, but I thought that I would note it.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cf https://spec.ferrocene.dev/types-and-traits.html#syntax_arraytypespecification

The [element type](https://spec.ferrocene.dev/glossary.html#term_element_type) shall be a [fixed sized type](https://spec.ferrocene.dev/glossary.html#term_fixed_sized_type).

where it says that the element type needs to have a fixed size.


If the array is mutable, as defined by the `mut` keyword, the array elements can be updated. The size and type of the array can never change.

Updating the value of an array element is performed by specifying the index of the element to be changed and setting it to the new value.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would we want assignment like this to automatically invoke an Into::into upon assignment if the type of elements of the array are different than the value in the assignment?

JoelMarcey and others added 7 commits January 19, 2024 10:32
Co-authored-by: Will Hawkins <whh8b@obs.cr>
Co-authored-by: Will Hawkins <whh8b@obs.cr>
Co-authored-by: Will Hawkins <whh8b@obs.cr>
Co-authored-by: Will Hawkins <whh8b@obs.cr>
Co-authored-by: Will Hawkins <whh8b@obs.cr>
Co-authored-by: Will Hawkins <whh8b@obs.cr>
Co-authored-by: Will Hawkins <whh8b@obs.cr>
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.

2 participants