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

Allow undefined set member to require a minimum number of objects #58

Open
heinezen opened this issue Sep 24, 2018 · 1 comment
Open
Labels
proposal pending discussion about something to do specification involves the nyan language specification

Comments

@heinezen
Copy link
Member

heinezen commented Sep 24, 2018

Currently all sets can be initialized as empty which is not always desirable. It should be possible to require a minimum number of elements that have to be defined by the non-abstract set. This could proof useful for cases where at least one object is expected to be present. For example, a set is supposed to contain a number of animations of which the engine selects one randomly. If the set is initiliazed with no animations present, the mechanic doesn't work.

Possible solution:

AnimatedAbility(Ability):
    animations : set(Animation, 1)

The 1 denotes that at least one object is required on the set's initilization. Also set(Animation, 0) would be the same as set(Animation). The requirement would only be relevant for the initilization. Patches could still make the set be empty.

@heinezen heinezen added specification involves the nyan language specification proposal pending discussion about something to do labels Sep 24, 2018
@TheJJ
Copy link
Member

TheJJ commented Oct 4, 2018

Makes sense, although I'd go for something like set(type, min_size=123) so it's more future-proof and extensible.

@TheJJ TheJJ changed the title Allow undefined set member to require a minimum number of objects Restrict set to only allow child values of a type Jun 4, 2019
@TheJJ TheJJ changed the title Restrict set to only allow child values of a type Allow undefined set member to require a minimum number of objects Jun 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal pending discussion about something to do specification involves the nyan language specification
Projects
None yet
Development

No branches or pull requests

2 participants