Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add support for recording fixity in quoted literals #680
Add support for recording fixity in quoted literals
With the current quotation literal support various information is lost in the encoding process, this information can be very useful to library implementors especially when using quotations a meta language.
In an example the following literal:
is encoded as:
And the following
is encoded to the same expression tree
The loss of fixity information in quoted literals is not ideal if you are using meta programming which may have parity with encoding quoted expressions from a functional point of view e.g custom operator and infix/prefix function usage.
I realise that the purpose of the quotation mechanism is to reuse alternative execution machinery unrelated to F# but in recent years with the advent of type providers quotations are used in a different fashion to the original implementation described in the paper
I think a series of modifications to quotation will make them become more useful in future meta programming especially if encoding of the F# language in quoted expressions is done in a less lossy way.
Pros and Cons
The advantages of making this adjustment to F# are less information is lost during the quotation literal encoding process and this information can be very useful to library developers in an approach to meta programming. With the current implementation you have no way of knowing in the quoted expression was called in infix or prefix notation.
The disadvantages of making this adjustment to F# are added complexity, more information to encode in the quoted literal, extra meta data to encode in ReflectedDefinition
Estimated cost (S):
Please tick this by placing a cross in the box:
Please tick all that apply:
@eugbaranov I’m using quotations to generate code from a quotation via splicing and external schema. The resulting code would ideally be infix notation like the quoted expression but I have no way of knowing that. I have to make a judgement call and make all such code infix. If the quotation literal was lossless then I could at least check and generatecas desired. After all line numbers are included why not fixity.
Another significant area is F# has an affinity for symbol, also symbols can be overridden so it would be nice to encode the information at the call site in the quotation. Certain symbols like