julia> type Something
s::Void
end
julia> Something(nothing)
Something(nothing)
On Thursday, 16 April 2015 23:23:52 UTC+1, Dominique Orban wrote:
>
> Which way should I change my example then? It seems all combinations of
> Void/Nothing and Void()/Nothing() give me the same MethodError.
>
> On Thursday, April 16, 2015 at 4:14:21 PM UTC-4, Jameson wrote:
>>
>> Nothing was renamed to Void, to better reflect its place in C-interop.
>> It's instance is still named `nothing`.
>>
>> On Thu, Apr 16, 2015 at 4:03 PM Dominique Orban <[email protected]>
>> wrote:
>>
>>> In 0.3, I used to be able to make something out of nothing:
>>>
>>> julia> VERSION
>>> v"0.3.6"
>>>
>>> julia> type Something
>>> s :: Nothing
>>> end
>>>
>>> julia> Something(Nothing())
>>> Something(nothing)
>>>
>>> but no longer in 0.4:
>>>
>>> julia> VERSION
>>> v"0.4.0-dev+4294"
>>>
>>> julia> type Something
>>> s :: Nothing
>>> end
>>>
>>> julia> Something(Nothing())
>>> ERROR: MethodError: `convert` has no method matching convert(::Type{Void
>>> })
>>> This may have arisen from a call to the constructor Void(...),
>>> since type constructors fall back to convert methods.
>>> Closest candidates are:
>>> convert{T}(::Type{T}, ::T)
>>> in call at base.jl:38
>>>
>>>
>>> How do I achieve the same effect?
>>>
>>> Thanks.
>>>
>>