Vector{MyType} is a type, not a value. Did you mean Array(MyType, 1)?

 — John

On Nov 26, 2014, at 8:38 AM, Robert Gates <[email protected]> wrote:

> OK thanks John, I ended up doing a bit differently but it works fine. Sorry 
> to keep asking, but now I have another problem I can't seem to wrap my head 
> around: consider
> 
> my_type_collection = Vector{MyType}
> my_type_collection[1] = MyType(a,b,c)
> 
> returns: `setindex!` has no method matching 
> setindex!(::Type{Array{MyType,1}}, ::MyType, ::Int64)
> 
> Seems a bit weird to me, since
> 
> my_type_collection = [MyType(a,b,c); MyType(d,e,f)]
> my_type_collection[1] = my_type_collection[2]
> 
> works just fine.
> 
> 
> 
> 
> 
> On Tuesday, November 25, 2014 10:00:59 PM UTC+1, Robert Gates wrote:
> Hi Julians:
> 
> I'm still new to Julia and am having a little trouble correctly understanding 
> composite types. I would like to create a composite type with a mixture of 
> constant attributes, i.e. class attributes, and mutable attributes. In 
> practice, the problem is that I need to instantiate many, e.g. 10e8, type 
> instances and would like to avoid having to allocate memory for values which 
> are constant over a large subset of these instances. Is there any way to do 
> this correctly?
> 
> Thanks for your help!
> 
> Robert

Reply via email to