Skip to content

Commit

Permalink
First pass at #453 (text-based syntaxes should be designed for humans)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeaVerou committed Feb 1, 2024
1 parent c28ea64 commit 8d2f183
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,31 @@ that authors can use to extend the language
without breaking future native functionality,
to reduce such dilemmas in the future.

<h3 id="text-based-syntaxes">Design text-based syntax with humans in mind</h3>

When designing a text-based syntax, consider human usability and readability,
even when you expect the syntax to be primarily generated by tooling.

Historically, every syntax that could be read by humans, inevitably ended up being authored by humans too.
Even when syntax is primarily authored by tools,
it is still effectively authored by humans: the tool developers.
Therefore, optimizing it for human usability also makes it easier to develop tools to generate it.

Human usability may often be at odds with parsing performance and filesize efficiency.
Ideally, the syntax would be optimized for human usability, and tooling would optimize the syntax for efficiency.
However, this is not always possible.
In these cases, explore if it is possible to provide syntax that is flexible enough to accommodate both use cases.
The downside of this approach is that it increases the complexity of the language, and humans may still need to read the less human-friendly syntax.
Lastly, if efficiency is truly critical, consider whether a binary format may be more appropriate.

<div class="example">
SVG path syntax was designed to be terse and efficient,
as it was assumed it would primarily be generated by tooling.
While this assumption was correct for many use cases,
humans *do* hand author SVG paths for a variety of reasons,
and the experience can be quite painful.
</div>

<h2 id="html">HTML</h2>

This section details design principles for features which are exposed via HTML.
Expand Down

0 comments on commit 8d2f183

Please sign in to comment.