Skip to content

Request for an Unmodifiable Set #24652

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

Closed
sethladd opened this issue Oct 20, 2015 · 6 comments
Closed

Request for an Unmodifiable Set #24652

sethladd opened this issue Oct 20, 2015 · 6 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. type-enhancement A request for a change that isn't a bug

Comments

@sethladd
Copy link
Contributor

I see an unmodifiable list view and map view in dart:collection, but didn't find an unmodifiable set view. Do we have something like that? If not, could we consider adding it?

(request from customer)

@sethladd sethladd added Type-Enhancement area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. labels Oct 20, 2015
@zoechi
Copy link
Contributor

zoechi commented Oct 20, 2015

I usually use UnmodifiableListView for sets but a real UnmodifiableSetView would be nice to make it more clear for the user of the API what is actually returned.

@lrhn
Copy link
Member

lrhn commented Oct 21, 2015

You can use the one in package:collection (http://www.dartdocs.org/documentation/collection/1.1.3/index.html#collection/dart:pkg-collection-wrappers.UnmodifiableSetView).
We have unmodifiable list and map mainly because we have list and map literals and several instances of API that returns unmodifiable lists or maps (e.g., Invocation). Unmodifiable sets are much more rare.

@sethladd
Copy link
Contributor Author

Thanks for the follow up! I understand that we want to work towards smaller core libraries, and that some functionality will be in packages.

cc @Hixie

@Hixie
Copy link
Contributor

Hixie commented Oct 21, 2015

We should have set literals also. There are places in Flutter's codebase right now where we're working around the lack of Set literals, FWIW.

@sethladd
Copy link
Contributor Author

See: #3792

@Hixie
Copy link
Contributor

Hixie commented Oct 21, 2015

Right. I'm just saying that if the argument is that we shouldn't have an UnmodifiableSet because we don't have a Set literal, that that's fine, since we should have a Set literal anyway. :-)

@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed type-enhancement labels Mar 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

5 participants