Skip to content

should we disallow all Unicode control characters in character literals? #5962

@zygoloid

Description

@zygoloid

Summary of issue:

Per #1964, we disallow the control characters U+0000 - U+001F from appearing directly as the contents of a character literal, and require an escape sequence to be used instead. However, we don't apply the same restriction to the other Unicode control characters U+007F - U+009F. Should we?

Details:

I think the reason we chose to reject these characters was to ensure that character literals are readable; we might want to exclude other kinds of non-printable or invisible characters here too if that is the rationale. Another question to consider is whether we want consistent restrictions between character and string literals. There might be an argument for not using the same restrictions for things like LTR markers, where a matched set in a string literal might be reasonable but a lone marker in a character literal might not.

Any other information that you want to share?

#5960 makes the toolchain reject both kinds of control character.

Metadata

Metadata

Assignees

No one assigned

    Labels

    leads questionA question for the leads team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions