Ah, great. That solves my problem.

simon

On Thursday, 27 February 2014 22:24:41 UTC, Kevin Squire wrote:
>
> For reference, there's an open issue about this:
>
> https://github.com/JuliaLang/julia/issues/3894
>
> Regarding your example, you can use (or import) Main.OPTIONS to access the 
> value inside the module:
>
> julia> OPTION = "aa"
> "aa"
>
> julia> module Foo
>        println(Main.OPTION)
>        end
> aa
>
> Also of note (but not directly related to your problem), in v0.3, an 
> __init__() function can (as of today(*)) be defined in modules, which can 
> perform module initialization.
>
> Cheers,
>    Kevin
>
> (*) https://github.com/JuliaLang/julia/pull/5960
>
>
>
>
> On Thu, Feb 27, 2014 at 5:24 AM, Simon Byrne <simon...@gmail.com<javascript:>
> > wrote:
>
>> On Thursday, 27 February 2014 12:50:38 UTC, Tobias Knopp wrote:
>>>
>>> Should the user be able to specify the option in code? Winston has an 
>>> ini file that is parsed on load. Otherwise it should be possible to solve 
>>> this using global variables.
>>>
>>
>> I guess an ini file would be possible, but it's really just two options 
>> so that seems like overkill. If I can't figure this out I may resort to 
>> that option.
>>
>> Global variables would seem appropriate, but module's don't seem to play 
>> by the usual scoping rules, e.g.
>>
>> julia> OPTION = "aa"
>> "aa"
>>
>> julia> module Foo
>> global OPTION
>> println(OPTION)
>> end
>>
>> ERROR: OPTION not defined
>>
>>
>

Reply via email to