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

Forbid "?" in the identifier #65

Closed
zbraniecki opened this issue Nov 9, 2017 · 2 comments
Closed

Forbid "?" in the identifier #65

zbraniecki opened this issue Nov 9, 2017 · 2 comments
Milestone

Comments

@zbraniecki
Copy link
Collaborator

As per Stas' request in projectfluent/fluent.js#84 (comment)

This is one of those things that I don't think developers will actively ask us to introduce but they might
appreciate it if it's there. If you feel strongly about forbidding the question mark (at least right now) and my
above arguments haven't convinced you otherwise, please file a new issue in the Fluent Syntax repo.

I am not convinced and I would see a value in not adding this sygil at this point.

My reasoning boils down to two items:

  1. I think of l10n-id as an identifier, not a quasi representation of the english sentence (much like Axel's point in the linked discussion). Dashes stretch it, question mark breaks it.
  2. Adding sygils is irreverisble and in result should be avoided when possible. There's no request for it, there's no parity with other systems issue, there's no prior experience of people using such a thing and overall, trying to convey the role of the phrase in via the "?" in the ID seems to me like a misplaced goal.

I'd love to use as few sygils in the ID as possible and the [a-Z_-0-9] is imho the far end of what we should start with.

@stasm
Copy link
Contributor

stasm commented Nov 9, 2017

For posterity, I'm pasting my argument for allowing the question mark. The previous discussion about this was in #49.

This is not about using English punctuation in identifiers but rather about communicating the role of the message better. Software inherently ends up asking questions via the UI. Allowing the question mark in identifiers makes it easier to communicate the intent without thinking too much about naming conflicts.

Instead of using longer ids like delete-all-prompt or delete-all-confirm, it allows for this:

delete-all? = Really delete all files?
delete-all = Yes, delete all files.

For this reason, question mark is in fact a valid character in identifiers in many languages. I know of at least Clojure, Elixir, Ruby and Scala that allow it.

We've also seen developers use the question mark in Gaia. I found examples similar to the following one in the localizations of the Camera, Dialer, Gallery, and Videos apps:

delete-photo? = Delete photo?
delete-video? = Delete video?

@stasm
Copy link
Contributor

stasm commented Nov 9, 2017

Since we can always allow ? in identifiers if no other use for it is found in the future, let's forbid it for now. I'd like to revisit this decision post-1.0 after we've gathered feedback more from developers.

@stasm stasm added this to the Syntax 0.4 milestone Nov 9, 2017
stasm added a commit to stasm/fluent that referenced this issue Nov 10, 2017
We're going back on this.  Let's start without it and revisit post-1.0.
@stasm stasm added the syntax label Nov 10, 2017
@stasm stasm closed this as completed in #66 Nov 14, 2017
stasm added a commit that referenced this issue Nov 14, 2017
Let's start without it and revisit post-1.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants