yujiri.xyz

Software

Braceless body in semicolon languages is bad design

In C, Javascript, Zig, conditions of `if` and `while` statements always have to be wrapped in parentheses, while in Rust and Go, they don't. It's because in C, Javascript and Zig, the *body* of such a statement *doesn't* have to be wrapped in braces, if it's only one line, and there has to be a way for the parser to tell the separation between condition and body. In these languages the syntax is: `if (expression) body`, while in Rust and Go the syntax is `if expression { body }`.

What Rust and Go do here is better, for two reasons:

contact

subscribe via RSS

Proxied content from gemini://yujiri.xyz/software/braceless-body.gmi

Gemini request details:

Original URL
gemini://yujiri.xyz/software/braceless-body.gmi
Status code
Success
Meta
text/gemini; lang=en
Proxied by
kineto

Be advised that no attempt was made to verify the remote SSL certificate.

What is Gemini?