Remove backtick literals #34
Replies: 2 comments 4 replies
-
I think we can not drop literals completely, because that would lead to conflicts.
The first first is a multi-select hash where the value for the key Droping literals would not allow to express the second expression. |
Beta Was this translation helpful? Give feedback.
-
For reference, let me include a reference to JEP 6 that explicitly explains the rationale against supporting numeric identifiers. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
@springcomp suggested adding support to the grammar for unquoted number literals:
3.2
vs`3.2`
.This may be a good idea, but we need to consider the consequences.
With unquoted number literals, raw-string literals, multi-select-hash, and multi-select-list, what would be the remaining purpose of literal in the grammar?
true
,false
, andnull
only?Additionally, this may also conflict with the possibility of allowing numeric identifiers:
Given
{"foo":{"1":"a"}}
it would be consistent and convenient to allow for the pathfoo.1
orfoo | 1
to access the value 'a'.I recently encountered a desire for this behaviour and had to opt for
foo."1"
with the current grammar.I think there would be real value to completely remove literal from the grammar. Making
true
,false
, andnull
unquoted values.true
,false
, andnull
are unlikely to occur as identifiers and we can fall back to quoted-strings in the event that they do occur.Beta Was this translation helpful? Give feedback.
All reactions