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

Managed arrays as List<T> #2

Closed
dyslexicanaboko opened this issue Sep 3, 2023 · 0 comments · Fixed by #6
Closed

Managed arrays as List<T> #2

dyslexicanaboko opened this issue Sep 3, 2023 · 0 comments · Fixed by #6
Labels
bug Something isn't working

Comments

@dyslexicanaboko
Copy link
Owner

dyslexicanaboko commented Sep 3, 2023

Original hypothesis

I find the stock functionality of the JS array disappointing to say the least. Therefore, I will be attempting to implement:

  • Array
  • List<T>
  • Dictionary<K, V>

Not sure how that will go, but we'll see.

09/04 Update

  • This was far more involved than I expected. It started off simple, then got more complicated as I dove further into array manipulation. I learned exactly what it was that had been rubbing me the wrong way all this time about JS arrays.
  • As a result I have ditched the idea of implementing my own type of Array class to mimic the System.Array class from C#. It immediately became an absurd idea after realizing that TypeScript already has a typed Array<T> construct. This was an excellent jumping off point for me, no reason to change it.
  • I have put full focus into working on only List<T> for this ticket.
  • I have run into an interesting problem of handling object equality and comparisons which will always be simple if you are only working with primitive types, but immediately default comparison does not work for composite types. Therefore, I created ticket Equality and Comparisons #3 just for that.
  • Dictionary<K,V> obviously will need to be its own ticket all together. Can't even consider this until comparisons are handled. Stub ticket Create Dictionary<TKey, TValue> #4 created.
@dyslexicanaboko dyslexicanaboko added the bug Something isn't working label Sep 3, 2023
dyslexicanaboko added a commit that referenced this issue Sep 4, 2023
… to me after I went to bed. I accounted for the last day of the month edge case, but not for anything else. Fixed and retested with unit tests.
dyslexicanaboko added a commit that referenced this issue Sep 4, 2023
…sunderstanding all this time with JS arrays. I should be using index assignment instead of thinking of the push function as a way to add elements. JS arrays auto grow, which means they are mutable. That to me is not a true array.
@dyslexicanaboko dyslexicanaboko changed the title Collections Managed arrays as List<T> Sep 5, 2023
dyslexicanaboko added a commit that referenced this issue Sep 5, 2023
…ves. Going to start again on complex objects in a separate branch.
dyslexicanaboko added a commit that referenced this issue Sep 5, 2023
* Getting setup with the List of T.

* #2 First pass at implementing List<T>

* #2 Made an important fix to the DateTime implementation that occurred to me after I went to bed. I accounted for the last day of the month edge case, but not for anything else. Fixed and retested with unit tests.

* #2 saving changes before I start working on handling the array capacity problem.

* #2 got array initialization under control and I learned what I was misunderstanding all this time with JS arrays. I should be using index assignment instead of thinking of the push function as a way to add elements. JS arrays auto grow, which means they are mutable. That to me is not a true array.

* #2 Made more progress on tests and improvements of List<T>.

* #2 Finishing out this ticket by only testing the List<T> with primitives. Going to start again on complex objects in a separate branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant