Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Alias/let syntax interpretation and use #687

Answered by mpvl
extemporalgenome asked this question in Q&A
Discussion options

You must be logged in to vote

The purpose of the X in X="not an identifier": 4 is that it allows referencing the field. The field has a name that is not a valid identifier, so there would otherwise be no way to directly reference the field. For instance, the foo: X references that field and will evaluate to foo: "not an identifier": 4.

A let introduces a name for an expression that can be reused without it being part of the output.
So, where:

X=a: 4
b: X

would evaluate to

a: 4
b: 4

using a let

let X = 4
b: 4

evaluates to

b: 4

instead.

In general if you see a X = it introduces a new name for the element it precedes, without otherwise changing the meaning of this element. It can be used to work around a host of iss…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by extemporalgenome
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants