Skip to content
This repository has been archived by the owner on Jan 16, 2021. It is now read-only.

Improvement: A style guide? #11

Open
TheV360 opened this issue Dec 9, 2018 · 4 comments
Open

Improvement: A style guide? #11

TheV360 opened this issue Dec 9, 2018 · 4 comments

Comments

@TheV360
Copy link
Contributor

TheV360 commented Dec 9, 2018

Stuff like this should be included:

  • What order should commands be in? (Manual, Normal then OUT variation, or number of arguments?)
  • When should we use abbreviations? (initialisms if you're pedantic)
    • Should the RNG directory be renamed Random?
    • Should the GRP directory be renamed Graphics?
  • Should an initial 3.0.0 state be listed, even if there's no errors in it?
@12Me21
Copy link
Collaborator

12Me21 commented Dec 9, 2018

  • use order from https://smilebasicsource.com/page?pid=993 probably
  • I think we should avoid that
    • yes
    • maybe (but then we need a way to distinguish between Graphics (including sprites etc.) and GRP)
  • probably not

@TheV360
Copy link
Contributor Author

TheV360 commented Dec 9, 2018

Additional stuff, now more about personal preference:

  • If a command's OUTput is just its parameters, should the table describing the parameters be combined with the output table? Like so:
Parameters/OutputDescription
minecraft%output to minecraft world enabled. can be true or false
  • In examples, should it be &h or &H? &h looks better in my opinion (hex digits must always be capitalized, like &hFF1F3F7F)
  • DIM or VAR in examples?
  • Extra whitespace in examples?
    • FOR I=0 TO 9 or FOR I = 0 TO 9
    • 'Comment or ' Comment

edit:

  • What kind of whitespace used to indent?
    • Tabs (correct answer) or spaces?
    • Should we use tabs in SmileBASIC code, then change the tab size with CSS when the site is made?

@12Me21
Copy link
Collaborator

12Me21 commented Dec 9, 2018

  • I combined the tables but inserted a second header row to separate them:
    ... (I was going to put an example but I don't actually remember how markdown tables work lol)
  • &h is easier to read, so it's probably better (though lowercase in SB is a bit weird)
    Hex constants will probably be pretty rare, though. They aren't particularly useful...
    For things like bit fields, it's better to use binary or decimal (I'd much rather see 64 or &b100000 than &h40 (I actually had to get out a calculator to check that lol))
  • DIM for arrays, VAR for other variables
  • I'm not sure. If we end up using the SB font, definitely no whitespace. But with standard fonts (where chars are much narrower than in SB) extra whitespace might be a good idea.
  • CSS tab-size was just implemented in 2019 so most browsers don't support it yet. There might be alternative solutions but for now just use spaces in SB code.

@y-ack
Copy link
Owner

y-ack commented Dec 9, 2018

What order should commands be in?

If you mean in lists, manual order as much as makes sense because it generally lists them in the order you would look for first.
If you mean in command syntax:
The order from https://smilebasicsource.com/page?pid=993
ONLY list an OUT form. The examples and page on functions will make it clear that single-return can be called as functions, and we use OUT to generate full combinations of arguments

When should we use abbreviations? (initialisms if you're pedantic)

Where SB does. GRP and BG are allowed, as well as DLC. RNG should be Random probably

Should an initial 3.0.0 state be listed, even if there's no errors in it?

no

If a command's OUTput is just its parameters, should the table describing the parameters be combined with the output table?

handle this as 12 recommended:

| Parameters | Description |
|-+-|
| A | new value for A |
| Output | Description |
|-+-|
| A | current A value |

In examples, should it be &h or &H? &h looks better in my opinion

&h for readabilty

DIM or VAR in examples?

DIM for arrays, VAR for scalar variables.

Extra whitespace in examples?

need to do a better evaluation maybe. For now no.

What kind of whitespace used to indent?

This is answered in CONTRIBUTING.org: Tabs don't work in SmileBASIC; Use two spaces for indentation.

EDIT:
I'm busy with things but if you want to come up with a style guidelines page it's a good idea

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

No branches or pull requests

3 participants