Is this an F# quotations bug?
Posted
by ControlFlow
on Stack Overflow
See other posts from Stack Overflow
or by ControlFlow
Published on 2010-05-30T12:41:14Z
Indexed on
2010/05/30
15:12 UTC
Read the original article
Hit count: 442
[<ReflectedDefinition>]
let rec x = (fun() -> x + "abc") ()
The sample code with the recursive value above produces the following F# compiler error:
error FS0432: [<ReflectedDefinition>] terms cannot contain uses of the prefix splice operator '%'
I can't see any slicing operator usage in the code above, looks like a bug... :)
Looks like this is the problem with the quotation via ReflectedDefinitionAttribute
only, normal quotation works well:
let quotation =
<@ let rec x = (fun() -> x + "abc") () in x @>
produces expected result with the hidden Lazy.create
and Lazy.force
usages:
val quotation : Quotations.Expr<string> =
LetRecursive
([(x, Lambda (unitVar,
Application
(Lambda (unitVar0,
Call (None,
String op_Addition[String,String,String](String, String),
[Call (None,
String Force[String](Lazy`1[System.String]),
[x]), Value ("abc")])),
Value (<null>)))),
(x, Call (None, Lazy`1[String] Create[String](FSharpFunc`2[Unit,String]), [x])),
(x, Call (None, String Force[String](Lazy`1[String]), [x]))], x)
So the question is: is this an F# compiler bug or not?
© Stack Overflow or respective owner