> Yeah thanks, figured there was a simple solution, is this being
> affected by the big tuple/vararg overhaul?

You're welcome, and no, I don't think it should be affected.

> On 2 May 2015 at 14:37, Mauro <[email protected]> wrote:
>> Splat the fields?
>>
>> function mutateimmutable{T<:Component}(c::T)
>>    fields=getargs(c)
>>    mutate!(fields)
>>    return T(fields...)
>> end
>>
>>
>> On Sat, 2015-05-02 at 12:15, Marcus Appelros <[email protected]> 
>> wrote:
>>> One very crude way it can be done:
>>>
>>> function mutateimmutable(c::Component)
>>>    fields=getargs(c)
>>>    mutate!(fields)
>>>    if length(fields)==1
>>>       return typeof(c)(fields[1])
>>>    elseif length(fields)==2
>>>       return typeof(c)(fields[1],fields[2])
>>>    #etc...
>>>    end
>>> end
>>>
>>> On 2 May 2015 at 12:43, Mauro <[email protected]> wrote:
>>>> Maybe some pseudo code would make understanding your problem easier?
>>>>
>>>> On Sat, 2015-05-02 at 10:34, Marcus Appelros <[email protected]> 
>>>> wrote:
>>>>> This is the use case: abstract Component with a getargs(c::Component) that
>>>>> returns an array with the fields of components, for concreteness lets say 
>>>>> a
>>>>> Der type with the fields x and dy. We want to be able to fetch the fields,
>>>>> mutate the array (say replace all :a with :b^2) and then return a mutated
>>>>> immutable instance, and we want it defined generally on Component so no
>>>>> inner constructors. How?
>>>>
>>

Reply via email to