ah, no it wouldn't, sorry.
On Sunday, 13 September 2015 22:18:24 UTC-3, Seth wrote: > > This looks interesting but I'd want to give the user the option of turning > parallelization on and off at will. Not sure this will do it. > > On Sunday, September 13, 2015 at 5:59:37 PM UTC-7, andrew cooke wrote: >> >> >> the following works.. >> >> first, defining module AB: >> >> module A >> export foo >> foo() = println("a") >> end >> >> module B >> export foo >> foo() = println("b") >> end >> >> module AB >> if Main.USE_A >> using A >> else >> using B >> end >> export foo >> end >> >> that depends on Main.USE_A, where Main is the initial module when things >> start up, so then you can do: >> >> USE_A = true >> >> include("ab.jl") >> >> using AB >> foo() >> >> which prints "a". >> >> no idea if this is considered kosher... >> >> andrew >> >> >> >> >> On Sunday, 13 September 2015 21:45:57 UTC-3, andrew cooke wrote: >>> >>> >>> i don't know of a good way to do this. >>> >>> really, parameterised modules would be great. >>> >>> the simplest thing i can think of is if modules are first class and >>> using etal can take an expression, but the following doesn't run: >>> >>> module A >>> foo() = println("a") >>> end >>> >>> module B >>> foo() = println("b") >>> end >>> >>> module AB >>> m(x) = x ? A : B >>> end >>> >>> using AB >>> using m(true) >>> foo() # wouldn't it be nice if this printed "a"? >>> >>> andrew >>> >>> >>> On Sunday, 13 September 2015 19:33:16 UTC-3, Seth wrote: >>>> >>>> Hi all, >>>> >>>> I'd like to track a setting throughout my module (that will cause the >>>> [transparent] dispatch of either single-threaded or parallel versions of >>>> many different functions). Is there a more Julian way of doing the >>>> following? This seems inelegant: >>>> >>>> _parallel = false # start off without parallelism - user calls >>>> parallelize() to set/unset. >>>> >>>> function parallelize(p::Bool=true) >>>> global _parallel = p >>>> end >>>> >>>> >>>> function foo(a::Int) # there will be many functions like this >>>> if _parallel >>>> _foo_parallel(a) >>>> else >>>> _foo_singlethread(a) >>>> end >>>> end >>>> >>>>