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

General - Make type syntax in header more consistent #10681

Open
wants to merge 27 commits into
base: master
Choose a base branch
from

Conversation

Timi007
Copy link
Contributor

@Timi007 Timi007 commented Jan 20, 2025

When merged this pull request will:

  • Make type syntax in header more consitent
  • Make all types UPPERCASE
  • Append lowercase s for plural of type
  • Use or for multiple options
  • Unify types (e.g., BOOLEAN -> BOOL, POSITION -> ARRAY)
  • Unify optional argument syntax
  • Fix some spelling
  • Replace <OPTIONAL> with (default: ...)
  • Move (default: ...) after <TYPE>
  • Improve validation of argument type for documentation

IMPORTANT

  • If the contribution affects the documentation, please include your changes in this pull request so the documentation will appear on the website.
  • Development Guidelines are read, understood and applied.
  • Title of this PR uses our standard template Component - Add|Fix|Improve|Change|Make|Remove {changes}.

Discussion

Nested types

Currently, there are two syntax versions of how the types inside an array are represented:

  1. ARRAY<NUMBER>, ARRAY<ARRAY<OBJECT, NUMBER>>
  2. ARRAY of ARRAYs of OBJECTs and NUMBERs
    Which syntax should be used?

Enclosure

Furthermore, should each type be enclosed in their own <TYPE> when multiple types are an options?

  1. <CODE or STRING>
  2. <CODE> or <STRING>

Plural

Should types be pluralized? If so, how?

  1. No plural: <ARRAY of NUMBER>
  2. Plural, lowercase s: <ARRAY of NUMBERs>
  3. Plural, uppercase S: <ARRAY of NUMBERS>

@Andx667
Copy link
Contributor

Andx667 commented Jan 21, 2025

My thoughts on the discussion:

Nested types
ARRAY<NUMBER>, ARRAY<ARRAY<OBJECT, NUMBER>> seems precise and unambiguous to me.

Enclosure
<CODE> or <STRING> is my favorite here. It's consistent with the other types because its always <type> not < something or something>

Plural
I'm kinda torn on this. Keeping with the consistency argument from before I would choose no plural. But I feel that the added s make it's a lot more clear what is meant.

No plural: <ARRAY of NUMBER>

Plural, uppercase S: <ARRAY of NUMBERS>

@BaerMitUmlaut BaerMitUmlaut changed the title General - Make type syntax in header more consitent General - Make type syntax in header more consistent Feb 10, 2025
@BaerMitUmlaut BaerMitUmlaut added the ignore-changelog Release Notes: Excluded label Feb 10, 2025
Copy link
Contributor

@johnb432 johnb432 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this, I'm glad someone had the courage to do it.

@@ -6,11 +6,12 @@
* Arguments:
* 0: Position ASL <ARRAY>
* 1: Vector dir and up <ARRAY>
* 2: Colour of the tag (valid colours are black, red, green and blue or full path to custom texture) <STRING>
* 2: Color of the tag (valid colors are black, red, green and blue or full path to custom texture) <STRING>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imo, the spelling changes should be reverted, we use both American and British spelling in ACE.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a code spell checker enabled in VS Code that is set to American English. So I briefly went over all the warnings of the spell checker. Why not just specify and set it to either American English or British English? This way, we can maybe add the Code Spell Checker to the VS Code recommended extensions and have fewer overall spelling mistakes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do agree with you. However, not everyone uses VS Code (such as myself), but that's a relatively small issue.
We need to discuss it internally to find out which English is preferred - I just didn't want to alienate anyone by choosing a specific version, but the benefits outweigh the drawbacks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be possible to add words to dictionary
maybe in the .vcode/settings.json?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

American English is the standard that we have chosen to go with.

@johnb432
Copy link
Contributor

Discussion

[...]

For me:

  1. ARRAY<NUMBER>, ARRAY<ARRAY<OBJECT, NUMBER>>
  2. <CODE or STRING>
  3. Plural, lowercase s: <ARRAY of NUMBERs>

@TheCandianVendingMachine
Copy link
Contributor

Would you be willing to add this standardization to our coding guidelines wiki page? Probably in section 3.2; enumerating the allowed types, specifying how to do optional arguments, etc.. Currently the page has some examples, but it isn't spanning, and a concrete ruleset would probably clear things up (I know I would like this).

Copy link
Contributor

@TheCandianVendingMachine TheCandianVendingMachine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for bikeshedding a bit. imo, we should specify subtypes of posASL/AGL/ATL/2d but I am fine without

@@ -4,7 +4,7 @@
* Garrison function used to garrison AI inside buildings.
*
* Arguments:
* 0: The building(s) nearest this position are used <POSITION>
* 0: The building(s) nearest this position are used <ARRAY>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldnt ARRAY of NUMBERs be more consistent?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I think about it, I would interpret <ARRAY of NUMBERs> as a list consisting of any amount of numbers. <ARRAY> would be generic. Technically, we would need to write <ARRAY<NUMBER, NUMBER, NUMBER>> for a 3D position or an array containing exactly 3 numbers. I don't know what the best solution here would be.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think position is better than array, the biwiki uses position, and even specifies which kind (ASL, ATL)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 0: The building(s) nearest this position are used <ARRAY>
* 0: The building(s) nearest this position are used <POSITION>

@Timi007
Copy link
Contributor Author

Timi007 commented Mar 5, 2025

sorry for bikeshedding a bit. imo, we should specify subtypes of posASL/AGL/ATL/2d but I am fine without

IMO, the subtype should be specified in the argument description. But I'm open to accept using the Position subtypes instead of <ARRAY>.

@johnb432
Copy link
Contributor

johnb432 commented Mar 6, 2025

sorry for bikeshedding a bit. imo, we should specify subtypes of posASL/AGL/ATL/2d but I am fine without

IMO, the subtype should be specified in the argument description. But I'm open to accept using the Position subtypes instead of <ARRAY>.

I also think they should be part of the description.

@TheCandianVendingMachine
Copy link
Contributor

It seems like most people who answered are for the position types, so I think changing it to them would be ideal. Not blocking, but if it doesn't make much labour I think it's worth while

@@ -5,7 +5,7 @@
*
* Arguments:
* 0: Module logic <OBJECT>
* 1: Position of the module <POSITION>
* 1: Position of the module <ARRAY>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 1: Position of the module <ARRAY>
* 1: Position of the module <POSITION>

@@ -5,7 +5,7 @@
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Position to place explosive <POSITION>
* 1: Position to place explosive <ARRAY>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 1: Position to place explosive <ARRAY>
* 1: Position to place explosive <POSITION>

* 0: Unit needing to be placed <UNIT>
* 1: Position the unit need to be placed at <POSITION>
* 0: Unit needing to be placed <OBJECT>
* 1: Position the unit need to be placed at <ARRAY>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 1: Position the unit need to be placed at <ARRAY>
* 1: Position the unit need to be placed at <POSITION>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these are the only 4 changes to revert and then we can merge it

@PabstMirror PabstMirror added this to the 3.19.3 milestone Mar 22, 2025
@Timi007
Copy link
Contributor Author

Timi007 commented Mar 25, 2025

If we introduce now a position type, how should it be written? I wish GitHub had a poll feature. Could you please vote with reactions? Multiple votes allowed.

  1. ❤️ Just <POSITION> and the subtype e.g., ATL should be specified in the description
  2. 🚀 <POSITION3D>, <POSITION2D>, <POSITIONAGL>, <POSITIONASL>, <POSITIONATL>, <POSITIONWORLD>, <POSITIONRELATIVE>
  3. 👀 <POS3D>, <POS2D>, <POSAGL>, <POSASL>, <POSATL>, <POSWORLD>, <POSREL>

@DartRuffian
Copy link
Contributor

Feels weird to have POSITION in the brackets, since it's not a type. Fwiw, I've always done: 0: Position format ASL <ARRAY> in my own projects. The type is still an array, making it POSITION doesn't make sense IMO. Same logic as doing 0: Unit <OBJECT> and not 0: Something <UNIT>.

@Timi007
Copy link
Contributor Author

Timi007 commented Mar 25, 2025

Feels weird to have POSITION in the brackets, since it's not a type. Fwiw, I've always done: 0: Position format ASL <ARRAY> in my own projects. The type is still an array, making it POSITION doesn't make sense IMO. Same logic as doing 0: Unit <OBJECT> and not 0: Something <UNIT>.

We had this discussion a few comments above.

Since I'm unsure what the majority now wants, here's another poll. Multiple votes allowed.

  1. 👎 Position arguments should have type <ARRAY>. The details about the position subtype (e.g., ATL) should be in the description.
  2. 👍 Use own type for positions (see other poll)

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

Successfully merging this pull request may close these issues.

8 participants