Cross-ref StackOverflow:
http://stackoverflow.com/questions/33334656/error-on-serialize-lambda-function-with-closured-data


On Sat, Oct 24, 2015 at 11:03 PM, Александр Кольцов <[email protected]>
wrote:

> About my problem. Code:
> ...
> p = _belineInterpolateGrid(map(t -> sin( norm(t) ), grid), grid)
> serialize(open("/data/test.function", "w"), p)
> p0 = deserialize(open("/data/test.function", "r"))
>
> >> ERROR: MethodError: `convert` has no method matching
> convert(::Type{LambdaStaticData}, ::Array{Any,1})
> This may have arisen from a call to the constructor LambdaStaticData(...),
> since type constructors fall back to convert methods.
> Closest candidates are:
>   call{T}(::Type{T}, ::Any)
>   convert{T}(::Type{T}, ::T)
>  [inlined code] from int.jl:187
>  in deserialize at serialize.jl:536
>  [inlined code] from operators.jl:313
>  in handle_deserialize at serialize.jl:475
>  in deserialize_array at serialize.jl:614
>  in handle_deserialize at serialize.jl:463
>  [inlined code] from essentials.jl:116
>  in deserialize at serialize.jl:696
>  [inlined code] from operators.jl:313
>  in handle_deserialize at serialize.jl:475
>  [inlined code] from int.jl:187
>  in deserialize at serialize.jl:482
>  [inlined code] from operators.jl:313
>  in handle_deserialize at serialize.jl:475
>  [inlined code] from int.jl:187
>  in deserialize at serialize.jl:538
>  [inlined code] from operators.jl:313
>  in handle_deserialize at serialize.jl:475
>  [inlined code] from int.jl:187
>  in deserialize at serialize.jl:435
>
> In function "_belineInterpolateGrid" I used closure of Array{Function}:
>
> function _belineInterpolateGrid(PP, Grid)
> ...
> P = Array(Function, N-1, M-1)
> ...
> poly = (x,y) -> begin
>      i_x, i_y =  i(x, y)
>      return P[i_x, i_y](x, y)
> end
> return poly
> end
>
> What's happened and can I fix It? Or this is a bug?
>

Reply via email to