Skip to content

Commit

Permalink
docs: unify section structure (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
serkonda7 authored Jan 29, 2025
1 parent cf489b3 commit 38aab81
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions docs/design/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,22 @@ Why is the syntax the way it is?


## No Block Comments
Bait does not support block comments:
- Complicates lexing and parsing, especially nested block comments
- Hard to format, especially inline comments _(a built-in formatter is planned)_
Bait only supports line comments (`//`) and _no_ block comments (`/* */`).

Using a decent editor with line wrapping and shortcuts,
you can achieve almost the same level of convenience!
### Benefits
- **Simpler lexing parsing**: Nested block comments are somewhat complicated
- **Improved Readability**: Line comments are unlikely to disrupt the visual flow of code
- **Code is easily formattable**

### Drawbacks
- Hard to comment larger passages
- Potentially long comment lines

For details, I recommend reading https://futhark-lang.org/blog/2017-10-10-block-comments-are-a-bad-idea.html.
### Mitigation
Modern editors and IDEs support line wrapping and shortcuts for (un)commenting.

### References
- https://futhark-lang.org/blog/2017-10-10-block-comments-are-a-bad-idea.html.


## Casting: `val as Type`
Expand All @@ -31,7 +39,7 @@ For details, I recommend reading https://futhark-lang.org/blog/2017-10-10-block-

### References
- [Discord: Thoughts by @zeozeozeo](https://discord.com/channels/1204569231992295494/1204741190432325652/1302526862982905866)
- [soc.me: `ident: Type` over `Type ident`](https://soc.me/languages/type-annotations)
- https://soc.me/languages/type-annotations


## Static Variables
Expand Down

0 comments on commit 38aab81

Please sign in to comment.