Hi Folks,
I’m trying to write a macro for my .juliarc.jl file which lays down the 
syntax for generating a ProfileView. I use ProfileView infrequent enough 
that whenever I use it I need to refer to the github page. To fix this I 
want to write something really quick and easy but I’m running into problems 
with the following macro.

macro profileview(ex)
    quote
        Profile.clear() 
        @profile $ex
        using ProfileView
        ProfileView.view()  # <---- this seems to be the problem
    end
end

I get the following error

julia> @profileview sin(10)
ERROR: error compiling anonymous: unsupported or misplaced expression using in 
function anonymous

I don’t have any experience with macros so I can’t tell what I’m doing 
wrong here. I would like to be able to write @profileview foo(x) and have 
the profile window pop up. Any suggestions? 

Thanks,
Ethan
​

Reply via email to