-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for #3402. Allows spawning an actor via expression. #3667
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ module Serialization = | |
type ExprSerializer(system) = | ||
inherit Serializer(system) | ||
let fsp = FsPickler.CreateBinarySerializer() | ||
override __.Identifier = 9 | ||
override __.Identifier = 99 | ||
override __.IncludeManifest = true | ||
override __.ToBinary(o) = serializeToBinary fsp o | ||
override __.FromBinary(bytes, _) = deserializeFromBinary fsp bytes | ||
|
@@ -374,14 +374,15 @@ module Linq = | |
|
||
let toExpression<'Actor>(f : System.Linq.Expressions.Expression) = | ||
match f with | ||
| Lambda(_, Invoke(Call(null, Method "ToFSharpFunc", Ar [| Lambda(_, p) |]))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice catch, so this looks like this is what was causing the trouble @chrisjhoare ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I think the previous signature of this got changed/removed in the move to netstandard and added back in some form from F# 4.5 onwards - but to be honest its a little beyond me. But this does appear to allow the actor to be spawned now. |
||
| Lambda(_, (Call(null, Method "ToFSharpFunc", Ar [| Lambda(_, p) |]))) | ||
| Call(null, Method "ToFSharpFunc", Ar [| Lambda(_, p) |]) -> | ||
Expression.Lambda(p, [||]) :?> System.Linq.Expressions.Expression<System.Func<'Actor>> | ||
| _ -> failwith "Doesn't match" | ||
|
||
type Expression = | ||
static member ToExpression(f : System.Linq.Expressions.Expression<System.Func<FunActor<'Message, 'v>>>) = f | ||
static member ToExpression<'Actor>(f : Quotations.Expr<(unit -> 'Actor)>) = toExpression<'Actor> (QuotationEvaluator.ToLinqExpression f) | ||
static member ToExpression<'Actor>(f : Quotations.Expr<(unit -> 'Actor)>) = | ||
toExpression<'Actor> (QuotationEvaluator.ToLinqExpression f) | ||
|
||
[<RequireQualifiedAccess>] | ||
module Configuration = | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call