Re: [julia-users] Re: how to reload macro def

2016-05-24 Thread Cedric St-Jean
FYI, Autoreload.jl has this `@ausing` macro that will autoreload the module on modification AND update the Main symbols, so there's no need to qualify the module name all the time. It's much more convenient than Julia's default behaviour IMO. On Tuesday, May 24, 2016 at 3:29:44 PM UTC-4,

Re: [julia-users] Re: how to reload macro def

2016-05-24 Thread Tim Holy
If you reloaded the whole package each time some code said using Compat you'd be very, very unhappy. Once the module is defined in Main, that's where it fetches it from (which is why it's so fast). If you reload the package with `reload("Compat")`, then any future `using` statements refer

Re: [julia-users] Re: how to reload macro def

2016-05-24 Thread Cedric St-Jean
On Tuesday, May 24, 2016 at 11:13:29 AM UTC-4, vav...@uwaterloo.ca wrote: > > Cedric, > > Yes, you have identified the issue: when I say "using file.@mac" followed > by "macroexpand(:(@mac expr))" at the REPL prompt, then future 'include' > statements do not reload the macro definition.

Re: [julia-users] Re: how to reload macro def

2016-05-24 Thread vavasis
Cedric, Yes, you have identified the issue: when I say "using file.@mac" followed by "macroexpand(:(@mac expr))" at the REPL prompt, then future 'include' statements do not reload the macro definition. However, if I skip the "using" directive and qualify the name as file.@mac in the

Re: [julia-users] Re: how to reload macro def

2016-05-24 Thread Cedric St-Jean
Are you `using` the module? In general, `using` and reloading don't play very nice with each other. I just tried with a module like module foo macro aa() 20 end end and when I use the module name include("foo.jl") foo.@aa it works out. On Tue, May 24, 2016 at 12:21 AM,

[julia-users] Re: how to reload macro def

2016-05-23 Thread vavasis
Cedric, I encountered this issue in the following context: the macro is defined inside a module. I test it from the REPL using the macroexpand function. When macroexpand bombs or else gives me the wrong expansion, I edit the file with the macro definition and reload the module via include.

[julia-users] Re: how to reload macro def

2016-05-23 Thread Cedric St-Jean
Maybe you already know this, but macros are applied at parsing time (or right after parsing - not sure). This means that if you have # In Macro.jl macro macmac(x) ... end # In Fun.jl function foo(x) macmac(something) end Then whenever you've changed Macro.jl, you need to reload both

[julia-users] Re: how to reload macro def

2016-05-23 Thread Kaj Wiik
Maybe workspace()? help?> workspace search: workspace workspace() Replace the top-level module (Main) with a new one, providing a clean workspace. The previous Main module is made available as LastMain. A previously- loaded package can be accessed using a statement such as using