I'm pretty sure this behaved differently some time ago, because that was a 
piece of working code. It's not worth a bug report though.

On Friday, 9 September 2016 13:19:12 UTC+2, Lutfullah Tomak wrote:
>
> I think it is on the way @profile defined makes it not processed in outer 
> scope
>
> julia> macroexpand(:(@profile y = f(5)))
> quote  # profile.jl, line 11:
>     try  # profile.jl, line 12:
>         #10#status = (Base.Profile.start_timer)() # profile.jl, line 13:
>         if #10#status < 0 # profile.jl, line 14:
>             (Base.Profile.error)((Base.Profile.error_codes)[#10#status])
>         end # profile.jl, line 16:
>         y = f(5)
>     finally  # profile.jl, line 18:
>         (Base.Profile.stop_timer)()
>     end
> end
>
> try finally end block makes y a local variable if not defined beforehand.
>
> julia> try
>        y=125
>        finally
>        nothing
>        end
> 125
>
>
> julia> y
> ERROR: UndefVarError: y not defined
>
>
> julia> y =5
> 5
>
>
> julia> try
>        y=125
>        finally
>        nothing
>        end
> 125
>
>
> If you think it is a regression file a bug report for profile.
>
>
> On Friday, September 9, 2016 at 1:04:21 PM UTC+3, Florian Oswald wrote:
>>
>> hi all, 
>>
>> on v0.5-rc3, I see this
>>
>> *julia> **f(x)=x^3*
>>
>> *f (generic function with 1 method)*
>>
>>
>> *julia> **@profile y = f(5)*
>>
>> *125*
>>
>>
>> *julia> **y*
>>
>> *ERROR: UndefVarError: y not defined*
>>
>>
>>
>> which used to work in previous versions. Is that intended behaviour?
>>
>>
>>

Reply via email to