[MacRuby-devel] [MacRuby] #381: Losing track of a defined constant - possibly related to Module.autoload

2009-10-11 Thread MacRuby
#381: Losing track of a defined constant - possibly related to Module.autoload
---+
 Reporter:  kamal.fa...@…  |   Owner:  lsansone...@… 
 Type:  defect |  Status:  new   
 Priority:  minor  |   Milestone:  MacRuby 0.5   
Component:  MacRuby|Keywords:  autoload require constants
---+
 There seems to be a bug in the interaction of autoload and requires. I
 tried hard to reduce this with no success. However, here is the smallest
 snippet that will illustrate this bug:

 {{{
 $ macruby -rubygems -rrack -r"rack/builder" -e "Rack::Builder"
 core:in `require:': uninitialized constant Rack::Builder (NameError)
 }}}

 If you remove the require to "rack/builder", MacRuby will autoload
 Rack::Builder normally and no exception will be raised.

 {{{
 $ macruby -rubygems -rrack -e "Rack::Builder"
 }}}

 in rack.rb, it defines

 {{{
 autoload :Builder, "rack/builder"
 }}}

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #370: Inconsistency between macruby and ruby in a simple class

2009-10-11 Thread MacRuby
#370: Inconsistency between macruby and ruby in a simple class
---+
 Reporter:  kfow...@…  |Owner:  lsansone...@…
 Type:  defect |   Status:  closed   
 Priority:  major  |Milestone:  MacRuby 0.5  
Component:  MacRuby|   Resolution:  fixed
 Keywords: |  
---+

Comment(by conra...@…):

 I noticed that the output is printing extra '#-'.  For example,

 {{{

 ##->

 }}}

 when it should be represented as

 {{{

 #>

 }}}

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] macruby on iphone (again) - options and way forward

2009-10-11 Thread John Shea

Hello everyone.

So I think this topic is going to rear its ugly/pretty head until a  
solution becomes available, and I myself would really like to be able  
to use macruby code on the iphone.


So I have put down my naive thoughts as to what are the issues.

I am a complete novice when it comes to GC, so I am sorry if this is  
all obvious or erroneous - but the important part is the discussion -  
which i hope many of you will add to.


Anyway it could be that I don't know enough about the subject to make  
sense of it. But a way to perhaps getting more people to work on  
getting macruby on the phone could be:


1. Describe the current GC situation on the mac & macruby in terms of  
architecture.
2. Describe an appropriate architecture for how GC would work on the  
iphone, how the programmer interacts with it in coding or compiling.
3. Describe the various parts of work that have to be done to to  
implement 2.
4. Make some suggestions of similar coding efforts or current code  
files or other references that people can use/copy to build a proof of  
principle


The following are my versions of 1 and 2:

Point 1:
My assumption is that currently macruby hooks into objective c's GC -  
autozone (this one ? http://www.opensource.apple.com/source/autozone/autozone-77.1/) 
 via ruby's ObjectSpace.


Point 2:
The iphone does not have GC so therefore in order to run macruby  
something needs to collect the garbage.


My other assumption is that you cannot run interpreted code on the  
iphone (or iphone simulator) so when developing for iphone the ruby  
code would need to be compiled during the build phase.


So I can think of two ways to do collect the garbage.

Firstly port autozone to the iphone - integrate macruby more or less  
as now - include it as a framework or something.

However,
  - i am concerned that the separate autozone thread(s) may not play  
well with the iphone processor
  - in addition the threads need to be interruptible, when phone  
calls come in or the home button is pressed - i can imagine including  
the autozone controller in the responder chain (in order to receive  
the shutdown command) would not be trivial.


I am wondering if the above complexity is why Laurent always refers to  
"emulating" autozone rather than including it or porting it.


The other option i can think of is in the build phase insert the  
necessary retains, releases and autoreleases into the code. By either:


	i) the developer including the calls manually, which are then  
compiled/translated to the appropriate C/ObjC commands. (I have gone  
off this idea a bit because the code would be hard to test in  
isolation (unless there were special compiler codes normally ignored  
by the ruby interpreter), and would make it hard to drop in any nice  
ruby code/libraries, and later on hard to fix code if an official GC  
ever arrives).


	ii) have a script which traverses the ruby code - and adds dealloc  
methods for instance methods, adds releases to scope bound variables  
etc, etc.
(I like this option the best, though i have little idea how to  
implement)


So do you all think i have described the situation properly?

If so perhaps someone (more knowledgeable) could provide some hints to  
points 3 and 4 above?


Or if i haven't described the situation properly then the whole stack  
of points 1-4 would (I think) help us move forward - and help people  
contribute to a solution.


Cheers,
John
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby 0.5 beta 1

2009-10-11 Thread Eloy Duran
Laurent,

as they say in french; congratulations on le grande effort! \m/

Eloy

On Thursday, October 8, 2009, Laurent Sansonetti  wrote:
> Hi,
>
> The first beta release of MacRuby 0.5 is out! I prepared some notes here:
>
> http://www.macruby.org/blog/2009/10/07/macruby05b1.html
>
> The goal is to go through a few beta releases before releasing the final 0.5.
>
> Please give it a try and report us bugs & feedback :)
>
> Laurent
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] macruby on iphone (again) - options and way forward

2009-10-11 Thread Matt Aimonetti
John, thanks for sharing, look for an email from Laurent from about a week
where he's explaining the plan for the iphone and what needs to be done to
release/retain objects. I think the thread should help you and you might
want to work with the other developer who already started looking into that.

- Matt

On Sun, Oct 11, 2009 at 1:53 AM, John Shea  wrote:

> Hello everyone.
>
> So I think this topic is going to rear its ugly/pretty head until a
> solution becomes available, and I myself would really like to be able to use
> macruby code on the iphone.
>
> So I have put down my naive thoughts as to what are the issues.
>
> I am a complete novice when it comes to GC, so I am sorry if this is all
> obvious or erroneous - but the important part is the discussion - which i
> hope many of you will add to.
>
> Anyway it could be that I don't know enough about the subject to make sense
> of it. But a way to perhaps getting more people to work on getting macruby
> on the phone could be:
>
> 1. Describe the current GC situation on the mac & macruby in terms of
> architecture.
> 2. Describe an appropriate architecture for how GC would work on the
> iphone, how the programmer interacts with it in coding or compiling.
> 3. Describe the various parts of work that have to be done to to implement
> 2.
> 4. Make some suggestions of similar coding efforts or current code files or
> other references that people can use/copy to build a proof of principle
>
> The following are my versions of 1 and 2:
>
> Point 1:
> My assumption is that currently macruby hooks into objective c's GC -
> autozone (this one ?
> http://www.opensource.apple.com/source/autozone/autozone-77.1/) via ruby's
> ObjectSpace.
>
> Point 2:
> The iphone does not have GC so therefore in order to run macruby something
> needs to collect the garbage.
>
> My other assumption is that you cannot run interpreted code on the iphone
> (or iphone simulator) so when developing for iphone the ruby code would need
> to be compiled during the build phase.
>
> So I can think of two ways to do collect the garbage.
>
> Firstly port autozone to the iphone - integrate macruby more or less as now
> - include it as a framework or something.
> However,
>  - i am concerned that the separate autozone thread(s) may not play well
> with the iphone processor
>  - in addition the threads need to be interruptible, when phone calls come
> in or the home button is pressed - i can imagine including the autozone
> controller in the responder chain (in order to receive the shutdown command)
> would not be trivial.
>
> I am wondering if the above complexity is why Laurent always refers to
> "emulating" autozone rather than including it or porting it.
>
> The other option i can think of is in the build phase insert the necessary
> retains, releases and autoreleases into the code. By either:
>
>i) the developer including the calls manually, which are then
> compiled/translated to the appropriate C/ObjC commands. (I have gone off
> this idea a bit because the code would be hard to test in isolation (unless
> there were special compiler codes normally ignored by the ruby interpreter),
> and would make it hard to drop in any nice ruby code/libraries, and later on
> hard to fix code if an official GC ever arrives).
>
>ii) have a script which traverses the ruby code - and adds dealloc
> methods for instance methods, adds releases to scope bound variables etc,
> etc.
> (I like this option the best, though i have little idea how to implement)
>
> So do you all think i have described the situation properly?
>
> If so perhaps someone (more knowledgeable) could provide some hints to
> points 3 and 4 above?
>
> Or if i haven't described the situation properly then the whole stack of
> points 1-4 would (I think) help us move forward - and help people contribute
> to a solution.
>
> Cheers,
> John
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby 0.5 beta 1

2009-10-11 Thread Wayne Seguin

Not just yet but will be doing so asap.

  ~Wayne

On Oct 10, 2009, at 14:54 , Matt Aimonetti wrote:

Wayne, did you try Ernie's script?

Martin, we actually do, if you check the nightly builds page, and  
click on details, you can see the logs and the spec results.


- Matt

On Sat, Oct 10, 2009 at 10:13 AM, Martin Hess   
wrote:

Congratulations! Truly an amazing effort.

Just curious, is there a webpage to view the daily rubyspec results  
in detail?



On Oct 7, 2009, at 9:13 PM, Laurent Sansonetti wrote:

Hi,

The first beta release of MacRuby 0.5 is out! I prepared some notes  
here:


http://www.macruby.org/blog/2009/10/07/macruby05b1.html

The goal is to go through a few beta releases before releasing the  
final 0.5.


Please give it a try and report us bugs & feedback :)

Laurent
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby 0.5 beta 1

2009-10-11 Thread B. Ohr

Hi Laurent,

I have to thank you (and all the others) for your great effort!

When I first saw Obj-C (~1993, I don‘t remember exactly, I got a NeXT  
computer for testing purposes), my first thought was: What a weird  
language! At this moment absolutely nobody could foresee, that this  
will be the future language of choice for the Apple Macintosh.


I really hope, that MacRuby will become a fully useable alternative to  
Obj-C on the Mac! And the 0.5 is already very useable for a beta.  
Every time when I am doing something in MacRuby (and have to look at  
Obj-C examples), I can only say: I love that language!


Bernd

Am 08.10.2009 um 06:13 schrieb Laurent Sansonetti:


Hi,

The first beta release of MacRuby 0.5 is out! I prepared some notes  
here:


http://www.macruby.org/blog/2009/10/07/macruby05b1.html

The goal is to go through a few beta releases before releasing the  
final 0.5.


Please give it a try and report us bugs & feedback :)

Laurent
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] NSTimer

2009-10-11 Thread Robert Rice

Congratulations MacRuby Development Team:

My application almost runs now in MacRuby.

Is NSTimer class supported in MacRuby?

I was doing background processing using NSTimer as follows:

@timer = NSTimer.scheduledTimerWithTimeInterval( 5.0, :target,  
self, :selector, :periodicUpdate, :userInfo, nil, :repeats, true )


but this now gives me the error:

undefined method `scheduledTimerWithTimeInterval' for NSTimer:Class  
(NoMethodError)


Do you have a preferred method for doing backgound tasks in MacRuby -  
perhaps separate threads?


Thanks,
Bob Rice

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] NSTimer

2009-10-11 Thread John Shea

Hi Bob,

(you are going to kick yourself) you have misplaced the colon between  
target and self  - there is a comma there, and the colon has been  
placed in front of "target", so the method is not being recognised.


eg:
@synchro_timer =  
NSTimer.scheduledTimerWithTimeInterval(TIME_INTERVAL, target:self,  
selector:"synchronise_with_server:", userInfo:nil, repeats:true)



as for threads - maybe someone else could chime in with a preference -  
but I do it the Cocoa way (eg http Connection delegates or timers) -  
but for data crunching using all cores I will use something like  
Laurent's barber shop code: http://www.macruby.org/blog/2009/10/07/macruby05b1.html 
.



J

On Oct 11, 2009, at 6:19 PM, Robert Rice wrote:


Congratulations MacRuby Development Team:

My application almost runs now in MacRuby.

Is NSTimer class supported in MacRuby?

I was doing background processing using NSTimer as follows:

@timer = NSTimer.scheduledTimerWithTimeInterval( 5.0, :target,  
self, :selector, :periodicUpdate, :userInfo, nil, :repeats, true )


but this now gives me the error:

undefined method `scheduledTimerWithTimeInterval' for NSTimer:Class  
(NoMethodError)


Do you have a preferred method for doing backgound tasks in MacRuby  
- perhaps separate threads?


Thanks,
Bob Rice

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] NSTimer

2009-10-11 Thread Jordan K. Hubbard


On Oct 11, 2009, at 9:19 AM, Robert Rice wrote:

Do you have a preferred method for doing backgound tasks in MacRuby  
- perhaps separate threads?


I would say GCD is probably your best bet for this, since you can  
simply arrange to have a ruby block execute when your timer fires.


Of course, now that I go looking for documentation in the MacRuby  
source tree which describes how to do timers "the ruby way", I can't  
find any, but I'm sure it's hiding in there somewhere, right guys? :)


- Jordan

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] NSTimer

2009-10-11 Thread Robert Rice

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:


Hi Bob,

(you are going to kick yourself) you have misplaced the colon  
between target and self  - there is a comma there, and the colon has  
been placed in front of "target", so the method is not being  
recognised.


eg:
@synchro_timer = NSTimer.scheduledTimerWithTimeInterval 
(TIME_INTERVAL, target:self, selector:"synchronise_with_server:",  
userInfo:nil, repeats:true)



as for threads - maybe someone else could chime in with a preference  
- but I do it the Cocoa way (eg http Connection delegates or timers)  
- but for data crunching using all cores I will use something like  
Laurent's barber shop code: http://www.macruby.org/blog/2009/10/07/macruby05b1.html 
.



J

On Oct 11, 2009, at 6:19 PM, Robert Rice wrote:


Congratulations MacRuby Development Team:

My application almost runs now in MacRuby.

Is NSTimer class supported in MacRuby?

I was doing background processing using NSTimer as follows:

@timer = NSTimer.scheduledTimerWithTimeInterval( 5.0, :target,  
self, :selector, :periodicUpdate, :userInfo, nil, :repeats, true )


but this now gives me the error:

undefined method `scheduledTimerWithTimeInterval' for NSTimer:Class  
(NoMethodError)


Do you have a preferred method for doing backgound tasks in MacRuby  
- perhaps separate threads?


Thanks,
Bob Rice

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] NSTimer

2009-10-11 Thread Matt Aimonetti
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  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:
>
> Hi Bob,
> (you are going to kick yourself) you have misplaced the colon between
> target and self  - there is a comma there, and the colon has been placed in
> front of "target", so the method is not being recognised.
>
> eg:
> @synchro_timer = NSTimer.scheduledTimerWithTimeInterval(TIME_INTERVAL,
> target:self, selector:"synchronise_with_server:", userInfo:nil,
> repeats:true)
>
>
> as for threads - maybe someone else could chime in with a preference - but
> I do it the Cocoa way (eg http Connection delegates or timers) - but for
> data crunching using all cores I will use something like Laurent's barber
> shop code: http://www.macruby.org/blog/2009/10/07/macruby05b1.html.
>
>
> J
>
> On Oct 11, 2009, at 6:19 PM, Robert Rice wrote:
>
> Congratulations MacRuby Development Team:
> My application almost runs now in MacRuby.
>
> Is NSTimer class supported in MacRuby?
>
> I was doing background processing using NSTimer as follows:
>
> @timer = NSTimer.scheduledTimerWithTimeInterval( 5.0, :target, self,
> :selector, :periodicUpdate, :userInfo, nil, :repeats, true )
>
> but this now gives me the error:
>
> *undefined method `scheduledTimerWithTimeInterval' for NSTimer:Class
> (NoMethodError)*
> *
> *
> *Do you have a preferred method for doing backgound tasks in MacRuby -
> perhaps separate threads?
>
> Thanks,
> Bob Rice
>
> *
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #370: Inconsistency between macruby and ruby in a simple class

2009-10-11 Thread MacRuby
#370: Inconsistency between macruby and ruby in a simple class
---+
 Reporter:  kfow...@…  |Owner:  lsansone...@…
 Type:  defect |   Status:  closed   
 Priority:  major  |Milestone:  MacRuby 0.5  
Component:  MacRuby|   Resolution:  fixed
 Keywords: |  
---+

Comment(by lsansone...@…):

 Indeed, there seems to be a problem in #inspect when the receiver has at
 least one instance variable:

 {{{
 $ ./miniruby -e "class Foo; def initialize; @foo=42; end; end; p
 Foo.new.inspect"
 "##-"
 $ ruby19 -e "class Foo; def initialize; @foo=42; end; end; p
 Foo.new.inspect"
 "#"
 }}}

 Could you open a new ticket about this?

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] macruby on iphone (again) - options and way forward

2009-10-11 Thread Laurent Sansonetti

Hi John :)

On Oct 11, 2009, at 1:53 AM, John Shea wrote:


Hello everyone.

So I think this topic is going to rear its ugly/pretty head until a  
solution becomes available, and I myself would really like to be  
able to use macruby code on the iphone.


So I have put down my naive thoughts as to what are the issues.

I am a complete novice when it comes to GC, so I am sorry if this is  
all obvious or erroneous - but the important part is the discussion  
- which i hope many of you will add to.


Anyway it could be that I don't know enough about the subject to  
make sense of it. But a way to perhaps getting more people to work  
on getting macruby on the phone could be:


1. Describe the current GC situation on the mac & macruby in terms  
of architecture.
2. Describe an appropriate architecture for how GC would work on the  
iphone, how the programmer interacts with it in coding or compiling.
3. Describe the various parts of work that have to be done to to  
implement 2.
4. Make some suggestions of similar coding efforts or current code  
files or other references that people can use/copy to build a proof  
of principle


I agree that having a description of the plan somewhere might help.


The following are my versions of 1 and 2:

Point 1:
My assumption is that currently macruby hooks into objective c's GC  
- autozone (this one ? http://www.opensource.apple.com/source/autozone/autozone-77.1/ 
) via ruby's ObjectSpace.


Point 2:
The iphone does not have GC so therefore in order to run macruby  
something needs to collect the garbage.


These are correct.

My other assumption is that you cannot run interpreted code on the  
iphone (or iphone simulator) so when developing for iphone the ruby  
code would need to be compiled during the build phase.


Also correct.


So I can think of two ways to do collect the garbage.

Firstly port autozone to the iphone - integrate macruby more or less  
as now - include it as a framework or something.

However,
 - i am concerned that the separate autozone thread(s) may not play  
well with the iphone processor
 - in addition the threads need to be interruptible, when phone  
calls come in or the home button is pressed - i can imagine  
including the autozone controller in the responder chain (in order  
to receive the shutdown command) would not be trivial.


One could technically port autozone to the iPhone so that the MacRuby  
runtime can still use it, but it wouldn't work for Cocoa APIs still.  
The version of Cocoa on the iPhone is not autozone-aware (objects  
can't be allocated from the autozone, no write barriers, etc.) so this  
solution would still need to use the default malloc zone for pure  
Objective-C objects and retain/release them.


I am wondering if the above complexity is why Laurent always refers  
to "emulating" autozone rather than including it or porting it.


The other option i can think of is in the build phase insert the  
necessary retains, releases and autoreleases into the code. By either:


	i) the developer including the calls manually, which are then  
compiled/translated to the appropriate C/ObjC commands. (I have gone  
off this idea a bit because the code would be hard to test in  
isolation (unless there were special compiler codes normally ignored  
by the ruby interpreter), and would make it hard to drop in any nice  
ruby code/libraries, and later on hard to fix code if an official GC  
ever arrives).


	ii) have a script which traverses the ruby code - and adds dealloc  
methods for instance methods, adds releases to scope bound variables  
etc, etc.
(I like this option the best, though i have little idea how to  
implement)


This is definitely the idea I have in mind. I think we can do both.  
First the compiler should be smart enough to automatically insert  
autorelease pools in the code. Second, the developer will still have  
the possibility to create an autorelease pool by himself for edge  
cases that the compiler is not able to handle.


Laurent
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] NSTimer

2009-10-11 Thread Robert Rice

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   
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
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] NSTimer

2009-10-11 Thread Laurent Sansonetti
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  
 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
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby 0.5 beta 1

2009-10-11 Thread Martin Hess
Matt, Is this the page? http://macruby.icoretech.org/details/29 It  
doesn't really show which tests are failing/skipped.


On Oct 10, 2009, at 11:54 AM, Matt Aimonetti wrote:


Wayne, did you try Ernie's script?

Martin, we actually do, if you check the nightly builds page, and  
click on details, you can see the logs and the spec results.


- Matt

On Sat, Oct 10, 2009 at 10:13 AM, Martin Hess   
wrote:

Congratulations! Truly an amazing effort.

Just curious, is there a webpage to view the daily rubyspec results  
in detail?



On Oct 7, 2009, at 9:13 PM, Laurent Sansonetti wrote:

Hi,

The first beta release of MacRuby 0.5 is out! I prepared some notes  
here:


http://www.macruby.org/blog/2009/10/07/macruby05b1.html

The goal is to go through a few beta releases before releasing the  
final 0.5.


Please give it a try and report us bugs & feedback :)

Laurent
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] NSTimer

2009-10-11 Thread Robert Rice

Hi Laurent:

NSTimer wil work well for my app except I will still need to use a  
thread to read data from my GPS receiver unless I can find a non- 
blocking serial I/O package.


I see that Apple has developed a "Core Location Framework" for the  
iPhone but I don't see any documentation to indicate that I could use  
it in a Cocoa environment. That would be a preferable solution not  
only for portability but also to solve the problem I have had for  
years with multiple applications trying to read data from my receiver  
at the same time. The Core Location Framework should work on OSX if it  
can find any suitable GPS receiver attached to the local network; then  
GPS nav apps could get the position info from the framework as on the  
iPhone. Is there any way to suggest this project to Apple?


Bob Rice


On Oct 11, 2009, at 3:58 PM, Laurent Sansonetti wrote:

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:



___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] NSTimer

2009-10-11 Thread Jordan K. Hubbard


On Oct 11, 2009, at 1:45 PM, Robert Rice wrote:

NSTimer wil work well for my app except I will still need to use a  
thread to read data from my GPS receiver unless I can find a non- 
blocking serial I/O package.


[ jkh jumps up and down yelling "GCD!  GCD!" until he is dragged away]

The Core Location Framework should work on OSX if it can find any  
suitable GPS receiver attached to the local network; then GPS nav  
apps could get the position info from the framework as on the  
iPhone. Is there any way to suggest this project to Apple?


File an enhancement request radar via http://bugreport.apple.com.   
Believe it or not, those do get read!


- Jordan

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] NSTimer

2009-10-11 Thread s.ross
Well in the meantime, doesn't a daemon that issues distributed  
notifications accomplish a similar goal?


Hunted and pecked from my iPhone

On Oct 11, 2009, at 2:10 PM, "Jordan K. Hubbard"  wrote:



On Oct 11, 2009, at 1:45 PM, Robert Rice wrote:

NSTimer wil work well for my app except I will still need to use a  
thread to read data from my GPS receiver unless I can find a non- 
blocking serial I/O package.


[ jkh jumps up and down yelling "GCD!  GCD!" until he is dragged away]

The Core Location Framework should work on OSX if it can find any  
suitable GPS receiver attached to the local network; then GPS nav  
apps could get the position info from the framework as on the  
iPhone. Is there any way to suggest this project to Apple?


File an enhancement request radar via http://bugreport.apple.com.   
Believe it or not, those do get read!


- Jordan

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] NSTimer

2009-10-11 Thread Robert Rice

Thanks: I filed the request.
Bob Rice

On Oct 11, 2009, at 5:10 PM, Jordan K. Hubbard wrote:



On Oct 11, 2009, at 1:45 PM, Robert Rice wrote:

NSTimer wil work well for my app except I will still need to use a  
thread to read data from my GPS receiver unless I can find a non- 
blocking serial I/O package.


[ jkh jumps up and down yelling "GCD!  GCD!" until he is dragged away]

The Core Location Framework should work on OSX if it can find any  
suitable GPS receiver attached to the local network; then GPS nav  
apps could get the position info from the framework as on the  
iPhone. Is there any way to suggest this project to Apple?


File an enhancement request radar via http://bugreport.apple.com.   
Believe it or not, those do get read!


- Jordan

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel



___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby 0.5 beta 1

2009-10-11 Thread Matt Aimonetti
That's the page, it will list all the failing specs, to see the details of
the skipped tag, check:
http://svn.macosforge.org/repository/ruby/MacRuby/trunk/spec/frozen/tags/macruby/

- Matt



On Sun, Oct 11, 2009 at 1:43 PM, Martin Hess  wrote:

> Matt, Is this the page? http://macruby.icoretech.org/details/29 It doesn't
> really show which tests are failing/skipped.
> On Oct 10, 2009, at 11:54 AM, Matt Aimonetti wrote:
>
> Wayne, did you try Ernie's script?
>
> Martin, we actually do, if you check the nightly builds page, and click on
> details, you can see the logs and the spec results.
>
> - Matt
>
> On Sat, Oct 10, 2009 at 10:13 AM, Martin Hess  wrote:
>
>> Congratulations! Truly an amazing effort.
>>
>> Just curious, is there a webpage to view the daily rubyspec results in
>> detail?
>>
>>
>> On Oct 7, 2009, at 9:13 PM, Laurent Sansonetti wrote:
>>
>>  Hi,
>>>
>>> The first beta release of MacRuby 0.5 is out! I prepared some notes here:
>>>
>>> http://www.macruby.org/blog/2009/10/07/macruby05b1.html
>>>
>>> The goal is to go through a few beta releases before releasing the final
>>> 0.5.
>>>
>>> Please give it a try and report us bugs & feedback :)
>>>
>>> Laurent
>>> ___
>>> MacRuby-devel mailing list
>>> [email protected]
>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>>
>>
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Building MacRuby r2765 with llvm r82747 failed on core duo macbook, Leopard

2009-10-11 Thread hiroshi saito
Hi Laurent,

> Strange. Could you try the following in the same directory and paste us the
> output?
>
> $ ./miniruby -I. -I./lib bin/rubyc --internal -C "rbconfig.rb" -o
> "./rbconfig.rbo" -V

MacRuby - Laurent にコマンド実行結果を送る

Hi Laurent,



$ ./miniruby -I. -I./lib bin/rubyc --internal -C "rbconfig.rb" -o
"./rbconfig.rbo" -V

$ PATH=$PATH:~/Desktop/wc/MacRuby/llvm-trunk/Release/bin ./miniruby
-I. -I./lib bin/rubyc --internal -C "rbconfig.rb" -o "./rbconfig.rbo"
-V
./miniruby --emit-llvm
"/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/rbconfig.bc"
MREP_-107041289 "rbconfig.rb"
/Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/Release/bin/llc -f
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/rbconfig.bc
-o=/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/rbconfig.s
-march=x86-64 -enable-eh
/usr/bin/gcc -c -arch x86_64
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/rbconfig.s -o
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/rbconfig.o
/usr/bin/g++ /var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/main.c
-dynamic -bundle -undefined suppress -flat_namespace -arch x86_64 -L.
-lmacruby /var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/rbconfig.o
-o ./rbconfig.rbo
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/main.c:2: error:
expected initializer before ‘-’ token
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/main.c: In function
‘void __init__()’:
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/main.c:5: error:
‘MREP_’ was not declared in this scope
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/main.c:5: error:
‘107041289’ cannot be used as a function
Error when executing `/usr/bin/g++
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/main.c -dynamic
-bundle -undefined suppress -flat_namespace -arch x86_64 -L. -lmacruby
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/rbconfig.o -o
./rbconfig.rbo'

At the line around 100 of bin/rubyc:

init_func = "MREP_#{File.read(path).hash}"

I extracted this line and execute it with -e option

$ ./miniruby -I. -I./lib -e "p File.read('rbconfig.rb').hash"
-107041289

I suppose that String#hash method will return an integer, that could
be nagative value. I don't know why on other environments
the method return positive value everytime...

Anyway, I hack the line of code to continue like that:

Index: bin/rubyc
===
--- bin/rubyc   (revision 2779)
+++ bin/rubyc   (working copy)
@@ -96,7 +96,7 @@
 output ||= File.join(File.dirname(path), base + '.o')

 # Generate init function (must be unique).
-init_func = "MREP_#{File.read(path).hash}"
+init_func = "MREP_#{File.read(path).hash.abs}"

 # Compile the file into LLVM bitcode.
 bc = gen_tmpfile(base, 'bc')


It passed, but I got another error.

$ ./miniruby -I. -I./lib bin/rubyc --internal -C "lib/date.rb" -o "lib/date.rbo"
Error when executing `./miniruby --emit-llvm
"/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/date.bc"
MREP_146681552 "lib/date.rb"'
rake aborted!

The exact error of the executed subcommand is:

$ ./miniruby --emit-llvm
"/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/date.bc"
MREP_146681552 "lib/date.rb"
unrecognized literal `864000' (class `Bignum' type 10)
zsh: abort  ./miniruby --emit-llvm  MREP_146681552 "lib/date.rb"

I doubt that numeric or integer part of my llvm or macruby went wrong,
it possibly caused by something bad in my environment.
If it is true, farther investigation will be waste of time to you and
me, I'm sorry, but I'll give up for now.


> I never got these warnings before on several machines, we build with -Werror
> since months and nobody reported this problem too.
>
> I suspect it has something to do with your LLVM installation, but I'm not
> sure. These warnings are probably because of -Winline that we only pass when
> building dispatcher.cpp (to make sure gcc won't lie to us).

I agreed that.

Thanks anyway.
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Building MacRuby r2765 with llvm r82747 failed on core duo macbook, Leopard

2009-10-11 Thread Vincent Isambart



At the line around 100 of bin/rubyc:

   init_func = "MREP_#{File.read(path).hash}"

I extracted this line and execute it with -e option

$ ./miniruby -I. -I./lib -e "p File.read('rbconfig.rb').hash"
-107041289

I suppose that String#hash method will return an integer, that could
be nagative value. I don't know why on other environments
the method return positive value everytime...


Laurent, wouldn't it be better to use something like a SHA1:
require 'digest/sha1'
init_func = "MREP_#{Digest::SHA1.hexdigest(File.read(path))}"

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Building MacRuby r2765 with llvm r82747 failed on core duo macbook, Leopard

2009-10-11 Thread Laurent Sansonetti

On Oct 11, 2009, at 7:42 PM, Vincent Isambart wrote:

At the line around 100 of bin/rubyc:

  init_func = "MREP_#{File.read(path).hash}"

I extracted this line and execute it with -e option

$ ./miniruby -I. -I./lib -e "p File.read('rbconfig.rb').hash"
-107041289

I suppose that String#hash method will return an integer, that could
be nagative value. I don't know why on other environments
the method return positive value everytime...


Laurent, wouldn't it be better to use something like a SHA1:
require 'digest/sha1'
init_func = "MREP_#{Digest::SHA1.hexdigest(File.read(path))}"


miniruby cannot load C extensions, so this isn't an option.

Laurent
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Building MacRuby r2765 with llvm r82747 failed on core duo macbook, Leopard

2009-10-11 Thread Laurent Sansonetti

Hi Hiroshi-san,

On Oct 11, 2009, at 7:11 PM, hiroshi saito wrote:


Hi Laurent,

Strange. Could you try the following in the same directory and  
paste us the

output?

$ ./miniruby -I. -I./lib bin/rubyc --internal -C "rbconfig.rb" -o
"./rbconfig.rbo" -V


MacRuby - Laurent にコマンド実行結果を送る

Hi Laurent,



$ ./miniruby -I. -I./lib bin/rubyc --internal -C "rbconfig.rb" -o
"./rbconfig.rbo" -V

$ PATH=$PATH:~/Desktop/wc/MacRuby/llvm-trunk/Release/bin ./miniruby
-I. -I./lib bin/rubyc --internal -C "rbconfig.rb" -o "./rbconfig.rbo"
-V
./miniruby --emit-llvm
"/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/rbconfig.bc"
MREP_-107041289 "rbconfig.rb"
/Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/Release/bin/llc -f
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/rbconfig.bc
-o=/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/rbconfig.s
-march=x86-64 -enable-eh
/usr/bin/gcc -c -arch x86_64
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/rbconfig.s -o
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/rbconfig.o
/usr/bin/g++ /var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/main.c
-dynamic -bundle -undefined suppress -flat_namespace -arch x86_64 -L.
-lmacruby /var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/rbconfig.o
-o ./rbconfig.rbo
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/main.c:2: error:
expected initializer before ‘-’ token
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/main.c: In function
‘void __init__()’:
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/main.c:5: error:
‘MREP_’ was not declared in this scope
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/main.c:5: error:
‘107041289’ cannot be used as a function
Error when executing `/usr/bin/g++
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/main.c -dynamic
-bundle -undefined suppress -flat_namespace -arch x86_64 -L. -lmacruby
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/rbconfig.o -o
./rbconfig.rbo'

At the line around 100 of bin/rubyc:

   init_func = "MREP_#{File.read(path).hash}"

I extracted this line and execute it with -e option

$ ./miniruby -I. -I./lib -e "p File.read('rbconfig.rb').hash"
-107041289

I suppose that String#hash method will return an integer, that could
be nagative value. I don't know why on other environments
the method return positive value everytime...


Indeed, it's weird that nobody reported that problem, yet.


Anyway, I hack the line of code to continue like that:

Index: bin/rubyc
===
--- bin/rubyc   (revision 2779)
+++ bin/rubyc   (working copy)
@@ -96,7 +96,7 @@
output ||= File.join(File.dirname(path), base + '.o')

# Generate init function (must be unique).
-init_func = "MREP_#{File.read(path).hash}"
+init_func = "MREP_#{File.read(path).hash.abs}"

# Compile the file into LLVM bitcode.
bc = gen_tmpfile(base, 'bc')


I committed this change in r2781.


It passed, but I got another error.

$ ./miniruby -I. -I./lib bin/rubyc --internal -C "lib/date.rb" -o  
"lib/date.rbo"

Error when executing `./miniruby --emit-llvm
"/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/date.bc"
MREP_146681552 "lib/date.rb"'
rake aborted!

The exact error of the executed subcommand is:

$ ./miniruby --emit-llvm
"/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/date.bc"
MREP_146681552 "lib/date.rb"
unrecognized literal `864000' (class `Bignum' type 10)
zsh: abort  ./miniruby --emit-llvm  MREP_146681552 "lib/date.rb"

I doubt that numeric or integer part of my llvm or macruby went wrong,
it possibly caused by something bad in my environment.
If it is true, farther investigation will be waste of time to you and
me, I'm sorry, but I'll give up for now.


In fact, this crash is because of a limitation in the AOT compiler, I  
forgot to handle literal bignums.


$ ./miniruby --emit-llvm foo omg -e "p 1267650600228229401496703205376"
unrecognized literal `1267650600228229401496703205376' (class `Bignum'  
type 10)

Abort trap

In any case I will fix it. But I don't know yet why this problem hits  
you when compiling lib/date.rb. The same file appears to compile fine  
for the rest of us.


It's not a waste of time at all because you found legitimate bugs :-)  
ありがとうございます!


Laurent
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Building MacRuby r2765 with llvm r82747 failed on core duo macbook, Leopard

2009-10-11 Thread Laurent Sansonetti

On Oct 11, 2009, at 10:10 PM, Laurent Sansonetti wrote:

Hi Hiroshi-san,

On Oct 11, 2009, at 7:11 PM, hiroshi saito wrote:


Hi Laurent,

Strange. Could you try the following in the same directory and  
paste us the

output?

$ ./miniruby -I. -I./lib bin/rubyc --internal -C "rbconfig.rb" -o
"./rbconfig.rbo" -V


MacRuby - Laurent にコマンド実行結果を送る

Hi Laurent,



$ ./miniruby -I. -I./lib bin/rubyc --internal -C "rbconfig.rb" -o
"./rbconfig.rbo" -V

$ PATH=$PATH:~/Desktop/wc/MacRuby/llvm-trunk/Release/bin ./miniruby
-I. -I./lib bin/rubyc --internal -C "rbconfig.rb" -o "./rbconfig.rbo"
-V
./miniruby --emit-llvm
"/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/rbconfig.bc"
MREP_-107041289 "rbconfig.rb"
/Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/Release/bin/llc -f
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/rbconfig.bc
-o=/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/rbconfig.s
-march=x86-64 -enable-eh
/usr/bin/gcc -c -arch x86_64
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/rbconfig.s -o
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/rbconfig.o
/usr/bin/g++ /var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/main.c
-dynamic -bundle -undefined suppress -flat_namespace -arch x86_64 -L.
-lmacruby /var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/ 
rbconfig.o

-o ./rbconfig.rbo
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/main.c:2: error:
expected initializer before ‘-’ token
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/main.c: In function
‘void __init__()’:
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/main.c:5: error:
‘MREP_’ was not declared in this scope
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/main.c:5: error:
‘107041289’ cannot be used as a function
Error when executing `/usr/bin/g++
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/main.c -dynamic
-bundle -undefined suppress -flat_namespace -arch x86_64 -L. - 
lmacruby

/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/rbconfig.o -o
./rbconfig.rbo'

At the line around 100 of bin/rubyc:

  init_func = "MREP_#{File.read(path).hash}"

I extracted this line and execute it with -e option

$ ./miniruby -I. -I./lib -e "p File.read('rbconfig.rb').hash"
-107041289

I suppose that String#hash method will return an integer, that could
be nagative value. I don't know why on other environments
the method return positive value everytime...


Indeed, it's weird that nobody reported that problem, yet.


Anyway, I hack the line of code to continue like that:

Index: bin/rubyc
===
--- bin/rubyc   (revision 2779)
+++ bin/rubyc   (working copy)
@@ -96,7 +96,7 @@
   output ||= File.join(File.dirname(path), base + '.o')

   # Generate init function (must be unique).
-init_func = "MREP_#{File.read(path).hash}"
+init_func = "MREP_#{File.read(path).hash.abs}"

   # Compile the file into LLVM bitcode.
   bc = gen_tmpfile(base, 'bc')


I committed this change in r2781.


It passed, but I got another error.

$ ./miniruby -I. -I./lib bin/rubyc --internal -C "lib/date.rb" -o  
"lib/date.rbo"

Error when executing `./miniruby --emit-llvm
"/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/date.bc"
MREP_146681552 "lib/date.rb"'
rake aborted!

The exact error of the executed subcommand is:

$ ./miniruby --emit-llvm
"/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-TI/-Tmp-/date.bc"
MREP_146681552 "lib/date.rb"
unrecognized literal `864000' (class `Bignum' type 10)
zsh: abort  ./miniruby --emit-llvm  MREP_146681552 "lib/date.rb"

I doubt that numeric or integer part of my llvm or macruby went  
wrong,

it possibly caused by something bad in my environment.
If it is true, farther investigation will be waste of time to you and
me, I'm sorry, but I'll give up for now.


In fact, this crash is because of a limitation in the AOT compiler,  
I forgot to handle literal bignums.


$ ./miniruby --emit-llvm foo omg -e "p  
1267650600228229401496703205376"
unrecognized literal `1267650600228229401496703205376' (class  
`Bignum' type 10)

Abort trap

In any case I will fix it. But I don't know yet why this problem  
hits you when compiling lib/date.rb. The same file appears to  
compile fine for the rest of us.


Quick investigation:

$ ./miniruby -e 'p 864000.class'
Fixnum
$ arch -i386 ./miniruby -e 'p 864000.class'
Bignum

I think that your miniruby runs in 32-bit mode, which should be the  
case if your computer is a Core Duo as mentioned in the subject of  
this e-mail.


32-bit has not been tested a lot, which could explain these bugs :)

Laurent
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Building MacRuby r2765 with llvm r82747 failed on core duo macbook, Leopard

2009-10-11 Thread Laurent Sansonetti

On Oct 11, 2009, at 10:10 PM, Laurent Sansonetti wrote:
In fact, this crash is because of a limitation in the AOT compiler,  
I forgot to handle literal bignums.


$ ./miniruby --emit-llvm foo omg -e "p  
1267650600228229401496703205376"
unrecognized literal `1267650600228229401496703205376' (class  
`Bignum' type 10)

Abort trap


I fixed the problem in r2782.

$ cat t.rb
p 1267650600228229401496703205376
$ macrubyc t.rb -o /tmp/t
$ /tmp/t
1267650600228229401496703205376

Laurent
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel