Is there a connection between untyped / typed code quotes in F # and macro hygiene?

I wonder if there is a connection between untyped / typed code quotes in F # and macro system hygiene. Do they solve the same problems in their respective languages ​​or are they separate problems?

+5
source share
2 answers

Quotes are a form of metaprogramming. They allow you to programmatically manipulate abstract syntax trees that can be transformed into code and evaluated.

Typed quotes insert the reified AST type into the host language type system, so they ensure that you cannot generate incorrectly typed code fragments. Untyped quotes do not offer this guarantee (it may fail at runtime).

As an aside, typed quotes are very similar to quasicotations of the Haskell Pattern.

Hygiene macros in Lisp-like languages ​​are related because they exist to support metaprograms. However, hygiene for confusion with an empty name, that which is gaining quasi-estimates, already avoids (and more).

, , , . , , -. , , . .

+6

- , . , , , , , :

1) , ( escape-)

2) , , , . ( )

, , ( ).

. , , - . . ? . .

, - .

+7

All Articles