Yes (I was being brief, but you're right that could have been confusing).
--Tim
On Friday, July 10, 2015 05:58:31 AM David Gold wrote:
> @Tim,
>
> On that note, one would also want to amend the declaration of `MyArray` to
> `MyArray{T <: MyType}` in order that the type information about the
> `values` field be reflected in the type of the `MyArray` object, correct?
>
> On Friday, July 10, 2015 at 8:38:11 AM UTC-4, Tim Holy wrote:
> > Off-topic, but you also have a major type problem. Use `Array{T,N}` rather
> > than
> > `Array{MyType}`, where `T <: MyType`. See
> >
> > http://docs.julialang.org/en/release-0.3/manual/faq/#how-should-i-declare->
> > > abstract-container-type-fields.
> >
> >
> > --Tim
> >
> > On Friday, July 10, 2015 12:17:19 AM Scott Noel-Hemming wrote:
> > > I'm sure I'm missing something obvious here, but can anyone point me to
> > > where I should look to explain this behavior:
> > >
> > > immutable MyArray <: MyType
> > >
> > > prefix::Char
> > > values::Array{MyType}
> > >
> > > MyArray(values::Array{MyType}) = new('*', values::Array{MyType})
> > > #MyArray(values::Tuple{MyType}) = new(collect(values::Tuple{MyType}))
> > >
> > > end
> > > #MyArray(values::Tuple{MyType}) =
> >
> > MyArray(collect(values::Tuple{MyType}))
> >
> > > I've included a couple, commented out, attempts that don't appear to
> >
> > work.
> >
> > > The main goal is to provide provide a constructor method which takes an
> > > Array or a Tuple type for the values argument. Both methods include
> >
> > result
> >
> > > in an error, though:
> > >
> > > ERROR: type: instantiate_type: expected TypeConstructor, got
> >
> > Type{(Any...,)}
> >
> > > > in include at /usr/bin/../lib/julia/sys.so
> > > > in process_options at /usr/bin/../lib/julia/sys.so
> > > > in _start at /usr/bin/../lib/julia/sys.so (repeats 2 times)
> > > >
> > > > while loading /home/scott/.julia/v0.3/Redis/tmp/classes.jl, in
> >
> > expression
> >
> > > > starting on line 53