[MacRuby-devel] NSTimer

Laurent Sansonetti lsansonetti at apple.com
Sun Oct 11 12:58:33 PDT 2009


In theory any runtime exception should be caught by the runloop and  
you should see a line in your Xcode console.

As for your timer question, using NSTimer is definitely good in case  
your callback doesn't do too much. Since this will all be run in the  
main thread through the run loop, if you see some performance problems  
it might be better to switch to a Thread instead.

Laurent

On Oct 11, 2009, at 12:55 PM, Robert Rice wrote:

> Hi Matt:
>
> I  am using the most recent build.
>
> I get a traceback for compile errors but not for execution errors on  
> the NS run loop.
>
> Bob
>
> On Oct 11, 2009, at 2:49 PM, Matt Aimonetti wrote:
>
>> The "NSTimer.
>> scheduledTimerWithTimeInterval_target_selector_userInfo_repeats 
>> "syntax is the RubyCocoa syntax, you need to use the selector  
>> approach in MacRuby, very much like obj-C.
>>
>> If you are on 0.5 beta or a recent nightly build, you should get a  
>> traceback, otherwise, you can still try to catch the exception and  
>> print out the error message and backtrace:
>>
>> begin
>>   raise "this is a test"
>> rescue Exception => e
>>   raise "#{e.message} #{e.backtrace}"
>> end
>>
>> - Matt
>>
>>
>>
>> On Sun, Oct 11, 2009 at 11:45 AM, Robert Rice  
>> <rice.audio at pobox.com> wrote:
>> Thanks John::
>>
>> I wasn't familiar with this new syntax. I was using the old syntax  
>> "NSTimer.scheduledTimerWithTimeInterval_target_selector_userInfo_repeats 
>> " but I see it doesn't work in MacRuby.
>>
>> MarRuby is giving me error messages without a traceback. Is there a  
>> way to enable tracebacks?
>>
>> Bob Rice
>>
>> On Oct 11, 2009, at 12:58 PM, John Shea wrote:
>
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel



More information about the MacRuby-devel mailing list