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

Add support for sets #4437

Open
jordanbrown0 opened this issue Dec 6, 2022 · 2 comments
Open

Add support for sets #4437

jordanbrown0 opened this issue Dec 6, 2022 · 2 comments

Comments

@jordanbrown0
Copy link
Contributor

There was a discussion over in #4301 about the value of bitmasks.

It seems to me that bitmasks are often the poor man's way to implement sets. Perhaps we should have real sets, that you can union, intersect, difference, iterate, et cetera.

I don't know what the syntax would look like, especially when you consider object literals and their friends. If object literals end up JavaScript style:

o = { a: 1, b: 2 };

then perhaps a name without a value would mean a set member:

o = { flag1, flag2 };

This might be syntactic sugar that just makes those be boolean members with values of true, which would also allow you to say

if (o.flag1) ...

Or maybe object literals are enough:

o = { flag1: true, flag2: true };
@endrift
Copy link

endrift commented Dec 7, 2022

Is this the same as #4203? Or subtly different?

@jordanbrown0
Copy link
Contributor Author

#4203 is probably being subsumed under #3088, which will probably cover #4294 too.

It may be that sets will be a special case of objects/dictionaries/associative-arrays. You want to ensure that set support has all of the features that you might expect. An object with members set to boolean true behaves a lot like a set, in that you can say if (o.flag), but you want to also make sure that you have intersection, difference, union, et cetera. Some of those might be covered by #4337, which is a general object-manipulation function, but we'd need to look.

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

No branches or pull requests

2 participants