See:
https://groups.google.com/forum/#!msg/julia-users/sv5UpxA79zQ/ot-9goKR554J


On Wed, Jun 18, 2014 at 4:32 AM, Luke Stagner <[email protected]> wrote:

> Hello all,
>
> I know it is possible to have a self-referential type like the following
>
> type SelfRef
>    obj::SelfRef
>    SelfRef() = (x=new(); x.obj=x)
> end
>
> what I want to do is have obj be an array of type SelfRef so I can make a
> tree-like structure. I tried the following
>
> type SelfRef
>    obj::Array{SelfRef,0}
>    SelfRef() = (x=new(); x.obj=Array(x,0))
> end
>
> but that throws the following error (on nightly)
> julia> a=SelfRef()
> ERROR: no method Array{T,N}(SelfRef)
>  in SelfRef at none:3
>
> Is there anyway I can make this work?
>

Reply via email to