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

Commas #71

Closed
MaanooAk opened this issue Oct 5, 2019 · 3 comments
Closed

Commas #71

MaanooAk opened this issue Oct 5, 2019 · 3 comments
Labels
c++ involves C++ code nice new thing ☺ adds new functionality specification involves the nyan language specification

Comments

@MaanooAk
Copy link
Contributor

MaanooAk commented Oct 5, 2019

Commas between a collection elements and parents are not needed in order for the nyan to be interpreted. So they could be optional.

LeggedCombineCitadel(Building, Unit):
    hp = 1000
    creates = {OverwatchSoldier, Strider}

LeggedCombineCitadel(Building, Unit):
    hp = 1000
    creates = { OverwatchSoldier Strider }

LeggedCombineCitadel ( Building Unit ) :
    hp = 1000
    creates = { OverwatchSoldier Strider }

It looks weird but why not...

@TheJJ TheJJ added c++ involves C++ code nice new thing ☺ adds new functionality specification involves the nyan language specification labels Oct 5, 2019
@TheJJ
Copy link
Member

TheJJ commented Oct 5, 2019

I've done it the same way Python formats sets, but you are right, it would still be valid.
If we add this feature, the parser should enforce one valid style per set: Within one set either all commas must be there, or none.

I'm not sure though if leaving out commas makes usage easier here, but I guess for non-programmers it could be good.

@heinezen
Copy link
Member

heinezen commented Oct 6, 2019

Not sure about this because it could lead to more semantic errors being made.

Barracks(Building):
    hp = 1000
    creates = { CavalryArcher }

and

Barracks(Building):
    hp = 1000
    creates = { Cavalry Archer }

would both be valid syntax and if there's a mistake here, it's easy to overlook. The commas somewhat mitigate this.

Also, I guess that having two possible styles is a bit irritating for modders or non-programmers.

@TheJJ
Copy link
Member

TheJJ commented Dec 13, 2020

I think we should try to be compatible to the python/c++ syntax, so I'll close this proposal for now.
We can reconsider of course if we discover this (or a variation) is needed again.

@TheJJ TheJJ closed this as completed Dec 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ involves C++ code nice new thing ☺ adds new functionality specification involves the nyan language specification
Projects
None yet
Development

No branches or pull requests

3 participants