Re: [MacRuby-devel] How do I subclass Obj-C classes in MacRuby?
I agree on that point of course they are different calls but from a ruby
point of view WHY isn't init with no args the same as initialize with no
args
So I can live with it but my preference is with ruby initialize... this is
macRuby right?
Terry
On 7/05/2010, at 6:09 PM, Thibault Martin-Lagardette wrote:
> Hi!
>
> I totally agree that it is a little confusing. But #new an #new(owner) are
> two different methods, especially in Obj-C.
> Calling A.new(arg) cannot call -init, since -init doesn't take any argument,
> so it will call any initializer method that takes one argument :-).
> This is why:
>
> class A; def initialize; end; end; # Will never be called with A.new, because
> -init will be called instead
> class A; def initialize(str); end; end; # Will be called with A.new(str),
> because -init cannot be called
>
> It simply depends on how you define your initilizer method :-)
>
> --
> Thibault Martin-Lagardette
>
>
>
> On May 6, 2010, at 21:54, Terry Moore wrote:
>
>> This is only true if you follow objc init I think... for example...
>>
>>
>> I came across this problem with NSWindowController and it took me a while to
>> figure out.
>>
>> class PasswordController < NSWindowController
>> def initialize
>> initWithWindowNibName("Password") ##FAIL Never called! init called
>> instead
>> end
>>
>> class PrefController < NSWindowController
>>
>> def initialize(owner)
>> @owner = owner
>> initWithWindowNibName("Preferences")
>> end
>> end
>>
>>
>> The first example fails and so I finally got that I needed the init method
>> to make the window appear but I couldn't figure out why the second option
>> worked.
>>
>> Must have been a long day but clearly if designate an initialize with a
>> param init is bypased...
>>
>> so if I take the
>> class A > def initialize(b)
>> super
>> end
>> end
>> example and do A.new("hi there") gives
>>
>> initialize
>> => "hi there"
>>
>> so what is going on? I think there might need to be some clarity.
>>
>> Terry
>>
>>
>> ___
>> 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] How do I subclass Obj-C classes in MacRuby?
This is only true if you follow objc init I think... for example...
I came across this problem with NSWindowController and it took me a while to
figure out.
class PasswordController < NSWindowController
def initialize
initWithWindowNibName("Password") ##FAIL Never called! init called instead
end
class PrefController < NSWindowController
def initialize(owner)
@owner = owner
initWithWindowNibName("Preferences")
end
end
The first example fails and so I finally got that I needed the init method to
make the window appear but I couldn't figure out why the second option worked.
Must have been a long day but clearly if designate an initialize with a param
init is bypased...
so if I take the
class A "hi there"
so what is going on? I think there might need to be some clarity.
Terry
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] How do I subclass Obj-C classes in MacRuby?
True. To a point but there is an overlap... Object String Hash etc.
Also designated initialisers are seldom used in ruby( preference for
named params). InitWithX:y:z is perhaps ok but init over initilize
seems odd.
Terry Moore
On 7/05/2010, at 9:25 PM, Matt Aimonetti
wrote:
In general it's just better and simple to follow Cocoa's conventions
and never overwrite the default initializer but instead create your
own initializer.
Thibault explained some of the reasons why you are running into some
issues but the point is that even though MacRuby is a Ruby
implementation, you are still dealing with Cocoa Objects and Cocoa
objects are designed a certain way and you have to respect that if
you want them to work properly.
-= Matt
On Fri, May 7, 2010 at 2:15 AM, Terry wrote:
I agree on that point of course they are different calls but
from a ruby point of view WHY isn't init with no args the same as
initialize with no args
So I can live with it but my preference is with ruby initialize...
this is macRuby right?
Terry
On 7/05/2010, at 6:09 PM, Thibault Martin-Lagardette wrote:
Hi!
I totally agree that it is a little confusing. But #new an #new
(owner) are two different methods, especially in Obj-C.
Calling A.new(arg) cannot call -init, since -init doesn't take any
argument, so it will call any initializer method that takes one
argument :-).
This is why:
class A; def initialize; end; end; # Will never be called with
A.new, because -init will be called instead
class A; def initialize(str); end; end; # Will be called with A.new
(str), because -init cannot be called
It simply depends on how you define your initilizer method :-)
--
Thibault Martin-Lagardette
On May 6, 2010, at 21:54, Terry Moore wrote:
This is only true if you follow objc init I think... for example...
I came across this problem with NSWindowController and it took me
a while to figure out.
class PasswordController < NSWindowController
def initialize
initWithWindowNibName("Password") ##FAIL Never called! init
called instead
end
class PrefController < NSWindowController
def initialize(owner)
@owner = owner
initWithWindowNibName("Preferences")
end
end
The first example fails and so I finally got that I needed the
init method to make the window appear but I couldn't figure out
why the second option worked.
Must have been a long day but clearly if designate an initialize
with a param init is bypased...
so if I take the
class A "hi there"
so what is going on? I think there might need to be some
clarity.
Terry
___
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] [MacRuby] #724: malloc warning
Yes every time. you must have any alias on the desktop called test though Terry oh and macruby 0.6 On 26/05/2010, at 9:53 AM, MacRuby wrote: > #724: malloc warning > -+-- > Reporter: tvmo...@…| Owner: lsansone...@… > Type: defect | Status: new > Priority: minor| Milestone: MacRuby 0.6 > Component: MacRuby |Keywords: > -+-- > > Comment(by martinlagarde...@…): > > Hi! > > I can't reproduce this on my machine... Can you reproduce it each time you > run this script? > > -- > Ticket URL: <http://www.macruby.org/trac/ticket/724#comment:1> > MacRuby <http://macruby.org/> > > ___ > 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] #724: malloc warning with bookmarkDataWithContentsOfURL on aliases
thanks.
On 26/05/2010, at 12:15 PM, MacRuby wrote:
> #724: malloc warning with bookmarkDataWithContentsOfURL on aliases
> -+--
> Reporter: tvmo...@…|Owner: lsansone...@…
> Type: defect | Status: closed
> Priority: minor|Milestone: MacRuby 0.6
> Component: MacRuby | Resolution: invalid
> Keywords: |
> -+--
> Changes (by martinlagarde...@…):
>
> * status: new => closed
> * resolution: => invalid
>
>
> Comment:
>
> This is a bug in the OS actually:
>
> {{{
> $> cat t.m
> #import
>
> int main(void)
> {
> NSURL *url = [NSURL fileURLWithPath:@"/tmp/test"];
> NSData *data = [NSURL bookmarkDataWithContentsOfURL:url error:nil];
> printf("-> %p\n", data);
> return 0;
> }
> $> gcc /tmp/t.m -o /tmp/t -framework Foundation -fobjc-gc
> $> ./t
>
> t(61211,0x7fff70982be0) malloc: reference count underflow for 0x2f580,
> break on auto_refcount_underflow_error to debug.
> -> 0x2f540
> $>
> }}}
>
> Well I say bug, but it's just a simple warning. It has been reported
> anyway :-).
>
> --
> Ticket URL:
> MacRuby
>
> ___
> 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] (Mac)?Gems in the same place
how about just working nicely with rvm? On 16/09/2010, at 1:58 PM, Ryan Davis wrote: > > On Sep 15, 2010, at 15:30 , Iain Barnett wrote: > >> >> On 15 Sep 2010, at 22:43, Ryan Davis wrote: >> >>> >>> rubygems and/or macruby should probably be patched to include RUBY_ENGINE >>> somewhere in the gem path. >> >> That's a really good idea. Either that or just accept that macruby is a >> separate thing altogether and have MAC_GEM_PATH etc etc. Proliferation of >> vars doesn't bother me, they only get set once. > > yes, but then you have a proliferation of rubygem implementations... I'd > prefer we work out something that works for everyone so that when you say > 1.3.8 of rubygems it means the same across all ruby impls. > > > ___ > 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] Tyro Needs Ruby vs. O-C Advice
Just a suggestion but I think having a goal will determine what you use.
MacRuby will still expose you to the Cocoa libraries so you will be able to
interchange with OBJC easily.
The MacRuby style tho gets my vote... e.g.
(OBJC) NSMutableDictionary* myDict = [[NSMutableDictionary alloc]init];
(MacRuby) mydict = {}
it may just be a verbosity thing but once you get used to the Macruby style
OBJC becomes tedious.
heres hoping with multiple cores etc that a garbage collector can be added to
IOS! which I think is the only reason MacRuby would not work with it.
Terry
On 31/03/2011, at 4:43 PM, Bryan Harrison wrote:
> I've decided to use an upcoming sabbatical to teach myself OS X and iOS
> programming. My background includes OS X systems administration and web
> development, mostly using the Apache/MySQL/PHP model. I'm familiar with OOP
> concepts and have trifled with any number of languages from C to AppleScript,
> but am not fluent in any object oriented language. I've been exploring Xcode
> 4 for a week and feel conversant with the IDE if not yet able to accomplish
> anything with it.
>
> So… I understand that Cocoa is a given, but today's million dollar question
> is Objective-C or MacRuby? I'm a blank slate with regard to both and so
> could use some good advice. For example…
>
> What are the advantages of MacRuby over Objective-C?
>
> What are the advantage of O-C over Ruby?
>
> Is Xcode's support for O-C significantly better than it's handling of Ruby?
> Do I care?
>
> At this point I'm primarily interested in OS X development, but iOS clearly
> needs to run a close second. What's the current status of Ruby development
> for iOS and is it likely to go anywhere in the nearish future?
>
> Any thoughts on the longer-term prospects of either language?
>
> Any thoughts from anybody will be much appreciated.
>
> Thanks,
> Bryan
> ___
> 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-devel Digest, Vol 37, Issue 51
Well it would appear that Macruby is just not ready for real development. I for one have some faith that Macruby is good enough now and will be language of choice in the future. There are no barriers to you mixing external frameworks or adding objc classes. Ruby as a language has many features that you can grow into that objc doesn't ( meta programming). If you use a standard version of ruby there is nothing to stop even a c hacker using 'the latest' libraries and putting a simple wrapper on. Ruby has become an umbrella for all my work from admin support to web development. And now with macruby I have desktop apps for Mac. Not forgetting jruby of course for any java fans and others like ruinous. So yes on a serious note I would recommend everyone go learn c as a minimum. But if you just want to have some serious fun go mad with ruby/macruby. The learning will come by doing. Terry Moore On 31/03/2011, at 11:41 PM, "Thomas R. Koll" wrote: > > Am 31.03.2011 um 10:26 schrieb Jean-Denis Muys: >> >> I will be blunt: stay away from MacRuby and go with Objective-C. > > I say, if you don't know either Ruby or Objective-C yet, stay away from > MacRuby. > > All those ruby dev who like me are most likely coming from webdevelopment, > dive into this new world of desktop applications. It's a fascinating world. > > >> - Less applicable resources for learning: less examples, less books, less >> blog posts, less people to help you out. > > Which is great if you are able and willing to fill those gaps. > Open Source is not only about using what exists but also to > add something new to it. > Over time you will get deeper and more profund understanding. > > >> Now the MacRuby journey might taste a lot better, depending on you. And if >> for you "the reward is the _journey_", you might consider it. > > +1 > > >> - One thing is for sure: demand for iOS Ruby programmers is zero. > > Which might be subject to change. > Don't forget, the only two things keeping MacRuby from iOS is > the lack of a garbage collector and the App Store policy about > programming languages. > Both in the hands of Apple, just like MacRuby itself. > > > > ___ > 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-devel Digest, Vol 37, Issue 51
I for one would like to see some examples of objc meta programming. Standard ruby is built with c are you saying c has some meta programming capabilities because of this. An example like attr_accessor. I know objc 2 now has properties. I also know some aspects of ruby are scary 'eval' and re opening classes but can you load objc source compile and run it aka 'eval'. All I'm trying to say here is that ruby has a place and with the macruby implementation you have nothing to lose by trying some ruby. Mix it up a little and have some fun too. Terry Moore On 1/04/2011, at 7:59 AM, Matt Massicotte wrote: > On Mar 31, 2011, at 11:41 AM, Terry Moore wrote: > >> Well it would appear that Macruby is just not ready for real development. >> >> I for one have some faith that Macruby is good enough now and will be >> language of choice in the future. >> >> There are no barriers to you mixing external frameworks or adding objc >> classes. >> >> Ruby as a language has many features that you can grow into that objc >> doesn't ( meta programming). > > This has come up more than once today. ObjC is capable of a lot more > meta-programming than people are giving it credit for. The Objective-C > runtime is, afterall, what MacRuby is built on. However, Ruby's > meta-programming support is significantly simpler, making it easier to both > use and abuse :) > >> >> If you use a standard version of ruby there is nothing to stop even a c >> hacker using 'the latest' libraries and putting a simple wrapper on. >> >> Ruby has become an umbrella for all my work from admin support to web >> development. And now with macruby I have desktop apps for Mac. >> >> Not forgetting jruby of course for any java fans and others like ruinous. >> >> >> So yes on a serious note I would recommend everyone go learn c as a minimum. >> But if you just want to have some serious fun go mad with ruby/macruby. The >> learning will come by doing. >> >> Terry Moore >> >> On 31/03/2011, at 11:41 PM, "Thomas R. Koll" wrote: >> >>> >>> Am 31.03.2011 um 10:26 schrieb Jean-Denis Muys: >>>> >>>> I will be blunt: stay away from MacRuby and go with Objective-C. >>> >>> I say, if you don't know either Ruby or Objective-C yet, stay away from >>> MacRuby. >>> >>> All those ruby dev who like me are most likely coming from webdevelopment, >>> dive into this new world of desktop applications. It's a fascinating world. >>> >>> >>>> - Less applicable resources for learning: less examples, less books, less >>>> blog posts, less people to help you out. >>> >>> Which is great if you are able and willing to fill those gaps. >>> Open Source is not only about using what exists but also to >>> add something new to it. >>> Over time you will get deeper and more profund understanding. >>> >>> >>>> Now the MacRuby journey might taste a lot better, depending on you. And if >>>> for you "the reward is the _journey_", you might consider it. >>> >>> +1 >>> >>> >>>> - One thing is for sure: demand for iOS Ruby programmers is zero. >>> >>> Which might be subject to change. >>> Don't forget, the only two things keeping MacRuby from iOS is >>> the lack of a garbage collector and the App Store policy about >>> programming languages. >>> Both in the hands of Apple, just like MacRuby itself. >>> >>> >>> >>> ___ >>> 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-devel Digest, Vol 37, Issue 51
Interesting... a nice reference for all those bridgesupport method parameters :) Its nice but not what hit me about ruby... especially this http://mislav.uniqpath.com/poignant-guide/ persevere until dwemthy's array. classes inhereting from a functions gave me a headache :) I have gone from being hunched up and worried about types etc. to being very relaxed and froody... I'm not even sure I could go back to adding semi colons to the end of a line :) Terry On 1/04/2011, at 9:23 AM, Matt Massicotte wrote: > On Mar 31, 2011, at 12:47 PM, Terry Moore wrote: > >> I for one would like to see some examples of objc meta programming. > > Here's a good place to start looking. > > http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Introduction/Introduction.html > > In particular, there are functions you can use for generating classes and > methods at runtime, including modifying classes already present. Though, > that's often done much more easily using categories. You can even do > method_missing-style magic, but not nearly as nicely as in Ruby. > >> >> Standard ruby is built with c are you saying c has some meta programming >> capabilities because of this. >> >> An example like attr_accessor. I know objc 2 now has properties. >> >> I also know some aspects of ruby are scary 'eval' and re opening classes but >> can you load objc source compile and run it aka 'eval'. >> >> All I'm trying to say here is that ruby has a place and with the macruby >> implementation you have nothing to lose by trying some ruby. Mix it up a >> little and have some fun too. >> >> Terry Moore >> >> On 1/04/2011, at 7:59 AM, Matt Massicotte wrote: >> >>> On Mar 31, 2011, at 11:41 AM, Terry Moore wrote: >>> >>>> Well it would appear that Macruby is just not ready for real development. >>>> >>>> I for one have some faith that Macruby is good enough now and will be >>>> language of choice in the future. >>>> >>>> There are no barriers to you mixing external frameworks or adding objc >>>> classes. >>>> >>>> Ruby as a language has many features that you can grow into that objc >>>> doesn't ( meta programming). >>> >>> This has come up more than once today. ObjC is capable of a lot more >>> meta-programming than people are giving it credit for. The Objective-C >>> runtime is, afterall, what MacRuby is built on. However, Ruby's >>> meta-programming support is significantly simpler, making it easier to both >>> use and abuse :) >>> >>>> >>>> If you use a standard version of ruby there is nothing to stop even a c >>>> hacker using 'the latest' libraries and putting a simple wrapper on. >>>> >>>> Ruby has become an umbrella for all my work from admin support to web >>>> development. And now with macruby I have desktop apps for Mac. >>>> >>>> Not forgetting jruby of course for any java fans and others like ruinous. >>>> >>>> >>>> So yes on a serious note I would recommend everyone go learn c as a >>>> minimum. But if you just want to have some serious fun go mad with >>>> ruby/macruby. The learning will come by doing. >>>> >>>> Terry Moore >>>> >>>> On 31/03/2011, at 11:41 PM, "Thomas R. Koll" wrote: >>>> >>>>> >>>>> Am 31.03.2011 um 10:26 schrieb Jean-Denis Muys: >>>>>> >>>>>> I will be blunt: stay away from MacRuby and go with Objective-C. >>>>> >>>>> I say, if you don't know either Ruby or Objective-C yet, stay away from >>>>> MacRuby. >>>>> >>>>> All those ruby dev who like me are most likely coming from webdevelopment, >>>>> dive into this new world of desktop applications. It's a fascinating >>>>> world. >>>>> >>>>> >>>>>> - Less applicable resources for learning: less examples, less books, >>>>>> less blog posts, less people to help you out. >>>>> >>>>> Which is great if you are able and willing to fill those gaps. >>>>> Open Source is not only about using what exists but also to >>>>> add something new to it. >>>>> Over time you will get deeper and more profund understan
Re: [MacRuby-devel] Computer Serial Number
There is no BridgeSupport for IOkit... so ruby is out for now.
like Henry said you can escape to a shell.. or wrap this snippet in an objc
class...
#include
#include
// Returns the serial number as a CFString.
// It is the caller's responsibility to release the returned CFString when done
with it.
void CopySerialNumber(CFStringRef *serialNumber)
{
if (serialNumber != NULL) {
*serialNumber = NULL;
io_service_tplatformExpert =
IOServiceGetMatchingService(kIOMasterPortDefault,
IOServiceMatching("IOPlatformExpertDevice"));
if (platformExpert) {
CFTypeRef serialNumberAsCFString =
IORegistryEntryCreateCFProperty(platformExpert,
CFSTR(kIOPlatformSerialNumberKey),
kCFAllocatorDefault, 0);
if (serialNumberAsCFString) {
*serialNumber = serialNumberAsCFString;
}
IOObjectRelease(platformExpert);
}
}
}
Quote form MacRuby Dev 17/1/2011
"Looks like I talked too fast, there isn't any BridgeSupport file for IOKit,
even in Preview 2. I will look into it, as I'm planning to roll out a new
version soon.
Laurent
"
On 6/04/2011, at 9:26 AM, Henry Maddocks wrote:
>
> On 6/04/2011, at 9:10 AM, Robert Rice wrote:
>
>> Hi Gang:
>>
>> Could anyone help me to read the computer's serial number from a MacRuby
>> program. Since I don't know Objective C, I haven't been able to figure out
>> how to access it.
>
> system_profile = `system_profiler SPHardwareDataType`
> serial_number = system_profile.match(/Serial Number.*: (.*)/)[1]
>
> Henry
>
>
> ___
> 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] NSWorkspace.sharedWorkspace.recycleURLs:completionHandler doing nothing under macruby
Sounds like an asynchronous issue. Try adding a completion selector and calling nsrunloop. Terry Moore On 2/08/2011, at 10:56 PM, Caio Chassot wrote: > On Tue, Aug 2, 2011 at 03:24, Caio Chassot wrote: >> At this point I'm sure this is not a MacRuby bug, just some Cocoa >> weirdness. I'd love to understand exactly what the hell is going on, >> if anyone knows… > > …and to back that, it fails in ObjC too, and adding a sleep there fixes it, > too. > ___ > 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 and ARC was: Advice for Total Tyro
So I can understand not having gc on ios those cycles are precious. But looking ahead the hardware is moving to multicore and larger ram... In which case (perhaps including blocking for high priority tasks) a gc could be used without the current restrictions... Terry Moore On 18/10/2011, at 10:26 AM, Igor Evsukov wrote: > Hi Henry, > >> This doesn't explain why MacRuby can't be implemented with ARC rather than >> relying on the OBJ-C 2 garbage collector. > Do You know what the difference between Garbage Collection and Reference > Counting? > > Current MacRuby VM implementation heavily depends on presence of GC. > Potentially You could modify it to use ARC instead. The question is how much > time do you need to spent on it and how you plan to support C extensions? > > Again, please, watch the end of Joshua Ballanco talk at BostonRB ( > http://bostonrb.org/presentations/macruby-what-is-it-and-why-should-i-care-part-1 > ) when he talk about issues of porting MacRuby to iOS. It isn't an issue to > move MacRuby to it's own GC, there even was some efforts to do it > https://github.com/takuma104/iphone-macruby > > On 17 окт. 2011, at 23:28, Henry Maddocks wrote: > >> >> On 17/10/2011, at 7:11 PM, Igor Evsukov wrote: >> >>> Hi Henry, >>> >>>>> And it's impossible to make Ruby to use ARC. >>>> >>>> Why? >>> For memory management Objective-C uses a paradigm called "reference >>> counting". >> >> ... >> >>> In Ruby we have garbage collector which is acts in whole different way >> >> I understand all this. But I'm not asking about _Ruby_, I'm asking about the >> MacRuby OBJ-C implementation of the Ruby language. >> >>> So, basically, ARC and GC are two conceptually different things which are >>> even not replaceable by each other(circular references). >> >> This doesn't explain why MacRuby can't be implemented with ARC rather than >> relying on the OBJ-C 2 garbage collector. >> >> Henry >> >> ___ >> 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 and ARC was: Advice for Total Tyro
Even better then... Laurent and crew have done brilliant work to date... That alone gives me confidence in macruby... Given a choice of objc v ruby sorry ruby wins for me :) Terry Moore On 18/10/2011, at 10:48 AM, Igor Evsukov wrote: > GC isn't an issue at all. There are apps on the AppStore that written in > C#(Mono) or Lua which uses it own VM's with garbage collection. > > I think that the main issue why Apple don't support MacRuby officially on iOS > is high memory usage. Potentially, if MacRuby will be shipped with iOS, so it > can be used as a shared library memory usage will more or less acceptable. > But this step require MacRuby to be very stable and mature because Apple > wouldn't update an iOS with each minor MacRuby release. > > On 18 окт. 2011, at 00:35, Terry Moore wrote: > >> So I can understand not having gc on ios those cycles are precious. But >> looking ahead the hardware is moving to multicore and larger ram... In which >> case (perhaps including blocking for high priority tasks) a gc could be used >> without the current restrictions... >> >> Terry Moore >> >> On 18/10/2011, at 10:26 AM, Igor Evsukov wrote: >> >>> Hi Henry, >>> >>>> This doesn't explain why MacRuby can't be implemented with ARC rather than >>>> relying on the OBJ-C 2 garbage collector. >>> Do You know what the difference between Garbage Collection and Reference >>> Counting? >>> >>> Current MacRuby VM implementation heavily depends on presence of GC. >>> Potentially You could modify it to use ARC instead. The question is how >>> much time do you need to spent on it and how you plan to support C >>> extensions? >>> >>> Again, please, watch the end of Joshua Ballanco talk at BostonRB ( >>> http://bostonrb.org/presentations/macruby-what-is-it-and-why-should-i-care-part-1 >>> ) when he talk about issues of porting MacRuby to iOS. It isn't an issue >>> to move MacRuby to it's own GC, there even was some efforts to do it >>> https://github.com/takuma104/iphone-macruby >>> >>> On 17 окт. 2011, at 23:28, Henry Maddocks wrote: >>> >>>> >>>> On 17/10/2011, at 7:11 PM, Igor Evsukov wrote: >>>> >>>>> Hi Henry, >>>>> >>>>>>> And it's impossible to make Ruby to use ARC. >>>>>> >>>>>> Why? >>>>> For memory management Objective-C uses a paradigm called "reference >>>>> counting". >>>> >>>> ... >>>> >>>>> In Ruby we have garbage collector which is acts in whole different way >>>> >>>> I understand all this. But I'm not asking about _Ruby_, I'm asking about >>>> the MacRuby OBJ-C implementation of the Ruby language. >>>> >>>>> So, basically, ARC and GC are two conceptually different things which are >>>>> even not replaceable by each other(circular references). >>>> >>>> This doesn't explain why MacRuby can't be implemented with ARC rather than >>>> relying on the OBJ-C 2 garbage collector. >>>> >>>> Henry >>>> >>>> ___ >>>> 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] thread-safety and collections in macruby
If you're not wring/changing the array no problems. But to be safe use Object#freeze... Terry Moore On 19/10/2011, at 6:26 PM, Michael Johnston wrote: > Note, in my example I can also guarantee that none of the elements in b are > going to be changed (for example, an array of strings) > Cheerio, > > Michael Johnston > [email protected] > > > > > On 2011-10-18, at 10:17 PM, Michael Johnston wrote: > >> In ObjC, the immutable collections are threadsafe. >> >> In macruby, are collections threadsafe to read only? >> >> ie, if I do this: >> >> a = [ ...] # an array that may or may not be changed >> >> b = a.dup # nowhere in the code is b ever used to add/delete/change an >> element >> >> is b thread-safe to read from multiple threads (queued operations/blocks)? >> >> also, is there any difference between doing >> >> b = a.dup >> >> and >> >> b = NSArray.arrayWithArray(a) >> >> Both result in class Array, so I assume there is no difference. >> >> >> >> Cheerio, >> >> Michael Johnston >> [email protected] >> >> >> >> >> ___ >> 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] thread-safety and collections in macruby
Yes. But he does state it is a read only not modified array. My understanding is. 'Array' is an NSMutableArray, I was merely suggesting using freeze to throw that exception just in case there maybe some code attempting to write/modify. Mutex is the way to go but it also has an overhead. Terry Moore On 20/10/2011, at 4:28 AM, Matt Aimonetti wrote: > The proper way to protect mutable objects is to use a mutex: > http://www.ruby-doc.org/core-1.9.2/Mutex.html > > - Matt > > Sent from my iPhone > > On Oct 19, 2011, at 8:06, Chuck Remes wrote: > >> >> On Oct 19, 2011, at 12:41 AM, Terry Moore wrote: >> >>> If you're not wring/changing the array no problems. But to be safe use >>> Object#freeze... >>> >>> Terry Moore >>> >>> On 19/10/2011, at 6:26 PM, Michael Johnston wrote: >>> >>>> Note, in my example I can also guarantee that none of the elements in b >>>> are going to be changed (for example, an array of strings) >> >> Object#freeze is a terrible method. Supporting it requires an extra check >> (#frozen?) in every method that tries to modify an object. This is why Ruby >> is slow (certainly not the only reason, but decisions like this are >> everywhere). >> >> :) >> >> Using #freeze won't save you but it will throw a RuntimeException if you try >> to modify a frozen object. So it's really only good for pointing out that >> you have a bug when you attempt to modify your immutable array. >> >> cr >> >> >> ___ >> 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] thread-safety and collections in macruby
That's odd. I would still use freeze more rubyish... :) Terry Moore On 22/10/2011, at 6:41 PM, Michael Johnston wrote: > Thanks, I am using: > > results = NSArray.arrayWithArray(worker_results) > > which although it reports true for is_a?(NSMutableArray) is immutable. > > Cheerio, > > Michael Johnston > [email protected] > > > > > On 2011-10-20, at 3:47 PM, terl wrote: > >> Just a note to the original question >> >> macruby collections are based on objc mutable collections...e.g. >> >> a = %w{my array of strings} >> ["my","array","of"strings"] >> >> b = a.dup. b is still a mutable array. >> >> c = NSarray.alloc.initWithArray( a ) immutable array >> >> c << "hi" >> >> runtime error cannot modify frozen/iimmutable array >> >> b= a.dup.freeze >> >> b << "hi" >> >> behaves the same way as NSArray an immutable array... >> >> >> Terry >> >> >> >> On 21/10/2011, at 9:00 AM, Andy Park wrote: >> >>> >>> On 19 Oct 2011, at 22:43, Jordan K. Hubbard wrote: >>> >>>> If the mail archives were easier to search, I'd pull it up, but it isn't >>>> and I'm too lazy. :) >>>> >>> >>> I set up an entry in gmane for the mailing list a while ago in order to >>> search the list a bit better: >>> >>> http://news.gmane.org/gmane.comp.lang.ruby.macintosh.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] Noob q: Press any key to cancel
Could you wrap the process into an NSTask and use pipes to communicate?
Terry
On 6/12/2011, at 11:43 AM, Rob Ista wrote:
> Hi, i have broken my braincells while trying to find a simple solution for
> interrupting a potentially long running calculation loop.
> A key event seems to wait until the app gets back to the main loop, a
> system("stty raw -echo") just hangs, gets and read.non-block either wait or
> want a enter to follow any character. I couldn't get it working with a
> notification either. I just can't find it :) .. Any help appreciated .. tnx,
> Rob
> ___
> 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] Single Column Table View with Core Data backed Custom Cell View?
I think you nspredicates.… depending on the columns in the table. Think SQL.… Terry Moore On 8/12/2011, at 8:31 PM, Haris Amin wrote: > Hey Guys, > > I have a Core Data entity called Email all set and ready to go. Following > Matt's example from the book, I was able to create a regular old NSTableView > and bound the Core Data Email entity's values to each column in the > tableview. This works great. What I'm now trying to do is make a single > column tableview where each row will display a custom cell view constructed > from my Core Data Email object. > > With me so far? :) Basically, if you look at the Mail app from OS X Lion, I'm > trying to create that side bar single column tableview where each email > message has a custom table cellview showing the from, to, subject, and > summary for each Core Data email values. With a regular old tableview this is > easy, I'm just a little lost as to how to get a single column table view to > render a custom cell view that uses Core Data binding to match my Email > NSArray Controller. > > This is a symbolic representation of what i'm trying to achieve: > > NSTableView ( 1 column) > > NSColumn (bound to my CoreData Email entity) > > NSTableCellView ( I want this to show the actual text fields for the > bound coredata object for that row i.e. email.to, email.from, email.subject, > etc.) > > A little lost and any help would be much appreciated. Thanks :) > > Haris > ___ > 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] Rails.app done by the MacRuby community
Maybe try active_resource connection first with macruby. It might not be an app but perhaps with some focus on rails macruby might be useful. Terry Moore On 29/03/2012, at 6:22 PM, Mark Villacampa wrote: > Hi, > > I just started learning MacRuby and I saw te kickstarter project yesterday. > > A GUI for rvm was already going to be one of the first apps I'd do with > MacRuby, so I would love to contribute to this project. > > Mark Villacampa > @MarkVillacampa > > Enviado desde mi iPhone > > El 29/03/2012, a las 06:44, Matt Aimonetti escribió: > >> Today a mini drama was started after Yehuda Katz announced his kickstarter >> project to build a ".app" for Rails. He's trying to raise $25k to work on >> the project, see more there: >> http://news.ycombinator.com/item?id=3768339 >> >> Putting the money raising question aside, I think this is a good project but >> I think that as a community we can do it together, learn a lot in the >> process and create an awesome product helping the community. >> >> My suggestion is that people interested get together and hack together in an >> open and public way. Yehuda might get funded and decide to contribute or do >> his own thing in JS, that's totally besides the point since our motivations >> would be different so we shouldn't worry about that. >> >> So, what do you say? >> >> - Matt >> >> P.S: Two years ago, I ported couchdbx to MacRuby and extracted some code you >> can see here: https://github.com/mattetti/mrstuff >> The couchdbx app is also available in my github repo. >> >> >> -m >> Sent from my iPhone >> ___ >> 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] OS X10.9 & MacRuby's future...
additionally.. Macruby and rubymotion ( fork? ) are great for cocoa/ios but lack support for many MRI ruby gems out there... (amqp...rails ) I have been burnt on this a number of times... Terry On 22/05/2013, at 5:30 PM, Henry Maddocks wrote: > > On 19/05/2013, at 8:04 PM, david kramf wrote: > >> Francis, >> I know nothing about RubyMotion but if I understand correctly it uses a >> compiler and not an interpreter. So I doubt if it can implement >> Metaprogramming and Reflection. If it does not , then it is not a Ruby . It >> might be an excellent language but not Ruby. > > RubyMotion supports most metaprogramming and reflection constructs. The fact > that it is compiled has nothing to do with it. > >> To the best of my understanding Ruby is a very well defined language >> supported by a large community and works in what seems to me ( I know Ruby >> for no more than a year) in a very orderly way. > > This is not the case. There is no specification for Ruby, a fact that is a > concern for those trying to develop alternative implementations. Rubyspec is > a defacto spec but it isn't official, or complete. > > There has also been a lot of discussion in the community recently about the > haphazard way that Ruby seems to be developed. Personally I don't have a > problem with Matz's leadership, but a lot of people do. > > Henry > > ___ > MacRuby-devel mailing list > [email protected] > https://lists.macosforge.org/mailman/listinfo/macruby-devel ___ MacRuby-devel mailing list [email protected] https://lists.macosforge.org/mailman/listinfo/macruby-devel
