mojo icon indicating copy to clipboard operation
mojo copied to clipboard

[Feature Request] Rename `DynamicVector` and friends

Open soraros opened this issue 1 year ago • 6 comments

Review Mojo's priorities

What is your request?

Rename DynamicVector and friends to something more sensible. Like DynamicArray, and InlinedFixedVector could simply be Array, etc.

What is your motivation for this change?

I find "dynamic vector" a bit tautological, given the "vector" terminology (likely) comes from C++, which literally means "dynamic sized array". InlinedFixedVector is even worse, not really dynamic dynamic array, but I guess double negation elimination is a thing.

Any other details?

No response

soraros avatar Feb 16 '24 22:02 soraros

Thanks for filing the GH issue after the Discord discussion. I kick-started a discussion last week with the Standard Library team and broader Mojo users internally. We've decided on a new name for DynamicVector and we'll communicate the upcoming renames in the changelog. Still need to decide on a new name for InlineFixedVector.

JoeLoser avatar Feb 20 '24 17:02 JoeLoser

@JoeLoser could you please take a look at this issue: https://github.com/modularml/mojo/issues/1528? This is also related to renaming and will be the best to take steps with this sooner than later :)

gryznar avatar Feb 20 '24 20:02 gryznar

@JoeLoser could you please take a look at this issue: #1528? This is also related to renaming and will be the best to take steps with this sooner than later :)

👍 just replied over there, thanks for pointing me at it. It's definitely something we need to do, but all of the name changes won't happen in the next month or so given other things going on internally that are more urgent related to supporting other teams and getting things in order for open-sourcing the stdlib.

JoeLoser avatar Feb 21 '24 18:02 JoeLoser

@JoeLoser As part of the rename, may I suggest also renaming CollectionElement to CollectionItem? This would improve consistency with the getitem, setitem, and delitem dunder methods which currently manipulate "Elements" despite their name implying that they manipulate "Items".

As a separate issue, the type parameter of DynamicVector (and related types) should probably be named Item instead of T, since that is more descriptive/self-documenting.

nmsmith avatar Mar 06 '24 02:03 nmsmith

Now the DynamicVector is gone, what about

  • InlinedFixedVector: maybe InlinedList following InlinedString which is string with SSO
  • StaticTuple: clearly an array, even the IR says so. Can we graduate it into collections.array?
  • StaticIntTuple, do we still need this?

soraros avatar Apr 06 '24 19:04 soraros