fmease / lushui

The reference compiler of the Lushui programming language
Apache License 2.0
7 stars 0 forks source link

Raw identifier syntax #58

Open fmease opened 3 years ago

fmease commented 3 years ago

Meta: Task: Flesh out description.

An alternative syntax for writing (general) identifiers to "escape reserved (general) identifiers". Syntax is not fixed. Early ideas: I"data", 'data (using ' might not work anymore if we are going to use it as the implicitness marker as the replacement for , of today), `data (maybe we want to use ` for splicing (macros)). Let's use ` here.

`+=> would be the same as just +=>, same with `thing and thing. On the other hand, `: would be a plain (general) identifier/punctuation and not the reserved punctuation Colon. Similarly, `module would be a plain identifier and not a keyword.

A related goal would be to allow more keywords and reserved punctuation in places they would be syntactically illegal anyway. This would allow people to omit the leading back tick in more/most places. That change would only make sense though together with this proposal (raw identifier syntax) since we'd like to be able to refer to some binding bound by a raw identifier from any place. One big downside of contextual keywords is forward incompatibility in the sense that we might not be able to re-use a keyword in a new place to introduce new language features.

Motivation: Reserved (general) identifiers take away naming choices. With this (and especially the proposal of more contextual keywords), we could restore it by some amount.

Priority: Very low