[julia-users] dictchannel.jl example

2016-06-28 Thread Jon Norberg
I have great use of the dictchannel.jl example. I wanted to add the method keys to it so I thought that I simply add the function: function keys(D::DictChannel) keys(D.d) end as well s add the function name in the import (I tried also without adding the "keys") : import Base: put!, wait, i

[julia-users] dictchannel.jl example

2016-06-28 Thread Jon Norberg
the dictchannel is in the julia package as an example of Channels https://github.com/JuliaLang/julia/blob/master/examples/dictchannel.jl

[julia-users] dictchannel.jl example

2016-06-28 Thread Kristoffer Carlsson
You have defined a keys method for a DictChannel but the error message is for a RemoteRef{DictChannel} which you have no method for.

[julia-users] dictchannel.jl example

2016-06-28 Thread Jon Norberg
Strangely makning a function function keys(D::RemoteRef{DictChannel}) keys(D.d) end Gives also error: LoadError: type RemoteRef has no field d Also, for the function put! That does work the function looks like: function put!(D::DictChannel, k, v) D.d[k] = v notify(D.cond_take)

[julia-users] dictchannel.jl example

2016-06-28 Thread Kristoffer Carlsson
I believe you need to "fetch" the value in the RemoteRef. This should return your Dict that you can then use keys on.

[julia-users] dictchannel.jl example

2016-06-28 Thread Jon Norberg
Strangely though, if I modify the put! function as: function put!(D::DictChannel, k, v) D.d[k] = v notify(D.cond_take) Println(keys(D.d)) D end And run this I get Any[2,3,1] (I added keps in that order), i.e. This works So it seemed the function definition of keys does not wor