-
Notifications
You must be signed in to change notification settings - Fork 30
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
feat: IListEmpty and friends #76
feat: IListEmpty and friends #76
Conversation
I've just added the other Empty types aswell, do you have some suggestion what i could add to the current tests? @marcglasberg |
Two things: /// An empty list is always empty, by definition
@override
bool get isEmpty => true;
/// An empty list is always empty, by definition
@override
bool get isNotEmpty => false; Do you think we should discourage or even disallow instantiating the IListEmpty directly instead of using IList.empty()? var ilist1 = IList.empty() // is of type IList
var ilist2 = IListEmpty() // is of type IListEmpty I do not see the benefit of having a variable of type FooEmpty, users will always want to reassign the list if they declare an empty ilist right? |
Yes, you should override all methods that now have trivial implementations, including isEmpty etc. This will make it faster. And I also see no point in instantiating |
What do you think can we do to discourage instantiating IListEmpty()? We could make the constructors private |
Yes, sure, make them private. |
I did all the changes we've discussed, you can merge now if you want |
Thanks. |
Fix for #75