My confusion is that I don’t get that error message when entered directly 
into the REPL:

julia> using ProfileView

julia> Profile.clear()

julia> @profile sin(10)
-0.5440211108893698

julia> ProfileView.view()

On Tuesday, August 26, 2014 10:27:00 AM UTC-7, Tim Holy wrote:

Can you clarify what about that warning message _doesn't_ explain what you 
> need to do to fix the situation? I'm asking seriously because we're always 
> interested in improving error messages, but I thought this one was 
> admirably 
> clear and specific. 
>
> --Tim 
>
> On Tuesday, August 26, 2014 10:20:52 AM Ethan Anderes wrote: 
> > Right, I had tried using esc (even though I don’t really understand why 
> I 
> > need it) but I still get an error. 
> > 
> > Here’s the macro (I took out using ProfileView) 
> > 
> > macro profileview(ex) 
> >     quote 
> >         Profile.clear() 
> >         @profile $(esc(ex)) 
> >         # using ProfileView 
> >         ProfileView.view() 
> >     end 
> > end 
> > 
> > and here is the error 
> > 
> > julia> using ProfileView 
> > 
> > julia> @profileview sin(10) 
> > WARNING: There were no samples collected. Run your program longer 
> (perhaps 
> > by running it multiple times), or adjust the delay between samples with 
> > Profile.init(). 
> > ERROR: `start` has no method matching start(::Nothing) 
> >  in view at 
> > /Users/ethananderes/.julia/v0.3/ProfileView/src/ProfileView.jl:116 
> (repeats 
> > 2 times) in anonymous at none:6 
> > 
> > Maybe this is a ProfileView thing? Anyhoo, thanks. 
> > 
> > Ethan 
> > 
> > On Tuesday, August 26, 2014 10:02:30 AM UTC-7, Stefan Karpinski wrote: 
> > 
> > To make your macro hygienic, you need to do this: 
> > > macro profileview(ex) 
> > > 
> > >     quote 
> > >     
> > >         Profile.clear() 
> > >         @profile $(esc(ex)) 
> > >         using ProfileView 
> > >         ProfileView.view() 
> > >       
> > >      end 
> > > 
> > > end 
> > > 
> > > 
> > > There also may be a problem with having `using ProfileView` emitted in 
> a 
> > > macro like this, but fixing the hygiene issue is a good first thing to 
> > > try. 
> > > 
> > > On Tue, Aug 26, 2014 at 12:33 PM, Ethan Anderes <[email protected] 
> > > 
> > > <javascript:>> wrote: 
> > >> 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