Re: [MacRuby-devel] political rumination

2010-04-10 Thread Laurent Sansonetti
Guys, this isn't the right place to discuss this, I'm afraid. I recommend using 
an official channel such as the Apple Developer Relations.

Thanks :-)

Laurent

On Apr 9, 2010, at 11:16 PM, steve ross wrote:

> I don't know whether anyone will provide a rationale for the contract 
> language, but here's an interesting analysis of it:
> 
> http://daringfireball.net/2010/04/why_apple_changed_section_331
> 
> Apple makes a lot of smart calls that seem stupid or selfish at first. A 
> number of folks on Twitter have jumped on this contract language as a stupid 
> and/or selfish call. I just don't know.
> 
> Steve Ross
> 
> 
> On Apr 9, 2010, at 10:23 PM, Matthew Winter wrote:
>> 
>> Hi,
>> 
>> I asked the same question via Twitter, however I do not expect to get an 
>> answer at this stage.
>> 
>> If my understanding is correct about why Apple has done this, in that it is 
>> more due to "the need to support the new multitasking APIs in iPhone 4.0. 
>> The system will now be evaluating apps as they run in order to implement 
>> smart multitasking. It can't do this if apps are running within a runtime or 
>> are cross compiled with a foreign structure that doesn't behave identically 
>> to a native C/C++/Obj-C app."
>> 
>> Then based on this, I see no reason why they should not let MacRuby be 
>> blessed as this essentially is making use of the same Objective-C runtime 
>> and API's.
>> 
>> There are now quite a few ways to develop apps for the iPhone & iPad that do 
>> not involve Obj-C. I wonder if it is just the case of recompiling the base 
>> libraries or making the base libraries aware of Apple's multitasking needs, 
>> and then for each to be blessed by Apple, or am I being way to optimistic 
>> that this will happen.
>> 
>> Regards
>> Matthew Winter
>> 
>> 
>> On 10/04/2010, at 11:37 AM, Rich Morin wrote:
>> 
>>> I suspect that no Apple employee will be able to comment on
>>> this, but I _really_ hope MacRuby will be among the blessed
>>> languages for the iPad, etc.
>>> 
>>> -r
>>> -- 
> 
> ___
> 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] political rumination

2010-04-10 Thread Rich Morin
At 1:20 AM -0700 4/10/10, Laurent Sansonetti wrote:
> Guys, this isn't the right place to discuss this, I'm afraid.  I
> recommend using an official channel such as the Apple Developer
> Relations.
>
> Thanks :-)

Not surprisingly, I disagree.  The "official channel" does not
offer a forum in which MacRuby aficionados can discuss their
aspirations, fears, hopes, and opinions.

Of course, if Apple wants to close down this sort of discussion
on macosforge, it certainly can. Then again, I'm sure other venues
will be happy to get the traffic...

-r
-- 
http://www.cfcl.com/rdmRich Morin
http://www.cfcl.com/rdm/resume [email protected]
http://www.cfcl.com/rdm/weblog +1 650-873-7841

Technical editing and writing, programming, system design
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] are framework extern variables visible in Mac Ruby?

2010-04-10 Thread russell muetzelfeldt
> Hi Russell,
> 
> Sorry for the late response.

no worries... :)


> OpenDirectory.framework ships with BridgeSupport annotations, so doing 
> "framework 'OpenDirectory'" should merge all symbols into MacRuby. If some 
> are missing, it's likely a bug in the BridgeSupport generator, that should be 
> reported via http://bugreport.apple.com.

cool - shall do... I wasn't doing that until I had some evidence it wasn't just 
me missing something...


> Fortunately, we are working on a new BridgeSupport generator which might 
> already fix this issue, but it's not ready yet for prime time. In the 
> meantime I recommend to wrap the symbols/APIs you need inside an Objective-C 
> class and call it from MacRuby.

I've ended up just running the relevant OpenDirectory headers through perl to 
generate an opendirectory/constants.rb that I pull into the other stuff I'm 
doing - pretty straightforward once I figured out where the strings I was after 
lived... in case anyone finds it useful, here's gen-constants.sh which pulls in 
both the enum constants and the extern NSString "constants" into a single ruby 
file...


#!/bin/sh

target_dir=$(dirname "$0")/../lib/opendirectory
target_file=${target_dir}/constants.rb

cat < $target_file
module OpenDirectory
  module Constants
HEADER

# enum constants
curl 
'http://www.opensource.apple.com/source/OpenDirectory/OpenDirectory-57/CFOpenDirectoryConstants.h?txt'
 | \
  perl -ne 'next unless /^\s*kOD([A-Za-z]+)\s*=\s*(0x[0-9a-fA-F]+)/; print qq(  
  $1 = $2\n)' >> $target_file

# string "constants"
curl 
'http://www.opensource.apple.com/source/OpenDirectory/OpenDirectory-57/CFOpenDirectoryConstants.c?txt'
 | \
  perl -ne 'next unless 
/^\s*CFStringRef\s+kOD([[:alpha:]]+)\s*=\s*CFSTR\((".*?")\)/; print qq($1 = 
$2\n)' >> $target_file

cat <> $target_file
  end
end
FOOTER

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


[MacRuby-devel] Garbage Collector in MacRuby

2010-04-10 Thread Daniel Lopes
Hello, I would like to know more about the garbage collector. In Obj-c even
when we have GC enabled we should set nil to the vars (which sometimes is
also useful in pure ruby). Correct me if I'm wrong but in MacRuby we can't
use GDB, right? We still able to use profile tools? I should set all vars to
nil or it will be treated like normal ruby code and I need set to nil only
the objects that I want to be released now?

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


Re: [MacRuby-devel] political rumination

2010-04-10 Thread steve ross
On Apr 10, 2010, at 1:20 AM, Laurent Sansonetti wrote:
> 
> Guys, this isn't the right place to discuss this, I'm afraid. I recommend 
> using an official channel such as the Apple Developer Relations.
> 
> Thanks :-)
> 
> Laurent

I understand and respect your perspective, but when a developer makes an 
investment in learning a tool -- particularly an evolving one with a ton of 
promise -- it doesn't seem off-topic to discuss its future. Especially when 
there is news that might affect its applicability to one of the more promising 
platforms it could target.

Just my $.02

> On Apr 9, 2010, at 11:16 PM, steve ross wrote:
> 
>> I don't know whether anyone will provide a rationale for the contract 
>> language, but here's an interesting analysis of it:
>> 
>> http://daringfireball.net/2010/04/why_apple_changed_section_331
>> 
>> Apple makes a lot of smart calls that seem stupid or selfish at first. A 
>> number of folks on Twitter have jumped on this contract language as a stupid 
>> and/or selfish call. I just don't know.
>> 
>> Steve Ross
>> 
>> 
>> On Apr 9, 2010, at 10:23 PM, Matthew Winter wrote:
>>> 
>>> Hi,
>>> 
>>> I asked the same question via Twitter, however I do not expect to get an 
>>> answer at this stage.
>>> 
>>> If my understanding is correct about why Apple has done this, in that it is 
>>> more due to "the need to support the new multitasking APIs in iPhone 4.0. 
>>> The system will now be evaluating apps as they run in order to implement 
>>> smart multitasking. It can't do this if apps are running within a runtime 
>>> or are cross compiled with a foreign structure that doesn't behave 
>>> identically to a native C/C++/Obj-C app."
>>> 
>>> Then based on this, I see no reason why they should not let MacRuby be 
>>> blessed as this essentially is making use of the same Objective-C runtime 
>>> and API's.
>>> 
>>> There are now quite a few ways to develop apps for the iPhone & iPad that 
>>> do not involve Obj-C. I wonder if it is just the case of recompiling the 
>>> base libraries or making the base libraries aware of Apple's multitasking 
>>> needs, and then for each to be blessed by Apple, or am I being way to 
>>> optimistic that this will happen.
>>> 
>>> Regards
>>> Matthew Winter
>>> 
>>> 
>>> On 10/04/2010, at 11:37 AM, Rich Morin wrote:
>>> 
 I suspect that no Apple employee will be able to comment on
 this, but I _really_ hope MacRuby will be among the blessed
 languages for the iPad, etc.
 
 -r

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


Re: [MacRuby-devel] Garbage Collector in MacRuby

2010-04-10 Thread Laurent Sansonetti
Hi Daniel,

MacRuby uses the Objective-C garbage collector, and also runs the Objective-C 
runtime in GC mode. It basically means that you can use Cocoa objects without 
the need to retain/release them, and they will be automatically collected at 
runtime once there is no reference to them anymore. This is also true for pure 
Ruby code.

Please note that the collector is not deterministic and runs on its own 
thread(s) (and also collects memory from there). So, setting variables to nil 
or calling GC.start can help but there is no guarantee that the objects will be 
immediately freed. 

In general you should not care about these issues. Just don't think about 
managing memory and it should work fine. If you find a problematic case, let us 
know :-)

Laurent

On Apr 10, 2010, at 8:44 AM, Daniel Lopes wrote:

> Hello, I would like to know more about the garbage collector. In Obj-c even 
> when we have GC enabled we should set nil to the vars (which sometimes is 
> also useful in pure ruby). Correct me if I'm wrong but in MacRuby we can't 
> use GDB, right? We still able to use profile tools? I should set all vars to 
> nil or it will be treated like normal ruby code and I need set to nil only 
> the objects that I want to be released now?
> 
> Thanks.
> ___
> 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] Simple Example Fails

2010-04-10 Thread Robert Love


I'm trying to learn Macruby and am using Apple's page as a guide:

http://developer.apple.com/mac/articles/scriptingautomation/cocoaappswithmacruby.html

I'm using macirb to follow the example and getting complete different answers.  
Is the web page wrong?  Is Macruby wrong?  Am I doing something wrong?


irb(main):001:0> h = {}
=> {}
irb(main):002:0> h.class
=> NSMutableDictionary
irb(main):003:0> h.setObject 'foo', forKey:42
=> {1=>"foo"}
irb(main):004:0> 


Why isn't the key 42 like the Apple web page shows?

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


Re: [MacRuby-devel] Simple Example Fails

2010-04-10 Thread Thibault Martin-Lagardette
Hi,

What version are you using?
Since we rewrote the bridge between hash and dictionaries, it is possible that 
thing have changed since then.

However, with the latest trunk / nightlies, it should work. Here is what I get:

>> h = {}
=> {}
>> h.class
=> Hash
>> h.setObject 'foo', forKey:42
=> {42=>"foo"}

Let us know :-)

-- 
Thibault Martin-Lagardette



On Apr 10, 2010, at 18:12, Robert Love wrote:

> 
> 
> I'm trying to learn Macruby and am using Apple's page as a guide:
> 
> http://developer.apple.com/mac/articles/scriptingautomation/cocoaappswithmacruby.html
> 
> I'm using macirb to follow the example and getting complete different 
> answers.  Is the web page wrong?  Is Macruby wrong?  Am I doing something 
> wrong?
> 
> 
> irb(main):001:0> h = {}
> => {}
> irb(main):002:0> h.class
> => NSMutableDictionary
> irb(main):003:0> h.setObject 'foo', forKey:42
> => {1=>"foo"}
> irb(main):004:0> 
> 
> 
> Why isn't the key 42 like the Apple web page shows?
> 
> ___
> 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] Simple Example Fails

2010-04-10 Thread Robert Love

On Apr 10, 2010, at 8:17 PM, Thibault Martin-Lagardette wrote:

> Hi,
> 
> What version are you using?

owl:~ rlove$ macruby --version
MacRuby version 0.5 (ruby 1.9.0) [universal-darwin10.0, x86_64]


I had a nightly installed last night but then the HotCoca demos wouldn't run so 
I went and fetched 0.5 and installed it.

Maybe I should do a complete removal and then install 0.5 again.   What are the 
components to get rid of when doing a clean install?



> Since we rewrote the bridge between hash and dictionaries, it is possible 
> that thing have changed since then.
> 
> However, with the latest trunk / nightlies, it should work. Here is what I 
> get:
> 
> >> h = {}
> => {}
> >> h.class
> => Hash
> >> h.setObject 'foo', forKey:42
> => {42=>"foo"}
> 
> Let us know :-)
> 
> -- 
> Thibault Martin-Lagardette
> 
> 
> 
> On Apr 10, 2010, at 18:12, Robert Love wrote:
> 
>> 
>> 
>> I'm trying to learn Macruby and am using Apple's page as a guide:
>> 
>> http://developer.apple.com/mac/articles/scriptingautomation/cocoaappswithmacruby.html
>> 
>> I'm using macirb to follow the example and getting complete different 
>> answers.  Is the web page wrong?  Is Macruby wrong?  Am I doing something 
>> wrong?
>> 
>> 
>> irb(main):001:0> h = {}
>> => {}
>> irb(main):002:0> h.class
>> => NSMutableDictionary
>> irb(main):003:0> h.setObject 'foo', forKey:42
>> => {1=>"foo"}
>> irb(main):004:0> 
>> 
>> 
>> Why isn't the key 42 like the Apple web page shows?
>> 
>> ___
>> 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] Garbage Collector in MacRuby

2010-04-10 Thread Daniel Lopes
Thanks to answer Laurent.

On Sat, Apr 10, 2010 at 9:47 PM, Laurent Sansonetti
wrote:

> Hi Daniel,
>
> MacRuby uses the Objective-C garbage collector, and also runs the
> Objective-C runtime in GC mode. It basically means that you can use Cocoa
> objects without the need to retain/release them, and they will be
> automatically collected at runtime once there is no reference to them
> anymore. This is also true for pure Ruby code.
>
> Please note that the collector is not deterministic and runs on its own
> thread(s) (and also collects memory from there). So, setting variables to
> nil or calling GC.start can help but there is no guarantee that the objects
> will be immediately freed.
>
> In general you should not care about these issues. Just don't think about
> managing memory and it should work fine. If you find a problematic case, let
> us know :-)
>
> Laurent
>
> On Apr 10, 2010, at 8:44 AM, Daniel Lopes wrote:
>
> > Hello, I would like to know more about the garbage collector. In Obj-c
> even when we have GC enabled we should set nil to the vars (which sometimes
> is also useful in pure ruby). Correct me if I'm wrong but in MacRuby we
> can't use GDB, right? We still able to use profile tools? I should set all
> vars to nil or it will be treated like normal ruby code and I need set to
> nil only the objects that I want to be released now?
> >
> > Thanks.
> > ___
> > 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