rhaiscript / book

The Rhai Book.
https://rhai.rs/book
22 stars 22 forks source link

Add a FAQ page #23

Open C-Ezra-M opened 1 year ago

C-Ezra-M commented 1 year ago

Having a FAQ page makes it easy for people to answer their common Rhai why's. The structure should at least partially replicate that of the Python FAQ.

An example question for the design section could look like this:

Why does Rhai require semicolons?

You probably can expect us to not enforce semicolons at the end of every statement, but the Rhai designer decided not to for two reasons:

  1. To prevent scripts from breaking when you omitted a semicolon between two statements that would otherwise be one statement. Rhai wouldn't be alone in this regard because of JavaScript, which has a mechanism called ASI that is only designed to insert semicolons where they are normally required. That's why several style guides, such as Airbnb's one, enforce semicolons.
  2. No consensus on ASI or on Ruby-like handling. Neither way is simple enough to be implemented in Rhai's handwritten lexer.
schungx commented 1 year ago

An FAQ would be a great idea, but it would require at least a number of items to start off with... an FAQ with only one item would look quite silly. Would you be interested to start a draft version off?