What about include in a function?
function mainFunc()
include("helper.jl")
call helper() and do stuff
return something
end
inside helper.jl
function helper()
do stuff
return something
end
On Wednesday, March 30, 2016 at 1:26:22 PM UTC+1, Christopher Fisher wrote:
>
> There might be some cases where defining functions within functions can
> improve speed. As Mauro noted, this may not be true in .4 but will be fixed
> in .5. See the following for examples:
>
>
> https://groups.google.com/forum/#!searchin/julia-users/Passing$20data$20through$20Optim/julia-users/a_81sxvb-3c/9q6RvjfkBwAJ
>
> On Tuesday, March 29, 2016 at 12:31:42 PM UTC-4, Evan Fields wrote:
>>
>> To keep namespaces clear and to help with code readability, I might like
>> to do this:
>>
>> function mainFunc()
>> function helper()
>> do stuff
>> return something
>> end
>>
>> call helper() and do stuff
>> return something
>> end
>>
>> That way the helper function is only visible to the function that needs
>> it and when reading the code it's obvious that the helper "belongs to" the
>> main function. Is there any performance penalty for doing this? Or is this
>> bad practice for some reason I don't know?
>>
>