Ah, that's a good idea! Thanks!

On Thursday, February 11, 2016 at 6:32:06 PM UTC+1, Stefan Karpinski wrote:
>
> You could also make the type definition conditional and only evaluate it 
> if it isn't already defined.
>
> On Thu, Feb 11, 2016 at 12:21 PM, Kristoffer Carlsson <kcarl...@gmail.com 
> <javascript:>> wrote:
>
>> Modules might work but they bring other annoyances... I would be fine 
>> with a warning and just ignoring the whole type block.
>>
>> Similar to:
>>
>> julia> const a = 1
>> 1
>>
>> julia> const a = 2
>> WARNING: redefining constant a
>> 2
>>
>> couldn't it be:
>>
>> julia> type Foo2{T}
>>        a::T
>>        end
>>
>> julia> type Foo2{T}
>>        a::T
>>        end
>> WARNING: did not redefine constant Foo2
>>
>>
>>
>> On Thursday, February 11, 2016 at 6:16:46 PM UTC+1, Stefan Karpinski 
>> wrote:
>>>
>>> Defining types in a module and then reloading the module helps. The 
>>> bindings get messy though, so it's best to qualify all accesses when you're 
>>> developing like that. This is kind of an annoyance – not sure how hard it 
>>> would be to fix but it should be doable.
>>>
>>> On Thu, Feb 11, 2016 at 12:10 PM, Kristoffer Carlsson <
>>> kcarl...@gmail.com> wrote:
>>>
>>>> I have a file that defines a type and a few functions. Sometimes I want 
>>>> to reload this file in the REPL to update some modified functions in the 
>>>> file. If the type is parameterized then this will fail even though the 
>>>> type 
>>>> definition does not change.
>>>>
>>>> Example:
>>>>
>>>>
>>>> julia> type Foo
>>>>        a::Int
>>>>        end
>>>>
>>>> julia> type Foo
>>>>        a::Int
>>>>        end
>>>>
>>>> julia> type Foo2{T}
>>>>        a::T
>>>>        end
>>>>
>>>> julia> type Foo2{T}
>>>>        a::T
>>>>        end
>>>> ERROR: invalid redefinition of constant Foo2
>>>>
>>>>
>>>> Is there a good way to work around this? I don't really want to 
>>>> workspace() all the time because then I have to compile everything again.
>>>>
>>>
>>>
>

Reply via email to