Thanks!

On Thu, Jun 25, 2015 at 11:12 PM, Sheehan Olver <dlfivefi...@gmail.com>
wrote:

> Yep I'll open an issue with Simons example.  I had another issue which
> hadn't narrowed down the problem which I'll replace
>
> Sent from my iPhone
>
> On 26 Jun 2015, at 12:55 pm, Stefan Karpinski <ste...@karpinski.org>
> wrote:
>
> Yes – adding a normal method should never segfault. Can you open an issue?
>
> On Thu, Jun 25, 2015 at 6:33 PM, Sheehan Olver <dlfivefi...@gmail.com>
> wrote:
>
>> Is that a bug in Julia that wrongly overloading convert is an unsafe
>> operation?
>>
>> Sent from my iPad
>>
>> On 26 Jun 2015, at 12:22 am, Simon Byrne <simonby...@gmail.com> wrote:
>>
>> For abstract types it is acceptable to return an instance of a subtype,
>> e.g.
>>
>> convert(Integer, 1.0)
>>
>> Otherwise, I suspect you are in for all sorts of trouble, e.g.
>>
>> julia> import Base.convert
>>
>>
>> julia> immutable Foo
>>
>>        x::Int
>>
>>        end
>>
>>
>> julia> function bar(x)
>>
>>        y::Foo
>>
>>        y=x
>>
>>        end
>>
>> bar (generic function with 1 method)
>>
>>
>> julia> convert(::Type{Foo},x::Int) = float(x)
>>
>> convert (generic function with 518 methods)
>>
>>
>> julia> bar(1)
>>
>>
>> signal (11): Segmentation fault: 11
>>
>>
>> -Simon
>>
>> On Thursday, 25 June 2015 04:55:07 UTC+1, Sheehan Olver wrote:
>>>
>>>
>>> Is there a guide/good guidelines for overriding Base.convert?  Is it
>>> allowed for a convert routine to ever return a different type than
>>> requested?
>>>
>>> My overrides (in a fairly deep type hierarchy) seem to be triggering
>>> numerous bugs in Julia 0.4, I believe because of issues with type
>>> inference.  Right now I just add more overrides to fix the 0.4 bugs as they
>>> pop up..
>>>
>>
>

Reply via email to