Make reserved keywords escapeable #1642
dennisschroeder
started this conversation in
Ideas & suggestions
Replies: 2 comments
-
If the call is no, I would love to have a definite list of all keywords not available for various purposes (like labels or fields) - would that be possible? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Kotlin uses backticks: fun `fun`() = "Very fun"
fun `this is also a function name`() = "Hello world" Rust uses a struct r#for {
r#while: r#in,
} Note that Kotlin allows special characters (like whitespace and punctuation) in identifiers, but Rust does not. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Right now, it is not possible to declare custom types where field names match a keyword.
Example:
The compiler will respond with a
syntax error
becausetype
is a reserved keyword in gleam.One solution could be to mark those keywords with single quotes
'type'
, since they have no special meaning in gleam, as far as I know.What do you think about this?
Beta Was this translation helpful? Give feedback.
All reactions