Skip to content
Discussion options

You must be logged in to vote

Yes. There are potentially some circumstances where this would be better in some metrics. For example, you might imagine an impl that special cases read-only lists of small sizes, inlining the elements directly into the result. This would be lower in size than an IMmutableArray.

That said, IMO, ImmutableArray would likely still be better in other ways. For example, accessing elements happens without the need for interface dispatch with an ImmutableArray.

Overall though, the point is that you choose the right type for your case, and we pick the right impl and construction strategy, so you don't have to.

Note: IREadOnlyList is also superior if you want the flexibility to change out the impl…

Replies: 3 comments 13 replies

Comment options

You must be logged in to vote
7 replies
@jnm2
Comment options

jnm2 Aug 20, 2023
Collaborator

@sab39
Comment options

@CyrusNajmabadi
Comment options

@FaustVX
Comment options

@CyrusNajmabadi
Comment options

Answer selected by jnm2
Comment options

You must be logged in to vote
5 replies
@mungojam
Comment options

@mungojam
Comment options

@CyrusNajmabadi
Comment options

@jnm2
Comment options

jnm2 Aug 19, 2023
Collaborator

@jnm2
Comment options

jnm2 Aug 19, 2023
Collaborator

Comment options

You must be logged in to vote
1 reply
@jnm2
Comment options

jnm2 Aug 19, 2023
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
6 participants