Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text formats are for people #505

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,58 @@ See also:
* [[#secure-context]]
* [[#consent]]

<h3 id=text-formats>Design textual formats for people</h3>
martinthomson marked this conversation as resolved.
Show resolved Hide resolved

Design textual formats that can be easily produced and consumed by people.

martinthomson marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Textual formats also improve [transparency](https://www.w3.org/TR/ethical-web-principles/#transparent).

Favor readability over compactness.
martinthomson marked this conversation as resolved.
Show resolved Hide resolved
File size can be optimized by tooling,
and tends to become a lower priority over time.
When file size is a significantly higher priority,
perhaps a textual format is not appropriate.

<div class=example>
SVG path syntax was designed to be compact,
with single-letter commands and unlabeled series of coordinates after them.
At the time, file size was a primary concern,
but while the importance of this has changed over time,
LeaVerou marked this conversation as resolved.
Show resolved Hide resolved
the cost to human readability has remained the same.
</div>

People who are presented with a textual format
martinthomson marked this conversation as resolved.
Show resolved Hide resolved
should be able to use a text editor
to easily produce or modify content.
People who edit text will introduce a range of errors, but
could struggle to identify and fix those errors.

People expect some amount of flexibility in terms of how their edits are processed.
Allowing flexibility in whitespace, quoting, delimiters, and other syntactic elements ensures
that content is still comprehensible.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not about comprehensibility, but ease of editing / error prevention.

Might be good to link to the robustness principle somewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I literally wrote an RFC that says that the robustness principle harms interoperability: https://www.rfc-editor.org/rfc/rfc9413.html

I have friends who like to troll me with the phrase "Postel was wrong", but I'm guessing that didn't know :)

Either way, I think that this would be a mistake for the reasons stated in that document (see this bit). I think that your point about this being an example is a good one though. I've suggested something below.

Comment on lines +614 to +616
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
People expect some amount of flexibility in terms of how their edits are processed.
Allowing flexibility in whitespace, quoting, delimiters, and other syntactic elements ensures
that content is still comprehensible.
Syntactic [robustness](https://en.wikipedia.org/wiki/Robustness_principle)
typically improves the usability of textual formats.
If user intent is unambiguous, flexibility in whitespace, quoting, delimiters, and other syntactic elements
makes the syntax less error-prone and creates a more pleasant editing experience.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
People expect some amount of flexibility in terms of how their edits are processed.
Allowing flexibility in whitespace, quoting, delimiters, and other syntactic elements ensures
that content is still comprehensible.
People expect some amount of flexibility in terms of how their edits are processed.
Clearly defining syntactic flexibility--
such as in white space, quoting, or delimiters--
could ensure that content is both easy to edit and produces consistent results.


<div class=example>
The JSON format is an example of a format that appears to be flexible,
but it lacks many of these basic usability amenities.
In JSON there is:
no commenting capability,
objects and arrays cannot have trailing commas, and
quotes are mandatory for object keys.
This makes JSON prone to syntactic errors as a result of manual edits.
</div>

Containing the scope of a format that is affected by a syntax error
could improve robustness and human usability.
This requires that specifications fully define processing and
error handling rules so that errors are handled in the same way.
LeaVerou marked this conversation as resolved.
Show resolved Hide resolved

<div class=example>
Typos in CSS properties only cause that property to be ignored.
Errors in properties rarely cause an entire rule to be lost.
</div>

If your format is intended to be used only by machines,
a binary format is likely to be more efficient,
in addition to discouraging people from authoring or editing content.

<h3 id="secure-context">Consider limiting new features to secure contexts</h3>

Always limit your feature to secure contexts
Expand Down