On Mon, Feb 8, 2016 at 7:02 PM, ben <[email protected]> wrote:
> Thanks for the pointer. Unfortunately, I saw this function but I was not
> able to figure out what the second argument should be.... Sorry about this.
> Can you give me a minimal working example, for instance the equivalent of
> `@code_warntype 2+2`?

code_warntype(+, Tuple{Int,Int})

or (might be deprecated at some time)

code_warntype(+, (Int, Int))

>
> On Monday, February 8, 2016 at 6:21:59 PM UTC-5, Yichao Yu wrote:
>>
>> On Mon, Feb 8, 2016 at 6:11 PM, ben <[email protected]> wrote:
>> > Is there a convenient way to do this?
>> >
>> > If not, what is the inconvenient way?
>> >
>> > I managed to log to a file by redirecting stdout
>>
>> Use the `code_warntype` function and pass a file handle to it as the
>> first argument.
>>
>> >
>> > ~~~
>> > rdstdout, wrstdout = redirect_stdout()
>> > @code_warntype(myuglyfunction())
>> > filename=string(Int(Dates.datetime2unix(now())))*"-type-stability.log"
>> > file=open(filename,"w")
>> > write(file,readavailable(rdstdout))
>> > close(file)
>> > ~~~
>> >
>> > but I am not sure how to resume the normal behavior of stdout after that
>> >
>> > Thanks!
>> >
>> > ben

Reply via email to