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

Literal::Array(T) #134

Open
joeldrapper opened this issue Nov 9, 2024 · 8 comments
Open

Literal::Array(T) #134

joeldrapper opened this issue Nov 9, 2024 · 8 comments
Labels
Milestone

Comments

@joeldrapper
Copy link
Owner

joeldrapper commented Nov 9, 2024

Literal::Array(T) should be like an Array, but maintain the integrity of its own types by checking types in any method that inserts elements.

array = Literal::Array(Integer).new(1, 2, 3)

array << 4 # 4
array << "not an integer" # raises Literal::TypeError

array.map(String, &:to_s) # ["1", "2", "3", "4"]
array.map(Integer, &:to_s) # raises Literal::TypeError

Instance methods from Array

@christopher-b
Copy link
Contributor

I am tracking work here. I'll do a PR when I have a bit more done.

@phillipspc
Copy link
Contributor

Just opened a new PR for some more "assigning" methods

@stevegeek
Copy link
Collaborator

I am tracking work here. I'll do a PR when I have a bit more done.

Feel free to open a Draft PR anytime!

@joeldrapper
Copy link
Owner Author

Without having an issue for each method, I’m not sure the best way to track these. Maybe throw up a comment with the next batch you plan to work on. I’ll try to keep the issue description up-to-date.

@christopher-b
Copy link
Contributor

I'll take a crack at

<=>
assoc
collect!
compact
compact!

#collect can be aliased to #map, yeah? Or perhaps vice-versa, to match the implementation of Array.

@christopher-b
Copy link
Contributor

I've moved my PR out of draft. Please feel free to review at your leisure.

@hslzr
Copy link
Contributor

hslzr commented Nov 13, 2024

Addressed #dig, #drop, #drop_while and #== in #147.

@joeldrapper
Copy link
Owner Author

joeldrapper commented Nov 14, 2024

I decided to make separate issues for each of these. 🤡

I can only assign them to folks to comment on the issue.

@joeldrapper joeldrapper added this to the 2.0 milestone Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants