On Saturday, 7 November 2015 11:13:17 UTC-3, Yichao Yu wrote:
>
> On Sat, Nov 7, 2015 at 9:06 AM, andrew cooke <[email protected] 
> <javascript:>> wrote: 
> > 
> > This is just blowing my mind.  Can anyone explain it? 
> > 
> > To be clear - adding the {N} means that the "copy constructor" no longer 
> > copies.  See how mutating Foo alters both "instanced", and they both 
> have 
> > the same object reference. 
> > 
>
> You only defined inner constructor for Foo and the "copy" method you 
> defined is actually a method to call `Foo{N}` (more specifically 
> `call{N}(::Type{Foo{N}}, x::Foo)`) 
>
> When you call `Foo(f)`, you are calling `Foo` and not `Foo{2}` (i.e. 
> `call(::Type{Foo}, x::Foo{2})`) and it falls back to the no-op type 
> conversion. Use `which` or `@which` to figure out what you are 
> calling. 
>

i'm about to go about, but i'll check that later - sounds reasonable.  
thanks! 

Reply via email to