From ivan at flanders.co.nz Fri May 1 04:15:28 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Fri, 1 May 2009 10:15:28 +0200 Subject: [Ironruby-core] nil != null ? Message-ID: Hi I had specs that used to work but now apparently they don't anymore. I'd expect that a nil from ruby maps to null in C# but this doesn't seem to be the case. I'm using the following code public static bool IsNotNull(this object value) { return value != null; } public static bool IsNull(this object value) { return value == null; } >>> ObjectExtensions.is_null(nil) :0: can't convert NilClass into Object (TypeError) I'd expect it to return true ;) --- Author of IronRuby in Action (http://manning.com/carrero) -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan at flanders.co.nz Fri May 1 05:41:06 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Fri, 1 May 2009 11:41:06 +0200 Subject: [Ironruby-core] mspec troubles Message-ID: I followed the steps described on the wiki to be able to run the specs for ironruby but when I then execute rake test I get the following output: + C:\tools\ironruby\merlin\main\Languages\Ruby (master) ? rake test (in C:/tools/ironruby/merlin/main/Languages/Ruby) C:\tools\ironruby\merlin\main\\..\External.LCA_RESTRICTED\Languages\IronRuby\msp ec\default.mspec:12: undefined method `filtered' for MSpecScript:Class (NoMethod Error) from ./default.mspec:15:in `load' from ./default.mspec:15 from c:/tools/ironruby/mspec/lib/mspec/utils/script.rb:45:in `load' from c:/tools/ironruby/mspec/lib/mspec/utils/script.rb:45:in `load' from c:/tools/ironruby/mspec/lib/mspec/utils/script.rb:44:in `each' from c:/tools/ironruby/mspec/lib/mspec/utils/script.rb:44:in `load' from c:/tools/ironruby/mspec/lib/mspec/utils/script.rb:91:in `main' from c:/tools/ironruby/mspec/bin/mspec:7 -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jimmy.Schementi at microsoft.com Fri May 1 05:50:40 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Fri, 1 May 2009 09:50:40 +0000 Subject: [Ironruby-core] mspec troubles In-Reply-To: References: Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC02E77E@tk5ex14mbxc105.redmond.corp.microsoft.com> ?rake test? is not the preferred way of running tests; directly run the mspec command (or use irtests.bat, see below). This will use a version of mspec that?s checked in, so you don?t need a separate directory for mspec. Doing a ?where mspec? should yield: c:\tools\ironruby\Merlin\External.LCA_RESTRICTED\Languages\IronRuby\mspec\mspec\bin\mspec c:\tools\ironruby\Merlin\External.LCA_RESTRICTED\Languages\IronRuby\mspec\mspec\bin\mspec.bat If you run Dev.bat, this path will be set up for you, and a .mspecrc file copied to %HOME%, which will hook everything up properly. To run all the tests, there?s a single script Merlin\Main\Languages\Ruby\Scripts\irtests.bat which should do the trick. We should hook this back up into rake, but I think those rake files are pretty scary, so we have some external scripts written by people who don?t want to mess with rake. =P ~js From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Friday, May 01, 2009 2:41 AM To: ironruby-core Subject: [Ironruby-core] mspec troubles I followed the steps described on the wiki to be able to run the specs for ironruby but when I then execute rake test I get the following output: + C:\tools\ironruby\merlin\main\Languages\Ruby (master) ? rake test (in C:/tools/ironruby/merlin/main/Languages/Ruby) C:\tools\ironruby\merlin\main\\..\External.LCA_RESTRICTED\Languages\IronRuby\msp ec\default.mspec:12: undefined method `filtered' for MSpecScript:Class (NoMethod Error) from ./default.mspec:15:in `load' from ./default.mspec:15 from c:/tools/ironruby/mspec/lib/mspec/utils/script.rb:45:in `load' from c:/tools/ironruby/mspec/lib/mspec/utils/script.rb:45:in `load' from c:/tools/ironruby/mspec/lib/mspec/utils/script.rb:44:in `each' from c:/tools/ironruby/mspec/lib/mspec/utils/script.rb:44:in `load' from c:/tools/ironruby/mspec/lib/mspec/utils/script.rb:91:in `main' from c:/tools/ironruby/mspec/bin/mspec:7 -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan at flanders.co.nz Fri May 1 09:03:33 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Fri, 1 May 2009 15:03:33 +0200 Subject: [Ironruby-core] overriding unsafe methods Message-ID: Hi I'm still working with Kean to port his ironpython samples, but we've run into another problem now. He needs to override an unsafe virtual method and then call it from ruby as super. I'm calling super with no arguments from my two overrides and they both seem to fail in RubyOverloadResolver.MapSpecialParamaters() Again to codeplex I guess :) --- Author of IronRuby in Action (http://manning.com/carrero) -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan at flanders.co.nz Fri May 1 10:17:16 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Fri, 1 May 2009 16:17:16 +0200 Subject: [Ironruby-core] apparently only with extension methods nil != System::Object Message-ID: I've done some more investigation and it appears that it has to do with Extension methods. public static bool IsNull(this object value) { return value == null; } and public static bool IsNull2(object value) { return value == null; } >>> System::Web::Mvc::IronRuby::Extensions::ObjectExtensions.is_null nil :0: can't convert NilClass into Object (TypeError) >>> System::Web::Mvc::IronRuby::Extensions::ObjectExtensions.is_null2 nil => true I've commented the issue on codeplex but couldn't change the title of the bug. --- Author of IronRuby in Action (http://manning.com/carrero) Andy Warhol - "I am a deeply superficial person." On Fri, May 1, 2009 at 10:15 AM, Ivan Porto Carrero wrote: > Hi > I had specs that used to work but now apparently they don't anymore. > I'd expect that a nil from ruby maps to null in C# but this doesn't seem to > be the case. > > > I'm using the following code > > > public static bool IsNotNull(this object value) > { > return value != null; > } > > public static bool IsNull(this object value) > { > return value == null; > } > > >>> ObjectExtensions.is_null(nil) > :0: can't convert NilClass into Object (TypeError) > > I'd expect it to return true ;) > > --- > Author of IronRuby in Action (http://manning.com/carrero) > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From suppakilla at gmail.com Sun May 3 06:10:46 2009 From: suppakilla at gmail.com (Daniele Alessandri) Date: Sun, 3 May 2009 12:10:46 +0200 Subject: [Ironruby-core] TypeError thrown in DynamicMetaObjectBinder.Bind Message-ID: <3bf20550905030310h64ef11bfy270c042837ccd030@mail.gmail.com> Hi, I'm reviewing ironruby-hpricot to clean up its code but I've just noticed that something has changed in IronRuby since I last tested my library. Please refer to the the following gist for a simplified test case to reproduce the problem: http://gist.github.com/105928 I'm pretty sure this was working ~1 month ago, am I doing something wrong? -- Daniele Alessandri http://www.clorophilla.net/blog/ http://twitter.com/JoL1hAHN From ivan at flanders.co.nz Sun May 3 06:18:07 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Sun, 3 May 2009 12:18:07 +0200 Subject: [Ironruby-core] Building expressions Message-ID: Hi I'm trying to get some Moq mockery going in IronRuby but Moq expects Expression> in his methods. Is there a way to make a RubyProc/lambda return an expression or convert it to an expression? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Author of IronRuby in Action (http://manning.com/carrero) Steve Martin - "I've got to keep breathing. It'll be my worst business mistake if I don't." -------------- next part -------------- An HTML attachment was scrubbed... URL: From Shri.Borde at microsoft.com Sun May 3 17:29:04 2009 From: Shri.Borde at microsoft.com (Shri Borde) Date: Sun, 3 May 2009 14:29:04 -0700 Subject: [Ironruby-core] TypeError thrown in DynamicMetaObjectBinder.Bind In-Reply-To: <3bf20550905030310h64ef11bfy270c042837ccd030@mail.gmail.com> References: <3bf20550905030310h64ef11bfy270c042837ccd030@mail.gmail.com> Message-ID: <710DF26F214D2B4BB94287123FFE980A2E1BEDC105@NA-EXMSG-C104.redmond.corp.microsoft.com> I think you need to do an explicit conversion to MutableString. The DLR used to do some automatic conversions, but now you need to be explicit. I don't know what code to use so you will have to wait until someone who knows that can reply... -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Daniele Alessandri Sent: Sunday, May 03, 2009 3:11 AM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] TypeError thrown in DynamicMetaObjectBinder.Bind Hi, I'm reviewing ironruby-hpricot to clean up its code but I've just noticed that something has changed in IronRuby since I last tested my library. Please refer to the the following gist for a simplified test case to reproduce the problem: http://gist.github.com/105928 I'm pretty sure this was working ~1 month ago, am I doing something wrong? -- Daniele Alessandri http://www.clorophilla.net/blog/ http://twitter.com/JoL1hAHN _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From Shri.Borde at microsoft.com Sun May 3 17:37:04 2009 From: Shri.Borde at microsoft.com (Shri Borde) Date: Sun, 3 May 2009 14:37:04 -0700 Subject: [Ironruby-core] Building expressions In-Reply-To: References: Message-ID: <710DF26F214D2B4BB94287123FFE980A2E1BEDC107@NA-EXMSG-C104.redmond.corp.microsoft.com> It cannot be done. Even if you could get to the ExpressionTree of a Ruby lambda, the ExpressionTree would be loosely-bound as Ruby uses duck-typing, whereas Moq expects a strongly-typed ExpressionTree so that it can figure out the exact method that you are trying to associate some expectation with. FWIW, Mark had also been playing with mocking, and in our discussions, we said that the easiest mocking approach would be to use Ruby features like method_missing, monkey-patching, etc (like rspec does). Ie. something like this: def mock(clrInterface): class ClrMock < clrInterface # monkey-patch all of ?clrInterface.methods" here, and redirect to the mocking framework end return ClrMock.new end From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Sunday, May 03, 2009 3:18 AM To: ironruby-core Subject: [Ironruby-core] Building expressions Hi I'm trying to get some Moq mockery going in IronRuby but Moq expects Expression> in his methods. Is there a way to make a RubyProc/lambda return an expression or convert it to an expression? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Author of IronRuby in Action (http://manning.com/carrero) Steve Martin - "I've got to keep breathing. It'll be my worst business mistake if I don't." -------------- next part -------------- An HTML attachment was scrubbed... URL: From xerxes at bigpond.net.au Sun May 3 21:56:53 2009 From: xerxes at bigpond.net.au (Xerxes Battiwalla) Date: Mon, 4 May 2009 11:56:53 +1000 Subject: [Ironruby-core] Git push In-Reply-To: References: Message-ID: Hi there - does this mean that the rspec fixes are in there too? (http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=572) Thanks, Xerxes On Sat, May 2, 2009 at 10:01 AM, Jim Deville wrote: > Hey everyone, > > > > I usually just quietly push changes out, but I wanted to say something about > the changes that went out today. Today?s changes have changed the > interpreter to be an Adaptive Compiling interpreter. For those who don?t > know, that means that the code is interpreted, but after 2 (this number may > change) calls to a method, we compile it to native code on a background > thread. > > > > With this change, you might notice some performance improvements. In > addition, this change means that -X:Interpret will be going away. The option > will still be there, as it?s a DLR option, but it won?t do anything on > IronRuby. > > > > Let us know if these changes cause any bugs. > > > > Thanks, > > JD > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > From Jimmy.Schementi at microsoft.com Mon May 4 01:51:12 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Mon, 4 May 2009 05:51:12 +0000 Subject: [Ironruby-core] Git push In-Reply-To: References: Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC016B31B2@tk5ex14mbxc106.redmond.corp.microsoft.com> http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=572 This is now fixed. Not sure if RSpec or Cucumber are blocked by any other bugs (someone reported something on the mailing list recently ... but there are no bugs open for it). > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > bounces at rubyforge.org] On Behalf Of Xerxes Battiwalla > Sent: Sunday, May 03, 2009 6:57 PM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Git push > > Hi there - does this mean that the rspec fixes are in there too? > (http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=572) > > Thanks, > Xerxes > > > On Sat, May 2, 2009 at 10:01 AM, Jim Deville > wrote: > > Hey everyone, > > > > > > > > I usually just quietly push changes out, but I wanted to say > something about > > the changes that went out today. Today's changes have changed the > > interpreter to be an Adaptive Compiling interpreter. For those who > don't > > know, that means that the code is interpreted, but after 2 (this > number may > > change) calls to a method, we compile it to native code on a > background > > thread. > > > > > > > > With this change, you might notice some performance improvements. In > > addition, this change means that -X:Interpret will be going away. The > option > > will still be there, as it's a DLR option, but it won't do anything > on > > IronRuby. > > > > > > > > Let us know if these changes cause any bugs. > > > > > > > > Thanks, > > > > JD > > > > _______________________________________________ > > Ironruby-core mailing list > > Ironruby-core at rubyforge.org > > http://rubyforge.org/mailman/listinfo/ironruby-core > > > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core From Tomas.Matousek at microsoft.com Mon May 4 13:39:07 2009 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Mon, 4 May 2009 10:39:07 -0700 Subject: [Ironruby-core] TypeError thrown in DynamicMetaObjectBinder.Bind In-Reply-To: <710DF26F214D2B4BB94287123FFE980A2E1BEDC105@NA-EXMSG-C104.redmond.corp.microsoft.com> References: <3bf20550905030310h64ef11bfy270c042837ccd030@mail.gmail.com> <710DF26F214D2B4BB94287123FFE980A2E1BEDC105@NA-EXMSG-C104.redmond.corp.microsoft.com> Message-ID: A couple of issues: 1) As Shri said, the return type of a site must be Object. 2) You shouldn't be creating a new site (and also not a shared one) in each invocation of the method. Instead, use one of the CallSiteStorages defined in CallSiteStorages.cs as the first parameter. You can search in the built-ins for examples of usage. Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shri Borde Sent: Sunday, May 03, 2009 2:29 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] TypeError thrown in DynamicMetaObjectBinder.Bind I think you need to do an explicit conversion to MutableString. The DLR used to do some automatic conversions, but now you need to be explicit. I don't know what code to use so you will have to wait until someone who knows that can reply... -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Daniele Alessandri Sent: Sunday, May 03, 2009 3:11 AM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] TypeError thrown in DynamicMetaObjectBinder.Bind Hi, I'm reviewing ironruby-hpricot to clean up its code but I've just noticed that something has changed in IronRuby since I last tested my library. Please refer to the the following gist for a simplified test case to reproduce the problem: http://gist.github.com/105928 I'm pretty sure this was working ~1 month ago, am I doing something wrong? -- Daniele Alessandri http://www.clorophilla.net/blog/ http://twitter.com/JoL1hAHN _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From suppakilla at gmail.com Mon May 4 14:28:47 2009 From: suppakilla at gmail.com (Daniele Alessandri) Date: Mon, 4 May 2009 20:28:47 +0200 Subject: [Ironruby-core] TypeError thrown in DynamicMetaObjectBinder.Bind In-Reply-To: References: <3bf20550905030310h64ef11bfy270c042837ccd030@mail.gmail.com> <710DF26F214D2B4BB94287123FFE980A2E1BEDC105@NA-EXMSG-C104.redmond.corp.microsoft.com> Message-ID: <3bf20550905041128q720cde80p492737e4a86fad07@mail.gmail.com> Hi Tomas, 1) Oh, I see. I didn't know that, and the fact that it was working with previous versions of IR just misleaded me. 2) Indeed, I know it was wrong to create a new site on each invocation and that's exactly why I'm reviewing the oldest bits of code that actually interact with IronRuby to clean up everything and do it the right way :-) Thanks! On Mon, May 4, 2009 at 19:39, Tomas Matousek wrote: > A couple of issues: > 1) As Shri said, the return type of a site must be Object. > 2) You shouldn't be creating a new site (and also not a shared one) in each invocation of the method. Instead, use one of the CallSiteStorages defined in CallSiteStorages.cs as the first parameter. You can search in the built-ins for examples of usage. > > Tomas > > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shri Borde > Sent: Sunday, May 03, 2009 2:29 PM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] TypeError thrown in DynamicMetaObjectBinder.Bind > > I think you need to do an explicit conversion to MutableString. The DLR used to do some automatic conversions, but now you need to be explicit. I don't know what code to use so you will have to wait until someone who knows that can reply... > > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Daniele Alessandri > Sent: Sunday, May 03, 2009 3:11 AM > To: ironruby-core at rubyforge.org > Subject: [Ironruby-core] TypeError thrown in DynamicMetaObjectBinder.Bind > > Hi, > I'm reviewing ironruby-hpricot to clean up its code but I've just > noticed that something has changed in IronRuby since I last tested my > library. Please refer to the the following gist for a simplified test > case to reproduce the problem: > > http://gist.github.com/105928 > > I'm pretty sure this was working ~1 month ago, am I doing something wrong? > > -- > Daniele Alessandri > http://www.clorophilla.net/blog/ > http://twitter.com/JoL1hAHN > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > -- Daniele Alessandri http://www.clorophilla.net/blog/ http://twitter.com/JoL1hAHN From Jimmy.Schementi at microsoft.com Tue May 5 01:03:59 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Tue, 5 May 2009 05:03:59 +0000 Subject: [Ironruby-core] Code Review: firewallwarning In-Reply-To: References: Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC016B567D@tk5ex14mbxc106.redmond.corp.microsoft.com> This if fine as long as only this machine hits the server ... > -----Original Message----- > From: Jim Deville > Sent: Monday, May 04, 2009 9:59 PM > To: IronRuby External Code Reviewers > Cc: ironruby-core at rubyforge.org > Subject: Code Review: firewallwarning > > RESENDING with diff: > tfpt review "/shelveset:firewallwarning;REDMOND\jdeville" > Comment : > This simple change fixes a firewall warning that gets kicked up in > the test lab. The change is simply to change the listening address from > 0.0.0.0 (bind on all addresses) to 127.0.0.1 (loopback). > From jdeville at microsoft.com Tue May 5 01:04:52 2009 From: jdeville at microsoft.com (Jim Deville) Date: Tue, 5 May 2009 05:04:52 +0000 Subject: [Ironruby-core] Code Review: firewallwarning In-Reply-To: <0047ECBFA2E0DF4A834AA369282A5AFC016B567D@tk5ex14mbxc106.redmond.corp.microsoft.com> References: <0047ECBFA2E0DF4A834AA369282A5AFC016B567D@tk5ex14mbxc106.redmond.corp.microsoft.com> Message-ID: It is. The test is fully local. -----Original Message----- From: Jimmy Schementi Sent: Monday, May 04, 2009 10:04 PM To: Jim Deville; IronRuby External Code Reviewers Cc: ironruby-core at rubyforge.org Subject: RE: Code Review: firewallwarning This if fine as long as only this machine hits the server ... > -----Original Message----- > From: Jim Deville > Sent: Monday, May 04, 2009 9:59 PM > To: IronRuby External Code Reviewers > Cc: ironruby-core at rubyforge.org > Subject: Code Review: firewallwarning > > RESENDING with diff: > tfpt review "/shelveset:firewallwarning;REDMOND\jdeville" > Comment : > This simple change fixes a firewall warning that gets kicked up in > the test lab. The change is simply to change the listening address from > 0.0.0.0 (bind on all addresses) to 127.0.0.1 (loopback). > From ryan.riley at panesofglass.org Tue May 5 10:19:20 2009 From: ryan.riley at panesofglass.org (Ryan Riley) Date: Tue, 5 May 2009 09:19:20 -0500 Subject: [Ironruby-core] Building expressions In-Reply-To: <710DF26F214D2B4BB94287123FFE980A2E1BEDC107@NA-EXMSG-C104.redmond.corp.microsoft.com> References: <710DF26F214D2B4BB94287123FFE980A2E1BEDC107@NA-EXMSG-C104.redmond.corp.microsoft.com> Message-ID: Ivan, You may want to try Jeremy Mcanally's stumpmocking framework. I haven't used it much, so I can't give any additional info on it. It may not be what you are wanting, but if you just need mocks, it may be worth a shot. Ryan Riley ryan.riley at panesofglass.org http://panesofglass.org/ http://wizardsofsmart.net/ On Sun, May 3, 2009 at 4:37 PM, Shri Borde wrote: > It cannot be done. Even if you could get to the ExpressionTree of a Ruby > lambda, the ExpressionTree would be loosely-bound as Ruby uses duck-typing, > whereas Moq expects a strongly-typed ExpressionTree so that it can figure > out the exact method that you are trying to associate some expectation with. > > > > FWIW, Mark had also been playing with mocking, and in our discussions, we > said that the easiest mocking approach would be to use Ruby features like > method_missing, monkey-patching, etc (like rspec does). Ie. something like > this: > > > > def mock(clrInterface): > > class ClrMock < clrInterface > > # monkey-patch all of ?clrInterface.methods" here, and redirect to the > mocking framework > > end > > return ClrMock.new > > end > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Ivan Porto Carrero > *Sent:* Sunday, May 03, 2009 3:18 AM > *To:* ironruby-core > *Subject:* [Ironruby-core] Building expressions > > > > Hi > > I'm trying to get some Moq mockery going in IronRuby but Moq expects > Expression> in his methods. > Is there a way to make a RubyProc/lambda return an expression or convert it > to an expression? > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Author of IronRuby in Action (http://manning.com/carrero) > > Steve Martin - "I've got to keep breathing. It'll be my worst business mistake if I > don't." > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan at flanders.co.nz Tue May 5 10:46:09 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Tue, 5 May 2009 16:46:09 +0200 Subject: [Ironruby-core] Building expressions In-Reply-To: <710DF26F214D2B4BB94287123FFE980A2E1BEDC107@NA-EXMSG-C104.redmond.corp.microsoft.com> References: <710DF26F214D2B4BB94287123FFE980A2E1BEDC107@NA-EXMSG-C104.redmond.corp.microsoft.com> Message-ID: Yes I have since changed my approach. I've also talked with Mark about approaching this. The approach I take now is to generate a proxy to the object/class/interface that will record method calls. After recording you can then run verifications on those method calls. The way I generate the proxy for an interface came out of my talk with Mark. http://github.com/casualjim/caricature/blob/922bdcd11d9b0a1aa5500c3fe430483863d9041e/lib/caricature/proxy.rb#L92 But the deeper implication is then that when a library uses Expression> as parameters you cannot use it from ironruby at all? Not even by building the expression tree yourself? (I forgot to hit send apparently :)) --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero GSM: +32.486.787.582 Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Emo Philips - "I got some new underwear the other day. Well, new to me." On Sun, May 3, 2009 at 11:37 PM, Shri Borde wrote: > It cannot be done. Even if you could get to the ExpressionTree of a Ruby > lambda, the ExpressionTree would be loosely-bound as Ruby uses duck-typing, > whereas Moq expects a strongly-typed ExpressionTree so that it can figure > out the exact method that you are trying to associate some expectation with. > > > > FWIW, Mark had also been playing with mocking, and in our discussions, we > said that the easiest mocking approach would be to use Ruby features like > method_missing, monkey-patching, etc (like rspec does). Ie. something like > this: > > > > def mock(clrInterface): > > class ClrMock < clrInterface > > # monkey-patch all of ?clrInterface.methods" here, and redirect to the > mocking framework > > end > > return ClrMock.new > > end > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Ivan Porto Carrero > *Sent:* Sunday, May 03, 2009 3:18 AM > *To:* ironruby-core > *Subject:* [Ironruby-core] Building expressions > > > > Hi > > I'm trying to get some Moq mockery going in IronRuby but Moq expects > Expression> in his methods. > Is there a way to make a RubyProc/lambda return an expression or convert it > to an expression? > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Author of IronRuby in Action (http://manning.com/carrero) > > Steve Martin - "I've got to keep breathing. It'll be my worst business mistake if I > don't." > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From curth at microsoft.com Tue May 5 10:53:06 2009 From: curth at microsoft.com (Curt Hagenlocher) Date: Tue, 5 May 2009 07:53:06 -0700 Subject: [Ironruby-core] Building expressions In-Reply-To: References: <710DF26F214D2B4BB94287123FFE980A2E1BEDC107@NA-EXMSG-C104.redmond.corp.microsoft.com> Message-ID: Of course you should be able to build the expression tree manually ? though even here, you may have trouble under .NET 3.5 as a result of the duplicated namespace. (That issue goes away with .NET 4.) From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Tuesday, May 05, 2009 7:46 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Building expressions Yes I have since changed my approach. I've also talked with Mark about approaching this. The approach I take now is to generate a proxy to the object/class/interface that will record method calls. After recording you can then run verifications on those method calls. The way I generate the proxy for an interface came out of my talk with Mark. http://github.com/casualjim/caricature/blob/922bdcd11d9b0a1aa5500c3fe430483863d9041e/lib/caricature/proxy.rb#L92 But the deeper implication is then that when a library uses Expression> as parameters you cannot use it from ironruby at all? Not even by building the expression tree yourself? (I forgot to hit send apparently :)) --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero GSM: +32.486.787.582 Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Emo Philips - "I got some new underwear the other day. Well, new to me." On Sun, May 3, 2009 at 11:37 PM, Shri Borde > wrote: It cannot be done. Even if you could get to the ExpressionTree of a Ruby lambda, the ExpressionTree would be loosely-bound as Ruby uses duck-typing, whereas Moq expects a strongly-typed ExpressionTree so that it can figure out the exact method that you are trying to associate some expectation with. FWIW, Mark had also been playing with mocking, and in our discussions, we said that the easiest mocking approach would be to use Ruby features like method_missing, monkey-patching, etc (like rspec does). Ie. something like this: def mock(clrInterface): class ClrMock < clrInterface # monkey-patch all of ?clrInterface.methods" here, and redirect to the mocking framework end return ClrMock.new end From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Sunday, May 03, 2009 3:18 AM To: ironruby-core Subject: [Ironruby-core] Building expressions Hi I'm trying to get some Moq mockery going in IronRuby but Moq expects Expression> in his methods. Is there a way to make a RubyProc/lambda return an expression or convert it to an expression? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Author of IronRuby in Action (http://manning.com/carrero) Steve Martin - "I've got to keep breathing. It'll be my worst business mistake if I don't." _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdeville at microsoft.com Tue May 5 15:57:28 2009 From: jdeville at microsoft.com (Jim Deville) Date: Tue, 5 May 2009 19:57:28 +0000 Subject: [Ironruby-core] Code Review: ToProc1 In-Reply-To: References: Message-ID: Looks good to me. Does this pass the specs? If so can you untag them? (mspec -fs core/method/to_proc) JD ...there is no try > -----Original Message----- > From: Tomas Matousek > Sent: Tuesday, May 05, 2009 12:34 PM > To: IronRuby External Code Reviewers > Cc: ironruby-core at rubyforge.org > Subject: Code Review: ToProc1 > > tfpt review "/shelveset:ToProc1;REDMOND\tomat" > > Implements Method#to_proc. > > Tomas From Tomas.Matousek at microsoft.com Tue May 5 16:31:52 2009 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Tue, 5 May 2009 13:31:52 -0700 Subject: [Ironruby-core] Code Review: ToProc1 In-Reply-To: References: Message-ID: Will remove the tags. Tomas -----Original Message----- From: Jim Deville Sent: Tuesday, May 05, 2009 12:57 PM To: Tomas Matousek; IronRuby External Code Reviewers Cc: ironruby-core at rubyforge.org Subject: RE: Code Review: ToProc1 Looks good to me. Does this pass the specs? If so can you untag them? (mspec -fs core/method/to_proc) JD ...there is no try > -----Original Message----- > From: Tomas Matousek > Sent: Tuesday, May 05, 2009 12:34 PM > To: IronRuby External Code Reviewers > Cc: ironruby-core at rubyforge.org > Subject: Code Review: ToProc1 > > tfpt review "/shelveset:ToProc1;REDMOND\tomat" > > Implements Method#to_proc. > > Tomas From Jimmy.Schementi at microsoft.com Wed May 6 21:33:15 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Thu, 7 May 2009 01:33:15 +0000 Subject: [Ironruby-core] Code Review: Files3 In-Reply-To: References: Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC016B7B5A@tk5ex14mbxc106.redmond.corp.microsoft.com> F***** awesome!!!! (damn MS curse filter, I need to express my emotions here!). Thanks Tomas! This will improve Rails perf also =) > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > bounces at rubyforge.org] On Behalf Of Tomas Matousek > Sent: Wednesday, May 06, 2009 5:16 PM > To: ironruby-core at rubyforge.org > Subject: [Ironruby-core] Code Review: Files3 > > tfpt review "/shelveset:Files3;REDMOND\tomat" > > Improves performance for file IO#read method. > Previously we were 10x slower than MRI, now we are approx. 1.5-times > faster. > > Tomas > > MRI: > D:\temp>ruby file.rb > user system total real > write big.txt > 6.287000 0.046000 6.333000 ( 6.337000) > write big_lines.txt > 0.265000 0.063000 0.328000 ( 0.327000) > read big.txt > 100 x 1 x 10000000 3.635000 1.825000 5.460000 ( 5.463000) > 100 x 10 x 1000000 3.370000 2.122000 5.492000 ( 5.493000) > 100 x 1000 x 10000 3.900000 1.747000 5.647000 ( 5.650000) > 100 x 10000 x 1000 5.335000 1.326000 6.661000 ( 6.680000) > 10 x 100000 x 100 1.404000 0.218000 1.622000 ( 1.623000) > 10 x 1000000 x 10 10.858000 0.203000 11.061000 ( 11.065000) > 1 x 10000000 x 1 10.546000 0.000000 10.546000 ( 10.565000) > read big_lines.txt > 100 x 1 x 10000000 3.603000 1.888000 5.491000 ( 5.494000) > 100 x 10 x 1000000 3.479000 2.043000 5.522000 ( 5.525000) > 100 x 1000 x 10000 3.978000 1.716000 5.694000 ( 5.696000) > 100 x 10000 x 1000 5.179000 1.529000 6.708000 ( 6.711000) > 10 x 100000 x 100 1.451000 0.156000 1.607000 ( 1.607000) > 10 x 1000000 x 10 10.842000 0.203000 11.045000 ( 11.050000) > 1 x 10000000 x 1 10.530000 0.031000 10.561000 ( 10.581000) > > IronRuby: > D:\temp>rbr file.rb > user system total real > write big.txt > 4.726830 0.046800 4.773631 ( 4.728769) > write big_lines.txt > 1.060807 0.046800 1.107607 ( 1.045636) > read big.txt > 100 x 1 x 10000000 1.466409 1.216808 2.683217 ( 2.677968) > 100 x 10 x 1000000 2.168414 0.982806 3.151220 ( 3.150579) > 100 x 1000 x 10000 1.653611 0.826805 2.480416 ( 2.481799) > 100 x 10000 x 1000 2.433616 1.669211 4.102826 ( 4.105114) > 10 x 100000 x 100 0.811205 0.156001 0.967206 ( 0.967746) > 10 x 1000000 x 10 6.567642 0.124801 6.692443 ( 6.696175) > 1 x 10000000 x 1 6.255640 0.031200 6.286840 ( 6.290346) > read big_lines.txt > 100 x 1 x 10000000 1.762811 1.216808 2.979619 ( 2.981281) > 100 x 10 x 1000000 2.620817 0.780005 3.400822 ( 3.402718) > 100 x 1000 x 10000 1.840812 1.216808 3.057620 ( 3.059325) > 100 x 10000 x 1000 2.605217 1.950013 4.555229 ( 4.557770) > 10 x 100000 x 100 0.826805 0.171601 0.998406 ( 0.998963) > 10 x 1000000 x 10 6.614442 0.312002 6.926444 ( 6.930307) > 1 x 10000000 x 1 6.333641 0.124801 6.458441 ( 6.493261) > > require 'benchmark' > > File.delete("big.txt") rescue 0 > File.delete("big_lines.txt") rescue 0 > > Benchmark.bm do |x| > puts "write big.txt" > x.report { > File.open("big.txt", "wb") { |f| > 10_000_000.times { f.write('x') } > } > } > > puts "write big_lines.txt" > x.report { > File.open("big_lines.txt", "wb") { |f| > 2.times { > 1_000.times { f.write('x' * 1000 + "\r\n") } > 1_000.times { f.write('x' * 1000 + "\r") } > 1_000.times { f.write('x' * 1000 + "\r\n") } > 1_000.times { f.write('x' * 1000 + "\n") } > 1_000.times { f.write('x' * 1000 + "\r\n") } > } > } > } > > ["big.txt", "big_lines.txt"].each do |file| > puts "read #{file}" > > [ > [100, 1, 10_000_000], > [100, 10, 1_000_000], > [100, 1_000, 10_000], > [100, 10_000, 1_000], > [ 10, 100_000, 100], > [ 10, 1_000_000, 10], > [ 1, 10_000_000, 1], > ].each { |n, m, s| > x.report("#{n} x #{m} x #{s}") { > File.open(file, "r") { |f| > n.times { > f.seek(0); > m.times { > f.read(s) > } > } > } > } > } > > end > end > > From matt at mattotto.com Thu May 7 13:06:12 2009 From: matt at mattotto.com (Matt Otto) Date: Thu, 7 May 2009 13:06:12 -0400 Subject: [Ironruby-core] IronRuby and Cucumber - undefined method `bin_path' for Gem:Module (NoMethodError) Message-ID: Hello, I'm running into the following issue trying to run cucumber with the latest iron ruby source from git: c:/ruby/bin/cucumber:19: undefined method `bin_path' for Gem:Module (NoMethodError) This occurs when running either icucumber --help or the i18n cucumber sample. I've not tried any of the other examples. Yesterday morning I was able to get the scenarios in the i18n examples to partially execute until they failed with "Unable to cast from Func to BlockCallTargetN" and :0:in `concat': can't modify frozen object (TypeError)". exceptions, but after updating this morning I'm only seeing the undefined method exception. I'm currently sharing gems between MRI and Iron Ruby if that matters, and am using the instructions found here for cucumber: http://wiki.github.com/aslakhellesoy/cucumber/ironruby-and-net Does anyone have any ideas? Or should I file a bug for this on CodePlex? Also if you need more information let me know. Thanks in advance, Matt From lists at ruby-forum.com Fri May 8 03:35:47 2009 From: lists at ruby-forum.com (Sami Alitalo) Date: Fri, 8 May 2009 09:35:47 +0200 Subject: [Ironruby-core] Problems with win32ole.so Message-ID: <6d6122f5c1b31953d540d47b2b48c0db@ruby-forum.com> Hi all, I hope this is the right forum to ask following question. I am testing IronRuby 0.3 and trying to use ruby(ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-mswin32]) application which works fine on my XP machine. I have given correct paths to IronRuby but I get (The module was expected to contain an assembly manifest. (Exception from HRESULT: 0x80131018)) error when IronRuby try to load assembly. Here is code how I have initialized runtime: ScriptRuntimeSetup setup = new ScriptRuntimeSetup(); setup.LanguageSetups.Add( new LanguageSetup( typeof(RubyContext).AssemblyQualifiedName, "IronRuby", new[] { "IronRuby" }, new[] { ".rb" } )); ScriptRuntime runtime = new ScriptRuntime(setup); ScriptEngine engine = Ruby.CreateEngine(); List paths = new List(); paths.Add(@"C:\ironruby\Merlin\Main\Languages\Ruby\Libs"); paths.Add(@"C:\ruby\lib\ruby\1.8"); paths.Add(@"C:\ironruby\Merlin\External.LCA_RESTRICTED\Languages\Ruby\redist-libs\ruby\site_ruby\1.8"); paths.Add(@"C:\ironruby\Merlin\External.LCA_RESTRICTED\Languages\Ruby\ruby-1.8.6p287\lib\ruby\1.8\i386-mswin32"); engine.SetSearchPaths(paths); engine.ExecuteFile(@"C:\test.rb"); So am I trying do something which is currently impossible with current IronRuby implementation or did I do somekind of configuration mistake? -- Posted via http://www.ruby-forum.com/. From ivan at flanders.co.nz Fri May 8 03:48:41 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Fri, 8 May 2009 09:48:41 +0200 Subject: [Ironruby-core] Problems with win32ole.so In-Reply-To: <6d6122f5c1b31953d540d47b2b48c0db@ruby-forum.com> References: <6d6122f5c1b31953d540d47b2b48c0db@ruby-forum.com> Message-ID: You can use ironruby-dbi to access databases. Or you can use the ADO.NET interfaces directly. win32ole relies on C-extensions and they don't work on IronRuby If your application depends on C-extensions they need to be ported to C#. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Ogden Nash - "The trouble with a kitten is that when it grows up, it's always a cat." On Fri, May 8, 2009 at 9:35 AM, Sami Alitalo wrote: > Hi all, > > I hope this is the right forum to ask following question. > > I am testing IronRuby 0.3 and trying to use ruby(ruby 1.8.7 (2008-08-11 > patchlevel 72) [i386-mswin32]) application which works fine on my XP > machine. I have given correct paths to IronRuby but I get (The module > was expected to contain an assembly manifest. (Exception from HRESULT: > 0x80131018)) error when IronRuby try to load assembly. > > Here is code how I have initialized runtime: > > ScriptRuntimeSetup setup = new ScriptRuntimeSetup(); > setup.LanguageSetups.Add( > new LanguageSetup( > typeof(RubyContext).AssemblyQualifiedName, > "IronRuby", > new[] { "IronRuby" }, > new[] { ".rb" } > )); > ScriptRuntime runtime = new ScriptRuntime(setup); > ScriptEngine engine = Ruby.CreateEngine(); > List paths = new List(); > > paths.Add(@"C:\ironruby\Merlin\Main\Languages\Ruby\Libs"); > paths.Add(@"C:\ruby\lib\ruby\1.8"); > > paths.Add(@"C:\ironruby\Merlin\External.LCA_RESTRICTED\Languages\Ruby\redist-libs\ruby\site_ruby\1.8"); > > paths.Add(@"C:\ironruby\Merlin\External.LCA_RESTRICTED\Languages\Ruby\ruby-1.8.6p287\lib\ruby\1.8\i386-mswin32"); > > engine.SetSearchPaths(paths); > engine.ExecuteFile(@"C:\test.rb"); > > So am I trying do something which is currently impossible with current > IronRuby implementation or did I do somekind of configuration mistake? > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Fri May 8 04:12:51 2009 From: lists at ruby-forum.com (Sami Alitalo) Date: Fri, 8 May 2009 10:12:51 +0200 Subject: [Ironruby-core] Problems with win32ole.so In-Reply-To: References: <6d6122f5c1b31953d540d47b2b48c0db@ruby-forum.com> Message-ID: <0303bc5848e76ff378251edc809881ea@ruby-forum.com> Thanks for your quick answer. In my case this means porting to C#. Br, Sami -- Posted via http://www.ruby-forum.com/. From Tomas.Matousek at microsoft.com Fri May 8 12:25:06 2009 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Fri, 8 May 2009 09:25:06 -0700 Subject: [Ironruby-core] Problems with win32ole.so In-Reply-To: <0303bc5848e76ff378251edc809881ea@ruby-forum.com> References: <6d6122f5c1b31953d540d47b2b48c0db@ruby-forum.com> <0303bc5848e76ff378251edc809881ea@ruby-forum.com> Message-ID: What methods and modules do you use from Win32OLE? It might be actually easy to implement them in Ruby using our .NET and COM interop features. Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Sami Alitalo Sent: Friday, May 08, 2009 1:13 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Problems with win32ole.so Thanks for your quick answer. In my case this means porting to C#. Br, Sami -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From petrikvandervelde at gmail.com Fri May 8 19:00:23 2009 From: petrikvandervelde at gmail.com (Patrick van der Velde) Date: Sat, 9 May 2009 11:00:23 +1200 Subject: [Ironruby-core] Is it possible to run rake on the latest binary release of IronRuby? Message-ID: <35c5ad0c0905081600n2a28af69hd9225d931ff0d6f7@mail.gmail.com> Hi All I was wondering if it was possible to run rake (or irake) on the latest binary release of IronRuby. I've searched the mailing list but all posts relating to rake are several months old and are not related to the binary releases :( I've tried to run irake but I'm getting NotImplementedExceptions when I run it. If anybody has suggestions that would be greatly appreciated. Thanks Patrick From Jimmy.Schementi at microsoft.com Fri May 8 21:35:02 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Sat, 9 May 2009 01:35:02 +0000 Subject: [Ironruby-core] Is it possible to run rake on the latest binary release of IronRuby? In-Reply-To: <35c5ad0c0905081600n2a28af69hd9225d931ff0d6f7@mail.gmail.com> References: <35c5ad0c0905081600n2a28af69hd9225d931ff0d6f7@mail.gmail.com> Message-ID: <7B83D1AE-0B31-4FD9-AF56-B3CCF8964EC8@microsoft.com> It definitely works for me, as I can do things like irake db:migrate, but this is out of my fork's railsconf branch; I'll be making sure the main repo has all the necessary fixed to run rake and rails without any major workarounds. ~Jimmy Sent from my phone On May 8, 2009, at 4:00 PM, "Patrick van der Velde" wrote: > Hi All > > I was wondering if it was possible to run rake (or irake) on the > latest binary release of IronRuby. I've searched the mailing list but > all posts relating to rake are several months old and are not related > to the binary releases :( I've tried to run irake but I'm getting > NotImplementedExceptions when I run it. If anybody has suggestions > that would be greatly appreciated. > > Thanks > > Patrick > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > From petrikvandervelde at gmail.com Sat May 9 20:11:57 2009 From: petrikvandervelde at gmail.com (Patrick van der Velde) Date: Sun, 10 May 2009 12:11:57 +1200 Subject: [Ironruby-core] Is it possible to run rake on the latest binary release of IronRuby? In-Reply-To: <7B83D1AE-0B31-4FD9-AF56-B3CCF8964EC8@microsoft.com> References: <35c5ad0c0905081600n2a28af69hd9225d931ff0d6f7@mail.gmail.com> <7B83D1AE-0B31-4FD9-AF56-B3CCF8964EC8@microsoft.com> Message-ID: <35c5ad0c0905091711j7b816bc6q7430273853e28aaa@mail.gmail.com> Hiya Mmm ok I'm a little confused here. So irake does work but possibly not on the latest binary release? Also does irake need rake under the covers or should it just be able to run rake files without any link to Ruby. I haven't got Ruby installed on my machine (but I do have ironruby). Also do I need to set any paths etc? Sorry about all the stupid questions but I'm very new to ironruby (and ruby actually) so I'm not sure where to search for the solution to my problem. Thanks Patrick On Sat, May 9, 2009 at 13:35, Jimmy Schementi wrote: > It definitely works for me, as I can do things like irake db:migrate, > but this is out of my fork's railsconf branch; I'll be making sure the > main repo has all the necessary fixed to run rake and rails without > any major workarounds. > > ~Jimmy > Sent from my phone > > On May 8, 2009, at 4:00 PM, "Patrick van der Velde" ?> wrote: > >> Hi All >> >> I was wondering if it was possible to run rake (or irake) on the >> latest binary release of IronRuby. I've searched the mailing list but >> all posts relating to rake are several months old and are not related >> to the binary releases :( I've tried to run irake but I'm getting >> NotImplementedExceptions when I run it. If anybody has suggestions >> that would be greatly appreciated. >> >> Thanks >> >> Patrick >> _______________________________________________ >> Ironruby-core mailing list >> Ironruby-core at rubyforge.org >> http://rubyforge.org/mailman/listinfo/ironruby-core >> > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > From lists at ruby-forum.com Sun May 10 00:40:40 2009 From: lists at ruby-forum.com (Shay Friedman) Date: Sun, 10 May 2009 06:40:40 +0200 Subject: [Ironruby-core] Questions regarding the plans for V1 Message-ID: <720f938b97e106b7dc58455f365db325@ruby-forum.com> Hi, I was wondering about 2 issues regarding IronRuby 1.0: 1. Is IronRuby based on Ruby 1.9 or 1.8? 2. Will all of the libraries mentioned on the "Standard libraries" page in the IronRuby.net site be released with V1? Many thanks, Shay ----------------- Shay Friedman http://www.IronShay.com -- Posted via http://www.ruby-forum.com/. From ivan at flanders.co.nz Sun May 10 02:34:15 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Sun, 10 May 2009 08:34:15 +0200 Subject: [Ironruby-core] Is it possible to run rake on the latest binary release of IronRuby? In-Reply-To: <35c5ad0c0905091711j7b816bc6q7430273853e28aaa@mail.gmail.com> References: <35c5ad0c0905081600n2a28af69hd9225d931ff0d6f7@mail.gmail.com> <7B83D1AE-0B31-4FD9-AF56-B3CCF8964EC8@microsoft.com> <35c5ad0c0905091711j7b816bc6q7430273853e28aaa@mail.gmail.com> Message-ID: Hi Patrick You will need the rake gem to be installed in IronRuby for the irake command to work. You can do that with the igem command igem install rake I assume you're using windows because the igem command is broken again on mono. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Charles Kuralt - "You can find your way across this country using burger joints the way a navigator uses stars." On Sun, May 10, 2009 at 2:11 AM, Patrick van der Velde < petrikvandervelde at gmail.com> wrote: > Hiya > > Mmm ok I'm a little confused here. So irake does work but possibly not > on the latest binary release? Also does irake need rake under the > covers or should it just be able to run rake files without any link to > Ruby. I haven't got Ruby installed on my machine (but I do have > ironruby). Also do I need to set any paths etc? > Sorry about all the stupid questions but I'm very new to ironruby (and > ruby actually) so I'm not sure where to search for the solution to my > problem. > > Thanks > > Patrick > > On Sat, May 9, 2009 at 13:35, Jimmy Schementi > wrote: > > It definitely works for me, as I can do things like irake db:migrate, > > but this is out of my fork's railsconf branch; I'll be making sure the > > main repo has all the necessary fixed to run rake and rails without > > any major workarounds. > > > > ~Jimmy > > Sent from my phone > > > > On May 8, 2009, at 4:00 PM, "Patrick van der Velde" < > petrikvandervelde at gmail.com > > > wrote: > > > >> Hi All > >> > >> I was wondering if it was possible to run rake (or irake) on the > >> latest binary release of IronRuby. I've searched the mailing list but > >> all posts relating to rake are several months old and are not related > >> to the binary releases :( I've tried to run irake but I'm getting > >> NotImplementedExceptions when I run it. If anybody has suggestions > >> that would be greatly appreciated. > >> > >> Thanks > >> > >> Patrick > >> _______________________________________________ > >> Ironruby-core mailing list > >> Ironruby-core at rubyforge.org > >> http://rubyforge.org/mailman/listinfo/ironruby-core > >> > > _______________________________________________ > > Ironruby-core mailing list > > Ironruby-core at rubyforge.org > > http://rubyforge.org/mailman/listinfo/ironruby-core > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > -------------- next part -------------- An HTML attachment was scrubbed... URL: From petrikvandervelde at gmail.com Sun May 10 02:53:25 2009 From: petrikvandervelde at gmail.com (Patrick van der Velde) Date: Sun, 10 May 2009 18:53:25 +1200 Subject: [Ironruby-core] Is it possible to run rake on the latest binary release of IronRuby? In-Reply-To: References: <35c5ad0c0905081600n2a28af69hd9225d931ff0d6f7@mail.gmail.com> <7B83D1AE-0B31-4FD9-AF56-B3CCF8964EC8@microsoft.com> <35c5ad0c0905091711j7b816bc6q7430273853e28aaa@mail.gmail.com> Message-ID: <35c5ad0c0905092353t4a21b064xf46bda2024a5e32d@mail.gmail.com> Hiya Ok so I installed rake and got: C:\languages\ironruby\bin>igem install rake Successfully installed rake-0.8.5 1 gem installed Installing ri documentation for rake-0.8.5... Invalid output formatter For help on options, try 'rdoc --help' Then I assume that not having the documentation is not a problem so I try to run irake but get: C:\languages\ironruby\bin>irake :0:in `to_proc': The method or operation is not implemented. (System::NotImplementedException) from alt_system.rb:0 from :0:in `require' from custom_require.rb:26:in `require' from win32.rb:0 from :0:in `require' from custom_require.rb:26:in `require' from rake.rb:0 from :0:in `require' from custom_require.rb:26:in `require' from rake:0 from :0:in `load' from irake:0 Any ideas on this one? Am I missing more gems? Oh and yes I'm on a Windows machine :) Thanks Patrick On Sun, May 10, 2009 at 18:34, Ivan Porto Carrero wrote: > Hi Patrick > You will need the rake gem to be installed in IronRuby for the irake command > to work. > You can do that with the igem command > igem install rake > I assume you're using windows because the igem command is broken again on > mono. > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > Charles Kuralt ?- "You can find your way across this country using burger > joints the way a navigator uses stars." > > On Sun, May 10, 2009 at 2:11 AM, Patrick van der Velde > wrote: >> >> Hiya >> >> Mmm ok I'm a little confused here. So irake does work but possibly not >> on the latest binary release? Also does irake need rake under the >> covers or should it just be able to run rake files without any link to >> Ruby. I haven't got Ruby installed on my machine (but I do have >> ironruby). Also do I need to set any paths etc? >> Sorry about all the stupid questions but I'm very new to ironruby (and >> ruby actually) so I'm not sure where to search for the solution to my >> problem. >> >> Thanks >> >> Patrick >> >> On Sat, May 9, 2009 at 13:35, Jimmy Schementi >> wrote: >> > It definitely works for me, as I can do things like irake db:migrate, >> > but this is out of my fork's railsconf branch; I'll be making sure the >> > main repo has all the necessary fixed to run rake and rails without >> > any major workarounds. >> > >> > ~Jimmy >> > Sent from my phone >> > >> > On May 8, 2009, at 4:00 PM, "Patrick van der Velde" >> > > > ?> wrote: >> > >> >> Hi All >> >> >> >> I was wondering if it was possible to run rake (or irake) on the >> >> latest binary release of IronRuby. I've searched the mailing list but >> >> all posts relating to rake are several months old and are not related >> >> to the binary releases :( I've tried to run irake but I'm getting >> >> NotImplementedExceptions when I run it. If anybody has suggestions >> >> that would be greatly appreciated. >> >> >> >> Thanks >> >> >> >> Patrick >> >> _______________________________________________ >> >> Ironruby-core mailing list >> >> Ironruby-core at rubyforge.org >> >> http://rubyforge.org/mailman/listinfo/ironruby-core >> >> >> > _______________________________________________ >> > Ironruby-core mailing list >> > Ironruby-core at rubyforge.org >> > http://rubyforge.org/mailman/listinfo/ironruby-core >> > >> _______________________________________________ >> Ironruby-core mailing list >> Ironruby-core at rubyforge.org >> http://rubyforge.org/mailman/listinfo/ironruby-core > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > From ivan at flanders.co.nz Sun May 10 04:06:07 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Sun, 10 May 2009 10:06:07 +0200 Subject: [Ironruby-core] IronRuby projects newsletter In-Reply-To: <43769a4a0905091800j775454br6f3989513aa13321@mail.gmail.com> References: <710DF26F214D2B4BB94287123FFE980A2E1C19C904@NA-EXMSG-C104.redmond.corp.microsoft.com> <43769a4a0905091800j775454br6f3989513aa13321@mail.gmail.com> Message-ID: Yesterday I actually finished my implementation I think. I will probably need to add some more matchers and expectations.I'm now documenting the thing, creating the gemspecs and applying to rubyforge so that I can release the gem on rubyforge too. >From the start I wanted to do away with names like mock, stub, record, replay, verify etc. Instead I took the advice from Roy Osherhove and went with a name of Isolator (Isolation might be better though) for creating a mock. An Isolator will create what in Rhino.Mocks would be called a PartialDynamicMock :) In Moq it would be the Loose mocking strategy. The naming of the methods for creating mocks is the one that JP Boodhoo proposed WhenToldTo and WasToldTo. To specify a stub/expectation on a mock you have one and only one way of doing that with the method called when_told_to. Then when you're asserting you can use the was_told_to method mock = Isolator.for(Ninja) mock.when_told_to(:attack) do |exp| exp.with(:shuriken) exp.return(3) end Battle.new(mock) battle.combat mock.was_told_to?(:attack).should.be.successful Caricature handles interfaces, interface inheritance, CLR objects, CLR object instances, Ruby classes and instances of Ruby classes. I only embarked on this project because I really want to get IronRubyMVC spec'ed with a ruby testing framework, on the other hand it has been good fun. So now I'm trying to find out if people actually want more from a mocking library than setting expectations, verifying those expectations on arguments and/or number of times called. I find that when I use mocking I tend to stay away of the fancy stuff and that it was this fancy stuff that confused the hell out of me in the beginning because I needed to give it a place (which turned out to be oblivion :) ) Along with all the confusion that grew out of StrictMock, DynamicMock, PartialMock and Stub. So if anybody is up to reviewing the code please do. I welcome all suggestions, issue submissions etc. I couldn't add support for events yet and commented out the spec that tests that. I saw a tweet passing by from Curt where he was too tired to test the event support. Then downloaded the latest git but it still won't work. Do I need to submit a bug for that or just be a little bit more patient ? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero GSM: +32.486.787.582 Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Bernard Baruch - "Vote for the man who promises least; he'll be the least disappointing." On Sun, May 10, 2009 at 3:00 AM, Mark Ryall wrote: > Hi everyone, > > Ivan and I have taken the interesting approach to collaboration by each > working on our own subtly different mock objects implementation, > communicating regularly and stealing each other's ideas where necessary. > I released my crude attempt yesterday in case anyone wants to play around > with it: > > gem install markryall-orangutan (from gems.github.com) > > or > > gem install orangutan (from rubyforge) > > At this stage, you can only create stubs that implement a clr interface (as > well as pure ruby stubs) and then tell them how to behave (return values, > raise errors and yield values). I'll add subclassing of clr classes and a > nicer DSL for checking what actually happened. > > See http://github.com/markryall/orangutan/tree/master and > http://github.com/casualjim/caricature/tree/master > > Before long, we'll combine our efforts into one super mock object library > that will mock objects like they've never been mocked before. > > Mark. > > On Fri, May 8, 2009 at 5:00 AM, Shri Borde wrote: > >> This ?newsletter? is just part of the contents of >> http://wiki.github.com/ironruby/ironruby/contributing for your reading >> convenience, filtered down to projects with an updated status since last >> time. A number of the projects have made good progress since a few weeks >> ago. Please take a look at the projects that interest you, give feedback to >> the project owners for bugs or features you care about, and discuss ways of >> being involved if you are interested. >> >> >> >> Regards, >> >> Shri >> >> >> Mixing Ruby mocking with .NET mocking frameworks >> >> Mark Ryall, Ivan Porto Carrero >> >> Investigated Moq and NMock and found that they were not a good match. A >> project called Caricature has >> been started to implement mocking directly in IronRuby >> Hpricot >> >> Daniele Alessandri >> >> Status: the master branch (compatible with Hpricot 0.6.164) and the >> 0.7_experimental branch (compatible with Hpricot 0.8.1) in the repository >> both pass all the tests of the original Hpricot test suite, what is left is >> a major clean up and some refinements to the code. >> Json >> >> Daniele Alessandri >> >> Status: it somewhat works but needs to be tested, so bugs are expected at >> this stage. A rewriting of the original definition file for Ragel is planned >> to improve the C# code of the ParserEngine class which currently is not so >> object oriented. >> IRDb >> >> Project State: Alpha >> >> Developer(s): Ray Vernagus >> >> A Ruby wrapper on top of the .NET Data Provider Model.This wrapper will become the basis for an ActiveRecord adapter giving >> IronRuby developers the ability to use the ActiveRecord gem with their >> choice of database. >> Rails >> >> Jimmy Schementi, Ray Vernagus >> >> Details status about setting up Rails, running the unit tests, etc, is at >> http://www.ironruby.net/Documentation/Rails. >> OpenSSL >> >> Jirapong Nanta >> >> Status: There are about 330 methods for OpenSSL library. Less than ten >> RubySpec are >> available. The focus of the project will be implementation the functionality >> that is needed for RubyGems and Rails scenarios. e.g. >> OpenSSL::X509::Certificate. Current results of running mspec ci >> library\openssl can be found here . >> >> Work process: >> >> * Checkout ruby 1.8 source code >> >> * review OpenSsl implementation in C (ruby_1_8\ext\openssl) >> >> * review OpenSsl usage in RubyGems (e.g. rubygems\lib\rubygems\gem_openssl.rb) >> >> * write RubySpec >> >> * implement a wrapper to System.Security.Cryptography namespaces >> >> * Refactor < - > Push >> >> Some useful documentations can be found at >> http://technorama.net/~oss/ruby/openssl/doc/ >> Porting SOAP Weather Widget >> >> Shay Friedman >> >> Status ? project was created, started porting the Silverlight code. >> RubyGems >> >> Shri Borde, Jirapong Nanta >> >> We have reduced the number of failueres from 200+ down to about 20. The >> current results are here . The tests can >> now be run from a Dev.batenvironment, and will soon be part of continuous integration. So this >> project is mostly wrapping up (successfully). >> Cucumber >> >> Chamini Gallage >> >> Blocking IronRuby bug has been fixed. Need to try again with a newer >> IronRuby version >> >> _______________________________________________ >> Ironruby-core mailing list >> Ironruby-core at rubyforge.org >> http://rubyforge.org/mailman/listinfo/ironruby-core >> >> > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdeville at microsoft.com Sun May 10 04:10:16 2009 From: jdeville at microsoft.com (Jim Deville) Date: Sun, 10 May 2009 08:10:16 +0000 Subject: [Ironruby-core] Is it possible to run rake on the latest binary release of IronRuby? Message-ID: The next time I push, that should be fixed. Tomas just implemented Method#to_proc last week. JD ....there is no try Sent from my phone. Please excuse typos and txtspk. -----Original Message----- From: Patrick van der Velde Sent: May 09, 2009 11:54 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Is it possible to run rake on the latest binary release of IronRuby? Hiya Ok so I installed rake and got: C:\languages\ironruby\bin>igem install rake Successfully installed rake-0.8.5 1 gem installed Installing ri documentation for rake-0.8.5... Invalid output formatter For help on options, try 'rdoc --help' Then I assume that not having the documentation is not a problem so I try to run irake but get: C:\languages\ironruby\bin>irake :0:in `to_proc': The method or operation is not implemented. (System::NotImplementedException) from alt_system.rb:0 from :0:in `require' from custom_require.rb:26:in `require' from win32.rb:0 from :0:in `require' from custom_require.rb:26:in `require' from rake.rb:0 from :0:in `require' from custom_require.rb:26:in `require' from rake:0 from :0:in `load' from irake:0 Any ideas on this one? Am I missing more gems? Oh and yes I'm on a Windows machine :) Thanks Patrick On Sun, May 10, 2009 at 18:34, Ivan Porto Carrero wrote: > Hi Patrick > You will need the rake gem to be installed in IronRuby for the irake command > to work. > You can do that with the igem command > igem install rake > I assume you're using windows because the igem command is broken again on > mono. > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > Charles Kuralt - "You can find your way across this country using burger > joints the way a navigator uses stars." > > On Sun, May 10, 2009 at 2:11 AM, Patrick van der Velde > wrote: >> >> Hiya >> >> Mmm ok I'm a little confused here. So irake does work but possibly not >> on the latest binary release? Also does irake need rake under the >> covers or should it just be able to run rake files without any link to >> Ruby. I haven't got Ruby installed on my machine (but I do have >> ironruby). Also do I need to set any paths etc? >> Sorry about all the stupid questions but I'm very new to ironruby (and >> ruby actually) so I'm not sure where to search for the solution to my >> problem. >> >> Thanks >> >> Patrick >> >> On Sat, May 9, 2009 at 13:35, Jimmy Schementi >> wrote: >> > It definitely works for me, as I can do things like irake db:migrate, >> > but this is out of my fork's railsconf branch; I'll be making sure the >> > main repo has all the necessary fixed to run rake and rails without >> > any major workarounds. >> > >> > ~Jimmy >> > Sent from my phone >> > >> > On May 8, 2009, at 4:00 PM, "Patrick van der Velde" >> > > > > wrote: >> > >> >> Hi All >> >> >> >> I was wondering if it was possible to run rake (or irake) on the >> >> latest binary release of IronRuby. I've searched the mailing list but >> >> all posts relating to rake are several months old and are not related >> >> to the binary releases :( I've tried to run irake but I'm getting >> >> NotImplementedExceptions when I run it. If anybody has suggestions >> >> that would be greatly appreciated. >> >> >> >> Thanks >> >> >> >> Patrick >> >> _______________________________________________ >> >> Ironruby-core mailing list >> >> Ironruby-core at rubyforge.org >> >> http://rubyforge.org/mailman/listinfo/ironruby-core >> >> >> > _______________________________________________ >> > Ironruby-core mailing list >> > Ironruby-core at rubyforge.org >> > http://rubyforge.org/mailman/listinfo/ironruby-core >> > >> _______________________________________________ >> Ironruby-core mailing list >> Ironruby-core at rubyforge.org >> http://rubyforge.org/mailman/listinfo/ironruby-core > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From jdeville at microsoft.com Sun May 10 04:12:49 2009 From: jdeville at microsoft.com (Jim Deville) Date: Sun, 10 May 2009 08:12:49 +0000 Subject: [Ironruby-core] Questions regarding the plans for V1 Message-ID: 1. We use 1.8.6 patchlevel 287 as our reference implementation. 2. The 1.0 release will look just like our current binaries. So all of the compiled libraries + the redist-libs folder. JD ....there is no try Sent from my phone. Please excuse typos and txtspk. -----Original Message----- From: Shay Friedman Sent: May 09, 2009 9:43 PM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] Questions regarding the plans for V1 Hi, I was wondering about 2 issues regarding IronRuby 1.0: 1. Is IronRuby based on Ruby 1.9 or 1.8? 2. Will all of the libraries mentioned on the "Standard libraries" page in the IronRuby.net site be released with V1? Many thanks, Shay ----------------- Shay Friedman http://www.IronShay.com -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From ivan at flanders.co.nz Sun May 10 04:27:08 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Sun, 10 May 2009 10:27:08 +0200 Subject: [Ironruby-core] IronRuby projects newsletter In-Reply-To: References: Message-ID: Responses: 1: Yes stubbed by default and only when you're actually interested in asserting if it was called you use the was_told_to? assertion2: Yes always null unless you explicitly tell it to fall through to the implementation of the method. I may make use of the default(T) thing later on to return the default value for value types. 3: no problem I was just curious about that --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero GSM: +32.486.787.582 Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Emma Goldman - "If voting changed anything, they'd make it illegal." On Sun, May 10, 2009 at 10:21 AM, Jim Deville wrote: > 1. Other features: I don't use most of the fancy features, but I do find stubs useful. Do you expect people to use when_told_to without was_told_to? in order to stub something out? > 2. I also find the 'null object' pattern useful. That is where the isolated object always returns nil to methods called on it. > 3. Finally, I've been slow on pushing lately because I'm moving, I'll do a push when I get to decent internet. I'll also work on automating thid in the next couple of weeks. > > > JD > > ....there is no try > Sent from my phone. Please excuse typos and txtspk. > > -----Original Message----- > From: Ivan Porto Carrero > Sent: May 10, 2009 1:11 AM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] IronRuby projects newsletter > > > Yesterday I actually finished my implementation I think. I will probably > need to add some more matchers and expectations. I'm now documenting the > thing, creating the gemspecs and applying to rubyforge so that I can release > the gem on rubyforge too. > > From the start I wanted to do away with names like mock, stub, record, > replay, verify etc. Instead I took the advice from Roy Osherhove and went > with a name of Isolator (Isolation might be better though) for creating a > mock. > > An Isolator will create what in Rhino.Mocks would be called a > PartialDynamicMock :) In Moq it would be the Loose mocking strategy. > > The naming of the methods for creating mocks is the one that JP Boodhoo > proposed WhenToldTo and WasToldTo. > To specify a stub/expectation on a mock you have one and only one way of > doing that with the method called when_told_to. > Then when you're asserting you can use the was_told_to method > > mock = Isolator.for(Ninja) > mock.when_told_to(:attack) do |exp| > exp.with(:shuriken) > exp.return(3) > end > > Battle.new(mock) > battle.combat > > mock.was_told_to?(:attack).should.be.successful > > Caricature handles interfaces, interface inheritance, CLR objects, CLR > object instances, Ruby classes and instances of Ruby classes. > > I only embarked on this project because I really want to get IronRubyMVC > spec'ed with a ruby testing framework, on the other hand it has been good > fun. > > So now I'm trying to find out if people actually want more from a mocking > library than setting expectations, verifying those expectations on arguments > and/or number of times called. > > I find that when I use mocking I tend to stay away of the fancy stuff and > that it was this fancy stuff that confused the hell out of me in the > beginning because I needed to give it a place (which turned out to be > oblivion :) ) Along with all the confusion that grew out of StrictMock, > DynamicMock, PartialMock and Stub. > > So if anybody is up to reviewing the code please do. I welcome all > suggestions, issue submissions etc. > > I couldn't add support for events yet and commented out the spec that > tests that. I saw a tweet passing by from Curt where he was too tired to > test the event support. Then downloaded the latest git but it still won't > work. Do I need to submit a bug for that or just be a little bit more > patient ? > > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > GSM: +32.486.787.582 > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > Bernard Baruch - "Vote for the man who promises least; he'll be the least disappointing." > > On Sun, May 10, 2009 at 3:00 AM, Mark Ryall wrote: > >> Hi everyone, >> >> Ivan and I have taken the interesting approach to collaboration by each >> working on our own subtly different mock objects implementation, >> communicating regularly and stealing each other's ideas where necessary. >> I released my crude attempt yesterday in case anyone wants to play >> around with it: >> >> gem install markryall-orangutan (from gems.github.com) >> >> or >> >> gem install orangutan (from rubyforge) >> >> At this stage, you can only create stubs that implement a clr interface >> (as well as pure ruby stubs) and then tell them how to behave (return >> values, raise errors and yield values). I'll add subclassing of clr classes >> and a nicer DSL for checking what actually happened. >> >> See http://github.com/markryall/orangutan/tree/master and >> http://github.com/casualjim/caricature/tree/master >> >> Before long, we'll combine our efforts into one super mock object >> library that will mock objects like they've never been mocked before. >> >> Mark. >> >> On Fri, May 8, 2009 at 5:00 AM, Shri Borde wrote: >> >>> This ?newsletter? is just part of the contents of >>> http://wiki.github.com/ironruby/ironruby/contributing for your reading >>> convenience, filtered down to projects with an updated status since last >>> time. A number of the projects have made good progress since a few weeks >>> ago. Please take a look at the projects that interest you, give feedback to >>> the project owners for bugs or features you care about, and discuss ways of >>> being involved if you are interested. >>> >>> >>> >>> Regards, >>> >>> Shri >>> >>> >>> Mixing Ruby mocking with .NET mocking frameworks >>> >>> Mark Ryall, Ivan Porto Carrero >>> >>> Investigated Moq and NMock and found that they were not a good match. A >>> project called Caricature has >>> been started to implement mocking directly in IronRuby >>> Hpricot >>> >>> Daniele Alessandri >>> >>> Status: the master branch (compatible with Hpricot 0.6.164) and the >>> 0.7_experimental branch (compatible with Hpricot 0.8.1) in the repository >>> both pass all the tests of the original Hpricot test suite, what is left is >>> a major clean up and some refinements to the code. >>> Json >>> >>> Daniele Alessandri >>> >>> Status: it somewhat works but needs to be tested, so bugs are expected at >>> this stage. A rewriting of the original definition file for Ragel is planned >>> to improve the C# code of the ParserEngine class which currently is not so >>> object oriented. >>> IRDb >>> >>> Project State: Alpha >>> >>> Developer(s): Ray Vernagus >>> >>> A Ruby wrapper on top of the .NET Data Provider Model.This wrapper will become the basis for an ActiveRecord adapter giving >>> IronRuby developers the ability to use the ActiveRecord gem with their >>> choice of database. >>> Rails >>> >>> Jimmy Schementi, Ray Vernagus >>> >>> Details status about setting up Rails, running the unit tests, etc, is at >>> http://www.ironruby.net/Documentation/Rails. >>> OpenSSL >>> >>> Jirapong Nanta >>> >>> Status: There are about 330 methods for OpenSSL library. Less than ten >>> RubySpec are >>> available. The focus of the project will be implementation the functionality >>> that is needed for RubyGems and Rails scenarios. e.g. >>> OpenSSL::X509::Certificate. Current results of running mspec ci >>> library\openssl can be found here . >>> >>> Work process: >>> >>> * Checkout ruby 1.8 source code >>> >>> * review OpenSsl implementation in C (ruby_1_8\ext\openssl) >>> >>> * review OpenSsl usage in RubyGems (e.g. rubygems\lib\rubygems\gem_openssl.rb) >>> >>> * write RubySpec >>> >>> * implement a wrapper to System.Security.Cryptography namespaces >>> >>> * Refactor < - > Push >>> >>> Some useful documentations can be found at >>> http://technorama.net/~oss/ruby/openssl/doc/ >>> Porting SOAP Weather Widget >>> >>> Shay Friedman >>> >>> Status ? project was created, started porting the Silverlight code. >>> RubyGems >>> >>> Shri Borde, Jirapong Nanta >>> >>> We have reduced the number of failueres from 200+ down to about 20. The >>> current results are here . The tests can >>> now be run from a Dev.batenvironment, and will soon be part of continuous integration. So this >>> project is mostly wrapping up (successfully). >>> Cucumber >>> >>> Chamini Gallage >>> >>> Blocking IronRuby bug has been fixed. Need to try again with a newer >>> IronRuby version >>> >>> _______________________________________________ >>> Ironruby-core mailing list >>> Ironruby-core at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/ironruby-core >>> >>> >> >> _______________________________________________ >> Ironruby-core mailing list >> Ironruby-core at rubyforge.org >> http://rubyforge.org/mailman/listinfo/ironruby-core >> >> > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Tomas.Matousek at microsoft.com Sun May 10 12:47:33 2009 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Sun, 10 May 2009 09:47:33 -0700 Subject: [Ironruby-core] Questions regarding the plans for V1 In-Reply-To: References: Message-ID: Some 1.9 features related to string encodings will also be supported if you run ir.exe -19. Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Jim Deville Sent: Sunday, May 10, 2009 1:13 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Questions regarding the plans for V1 1. We use 1.8.6 patchlevel 287 as our reference implementation. 2. The 1.0 release will look just like our current binaries. So all of the compiled libraries + the redist-libs folder. JD ....there is no try Sent from my phone. Please excuse typos and txtspk. -----Original Message----- From: Shay Friedman Sent: May 09, 2009 9:43 PM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] Questions regarding the plans for V1 Hi, I was wondering about 2 issues regarding IronRuby 1.0: 1. Is IronRuby based on Ruby 1.9 or 1.8? 2. Will all of the libraries mentioned on the "Standard libraries" page in the IronRuby.net site be released with V1? Many thanks, Shay ----------------- Shay Friedman http://www.IronShay.com -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From petrikvandervelde at gmail.com Sun May 10 17:13:00 2009 From: petrikvandervelde at gmail.com (Patrick van der Velde) Date: Mon, 11 May 2009 09:13:00 +1200 Subject: [Ironruby-core] Is it possible to run rake on the latest binary release of IronRuby? In-Reply-To: References: Message-ID: <35c5ad0c0905101413gd47b8b5h9ffe8c47b8f85f49@mail.gmail.com> Hi Jim Cool! I'll be waiting for that one then :) Any idea when you'll push it into the trunk? Also do you know if there is a guide for building IronRuby from scratch so that I can build it and get the fix? Thanks Patrick On Sun, May 10, 2009 at 20:10, Jim Deville wrote: > The next time I push, that should be fixed. Tomas just implemented Method#to_proc last week. > > JD > > ....there is no try > Sent from my phone. Please excuse typos and txtspk. > > -----Original Message----- > From: Patrick van der Velde > Sent: May 09, 2009 11:54 PM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Is it possible to run rake on the latest binary ? ?release of IronRuby? > > > Hiya > > Ok so I installed rake and got: > > C:\languages\ironruby\bin>igem install rake > Successfully installed rake-0.8.5 > 1 gem installed > Installing ri documentation for rake-0.8.5... > > Invalid output formatter > > For help on options, try 'rdoc --help' > > Then I assume that not having the documentation is not a problem so I > try to run irake but get: > > C:\languages\ironruby\bin>irake > :0:in `to_proc': The method or operation is not implemented. > (System::NotImplementedException) > ? ? ? ?from alt_system.rb:0 > ? ? ? ?from :0:in `require' > ? ? ? ?from custom_require.rb:26:in `require' > ? ? ? ?from win32.rb:0 > ? ? ? ?from :0:in `require' > ? ? ? ?from custom_require.rb:26:in `require' > ? ? ? ?from rake.rb:0 > ? ? ? ?from :0:in `require' > ? ? ? ?from custom_require.rb:26:in `require' > ? ? ? ?from rake:0 > ? ? ? ?from :0:in `load' > ? ? ? ?from irake:0 > > Any ideas on this one? Am I missing more gems? > > Oh and yes I'm on a Windows machine :) > > Thanks > > Patrick > > > On Sun, May 10, 2009 at 18:34, Ivan Porto Carrero wrote: >> Hi Patrick >> You will need the rake gem to be installed in IronRuby for the irake command >> to work. >> You can do that with the igem command >> igem install rake >> I assume you're using windows because the igem command is broken again on >> mono. >> --- >> Met vriendelijke groeten - Best regards - Salutations >> Ivan Porto Carrero >> Blog: http://flanders.co.nz >> Twitter: http://twitter.com/casualjim >> Author of IronRuby in Action (http://manning.com/carrero) >> >> Charles Kuralt ?- "You can find your way across this country using burger >> joints the way a navigator uses stars." >> >> On Sun, May 10, 2009 at 2:11 AM, Patrick van der Velde >> wrote: >>> >>> Hiya >>> >>> Mmm ok I'm a little confused here. So irake does work but possibly not >>> on the latest binary release? Also does irake need rake under the >>> covers or should it just be able to run rake files without any link to >>> Ruby. I haven't got Ruby installed on my machine (but I do have >>> ironruby). Also do I need to set any paths etc? >>> Sorry about all the stupid questions but I'm very new to ironruby (and >>> ruby actually) so I'm not sure where to search for the solution to my >>> problem. >>> >>> Thanks >>> >>> Patrick >>> >>> On Sat, May 9, 2009 at 13:35, Jimmy Schementi >>> wrote: >>> > It definitely works for me, as I can do things like irake db:migrate, >>> > but this is out of my fork's railsconf branch; I'll be making sure the >>> > main repo has all the necessary fixed to run rake and rails without >>> > any major workarounds. >>> > >>> > ~Jimmy >>> > Sent from my phone >>> > >>> > On May 8, 2009, at 4:00 PM, "Patrick van der Velde" >>> > >> > ?> wrote: >>> > >>> >> Hi All >>> >> >>> >> I was wondering if it was possible to run rake (or irake) on the >>> >> latest binary release of IronRuby. I've searched the mailing list but >>> >> all posts relating to rake are several months old and are not related >>> >> to the binary releases :( I've tried to run irake but I'm getting >>> >> NotImplementedExceptions when I run it. If anybody has suggestions >>> >> that would be greatly appreciated. >>> >> >>> >> Thanks >>> >> >>> >> Patrick >>> >> _______________________________________________ >>> >> Ironruby-core mailing list >>> >> Ironruby-core at rubyforge.org >>> >> http://rubyforge.org/mailman/listinfo/ironruby-core >>> >> >>> > _______________________________________________ >>> > Ironruby-core mailing list >>> > Ironruby-core at rubyforge.org >>> > http://rubyforge.org/mailman/listinfo/ironruby-core >>> > >>> _______________________________________________ >>> Ironruby-core mailing list >>> Ironruby-core at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/ironruby-core >> >> >> _______________________________________________ >> Ironruby-core mailing list >> Ironruby-core at rubyforge.org >> http://rubyforge.org/mailman/listinfo/ironruby-core >> >> > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > From jdeville at microsoft.com Sun May 10 17:20:32 2009 From: jdeville at microsoft.com (Jim Deville) Date: Sun, 10 May 2009 21:20:32 +0000 Subject: [Ironruby-core] Is it possible to run rake on the latest binary release of IronRuby? In-Reply-To: <35c5ad0c0905101413gd47b8b5h9ffe8c47b8f85f49@mail.gmail.com> References: <35c5ad0c0905101413gd47b8b5h9ffe8c47b8f85f49@mail.gmail.com> Message-ID: Pushed it a little while ago. To build, follow the instructions here: http://wiki.github.com/ironruby/ironruby/getting-the-sources to get sources, then here: http://wiki.github.com/ironruby/ironruby/building to build. If you want to contribute back to the project, you can follow the instructions here: http://wiki.github.com/ironruby/ironruby/contributing Hope that helps, feel free to ask if you need help. JD ...there is no try > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > bounces at rubyforge.org] On Behalf Of Patrick van der Velde > Sent: Sunday, May 10, 2009 2:13 PM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Is it possible to run rake on the latest binary > release of IronRuby? > > Hi Jim > > Cool! I'll be waiting for that one then :) Any idea when you'll push it into the > trunk? Also do you know if there is a guide for building IronRuby from scratch > so that I can build it and get the fix? > > Thanks > > Patrick > > On Sun, May 10, 2009 at 20:10, Jim Deville wrote: > > The next time I push, that should be fixed. Tomas just implemented > Method#to_proc last week. > > > > JD > > > > ....there is no try > > Sent from my phone. Please excuse typos and txtspk. > > > > -----Original Message----- > > From: Patrick van der Velde > > Sent: May 09, 2009 11:54 PM > > To: ironruby-core at rubyforge.org > > Subject: Re: [Ironruby-core] Is it possible to run rake on the latest binary > release of IronRuby? > > > > > > Hiya > > > > Ok so I installed rake and got: > > > > C:\languages\ironruby\bin>igem install rake Successfully installed > > rake-0.8.5 > > 1 gem installed > > Installing ri documentation for rake-0.8.5... > > > > Invalid output formatter > > > > For help on options, try 'rdoc --help' > > > > Then I assume that not having the documentation is not a problem so I > > try to run irake but get: > > > > C:\languages\ironruby\bin>irake > > :0:in `to_proc': The method or operation is not implemented. > > (System::NotImplementedException) > > from alt_system.rb:0 > > from :0:in `require' > > from custom_require.rb:26:in `require' > > from win32.rb:0 > > from :0:in `require' > > from custom_require.rb:26:in `require' > > from rake.rb:0 > > from :0:in `require' > > from custom_require.rb:26:in `require' > > from rake:0 > > from :0:in `load' > > from irake:0 > > > > Any ideas on this one? Am I missing more gems? > > > > Oh and yes I'm on a Windows machine :) > > > > Thanks > > > > Patrick > > > > > > On Sun, May 10, 2009 at 18:34, Ivan Porto Carrero > wrote: > >> Hi Patrick > >> You will need the rake gem to be installed in IronRuby for the irake > >> command to work. > >> You can do that with the igem command igem install rake I assume > >> you're using windows because the igem command is broken again on > >> mono. > >> --- > >> Met vriendelijke groeten - Best regards - Salutations Ivan Porto > >> Carrero > >> Blog: http://flanders.co.nz > >> Twitter: http://twitter.com/casualjim Author of IronRuby in Action > >> (http://manning.com/carrero) > >> > >> Charles Kuralt - "You can find your way across this country using > >> burger joints the way a navigator uses stars." > >> > >> On Sun, May 10, 2009 at 2:11 AM, Patrick van der Velde > >> wrote: > >>> > >>> Hiya > >>> > >>> Mmm ok I'm a little confused here. So irake does work but possibly > >>> not on the latest binary release? Also does irake need rake under > >>> the covers or should it just be able to run rake files without any > >>> link to Ruby. I haven't got Ruby installed on my machine (but I do > >>> have ironruby). Also do I need to set any paths etc? > >>> Sorry about all the stupid questions but I'm very new to ironruby > >>> (and ruby actually) so I'm not sure where to search for the solution > >>> to my problem. > >>> > >>> Thanks > >>> > >>> Patrick > >>> > >>> On Sat, May 9, 2009 at 13:35, Jimmy Schementi > >>> wrote: > >>> > It definitely works for me, as I can do things like irake > >>> > db:migrate, but this is out of my fork's railsconf branch; I'll be > >>> > making sure the main repo has all the necessary fixed to run rake > >>> > and rails without any major workarounds. > >>> > > >>> > ~Jimmy > >>> > Sent from my phone > >>> > > >>> > On May 8, 2009, at 4:00 PM, "Patrick van der Velde" > >>> > >>> > > wrote: > >>> > > >>> >> Hi All > >>> >> > >>> >> I was wondering if it was possible to run rake (or irake) on the > >>> >> latest binary release of IronRuby. I've searched the mailing list > >>> >> but all posts relating to rake are several months old and are not > >>> >> related to the binary releases :( I've tried to run irake but I'm > >>> >> getting NotImplementedExceptions when I run it. If anybody has > >>> >> suggestions that would be greatly appreciated. > >>> >> > >>> >> Thanks > >>> >> > >>> >> Patrick > >>> >> _______________________________________________ > >>> >> Ironruby-core mailing list > >>> >> Ironruby-core at rubyforge.org > >>> >> http://rubyforge.org/mailman/listinfo/ironruby-core > >>> >> > >>> > _______________________________________________ > >>> > Ironruby-core mailing list > >>> > Ironruby-core at rubyforge.org > >>> > http://rubyforge.org/mailman/listinfo/ironruby-core > >>> > > >>> _______________________________________________ > >>> Ironruby-core mailing list > >>> Ironruby-core at rubyforge.org > >>> http://rubyforge.org/mailman/listinfo/ironruby-core > >> > >> > >> _______________________________________________ > >> Ironruby-core mailing list > >> Ironruby-core at rubyforge.org > >> http://rubyforge.org/mailman/listinfo/ironruby-core > >> > >> > > _______________________________________________ > > Ironruby-core mailing list > > Ironruby-core at rubyforge.org > > http://rubyforge.org/mailman/listinfo/ironruby-core > > > > _______________________________________________ > > Ironruby-core mailing list > > Ironruby-core at rubyforge.org > > http://rubyforge.org/mailman/listinfo/ironruby-core > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core From petrikvandervelde at gmail.com Sun May 10 18:03:03 2009 From: petrikvandervelde at gmail.com (Patrick van der Velde) Date: Mon, 11 May 2009 10:03:03 +1200 Subject: [Ironruby-core] Is it possible to run rake on the latest binary release of IronRuby? In-Reply-To: References: <35c5ad0c0905101413gd47b8b5h9ffe8c47b8f85f49@mail.gmail.com> Message-ID: <35c5ad0c0905101503j46cfdc14j3b5b84340eed05ad@mail.gmail.com> Hi Jim Thanks for that. I grabbed the sources from GitHub. For now I just grabbed a zip file as I just want to play around with IronRuby. I followed the instructions on the website and managed to build the solution (using VS2008) just fine. No errors / warnings etc. I then copied all the binaries into another folder. I also copied the cmd files from the 0.3 release into that folder. I then tried to run irake but got another error: C:\languages\ironruby\bin>irake :0:in `require': no such file to load -- rubygems (LoadError) from C:/languages/ironruby/bin/irake:9 And when I try to run igem to install rake I get: C:\languages\ironruby\bin>igem install rake :0:in `require': no such file to load -- rubygems (LoadError) from C:/languages/ironruby/bin/igem:8 So any idea where I went wrong? I think I did all the steps in the right order but given that it's not working I guess I didn't entirely get it right :( Thanks heaps for all your help Patrick On Mon, May 11, 2009 at 09:20, Jim Deville wrote: > Pushed it a little while ago. ?To build, follow the instructions here: http://wiki.github.com/ironruby/ironruby/getting-the-sources to get sources, then here: http://wiki.github.com/ironruby/ironruby/building to build. If you want to contribute back to the project, you can follow the instructions here: http://wiki.github.com/ironruby/ironruby/contributing > > Hope that helps, feel free to ask if you need help. > > JD > > ...there is no try > > >> -----Original Message----- >> From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- >> bounces at rubyforge.org] On Behalf Of Patrick van der Velde >> Sent: Sunday, May 10, 2009 2:13 PM >> To: ironruby-core at rubyforge.org >> Subject: Re: [Ironruby-core] Is it possible to run rake on the latest binary >> release of IronRuby? >> >> Hi Jim >> >> Cool! I'll be waiting for that one then :) Any idea when you'll push it into the >> trunk? Also do you know if there is a guide for building IronRuby from scratch >> so that I can build it and get the fix? >> >> Thanks >> >> Patrick >> >> On Sun, May 10, 2009 at 20:10, Jim Deville wrote: >> > The next time I push, that should be fixed. Tomas just implemented >> Method#to_proc last week. >> > >> > JD >> > >> > ....there is no try >> > Sent from my phone. Please excuse typos and txtspk. >> > >> > -----Original Message----- >> > From: Patrick van der Velde >> > Sent: May 09, 2009 11:54 PM >> > To: ironruby-core at rubyforge.org >> > Subject: Re: [Ironruby-core] Is it possible to run rake on the latest binary >> release of IronRuby? >> > >> > >> > Hiya >> > >> > Ok so I installed rake and got: >> > >> > C:\languages\ironruby\bin>igem install rake Successfully installed >> > rake-0.8.5 >> > 1 gem installed >> > Installing ri documentation for rake-0.8.5... >> > >> > Invalid output formatter >> > >> > For help on options, try 'rdoc --help' >> > >> > Then I assume that not having the documentation is not a problem so I >> > try to run irake but get: >> > >> > C:\languages\ironruby\bin>irake >> > :0:in `to_proc': The method or operation is not implemented. >> > (System::NotImplementedException) >> > ? ? ? ?from alt_system.rb:0 >> > ? ? ? ?from :0:in `require' >> > ? ? ? ?from custom_require.rb:26:in `require' >> > ? ? ? ?from win32.rb:0 >> > ? ? ? ?from :0:in `require' >> > ? ? ? ?from custom_require.rb:26:in `require' >> > ? ? ? ?from rake.rb:0 >> > ? ? ? ?from :0:in `require' >> > ? ? ? ?from custom_require.rb:26:in `require' >> > ? ? ? ?from rake:0 >> > ? ? ? ?from :0:in `load' >> > ? ? ? ?from irake:0 >> > >> > Any ideas on this one? Am I missing more gems? >> > >> > Oh and yes I'm on a Windows machine :) >> > >> > Thanks >> > >> > Patrick >> > >> > >> > On Sun, May 10, 2009 at 18:34, Ivan Porto Carrero >> wrote: >> >> Hi Patrick >> >> You will need the rake gem to be installed in IronRuby for the irake >> >> command to work. >> >> You can do that with the igem command igem install rake I assume >> >> you're using windows because the igem command is broken again on >> >> mono. >> >> --- >> >> Met vriendelijke groeten - Best regards - Salutations Ivan Porto >> >> Carrero >> >> Blog: http://flanders.co.nz >> >> Twitter: http://twitter.com/casualjim Author of IronRuby in Action >> >> (http://manning.com/carrero) >> >> >> >> Charles Kuralt ?- "You can find your way across this country using >> >> burger joints the way a navigator uses stars." >> >> >> >> On Sun, May 10, 2009 at 2:11 AM, Patrick van der Velde >> >> wrote: >> >>> >> >>> Hiya >> >>> >> >>> Mmm ok I'm a little confused here. So irake does work but possibly >> >>> not on the latest binary release? Also does irake need rake under >> >>> the covers or should it just be able to run rake files without any >> >>> link to Ruby. I haven't got Ruby installed on my machine (but I do >> >>> have ironruby). Also do I need to set any paths etc? >> >>> Sorry about all the stupid questions but I'm very new to ironruby >> >>> (and ruby actually) so I'm not sure where to search for the solution >> >>> to my problem. >> >>> >> >>> Thanks >> >>> >> >>> Patrick >> >>> >> >>> On Sat, May 9, 2009 at 13:35, Jimmy Schementi >> >>> wrote: >> >>> > It definitely works for me, as I can do things like irake >> >>> > db:migrate, but this is out of my fork's railsconf branch; I'll be >> >>> > making sure the main repo has all the necessary fixed to run rake >> >>> > and rails without any major workarounds. >> >>> > >> >>> > ~Jimmy >> >>> > Sent from my phone >> >>> > >> >>> > On May 8, 2009, at 4:00 PM, "Patrick van der Velde" >> >>> > > >>> > ?> wrote: >> >>> > >> >>> >> Hi All >> >>> >> >> >>> >> I was wondering if it was possible to run rake (or irake) on the >> >>> >> latest binary release of IronRuby. I've searched the mailing list >> >>> >> but all posts relating to rake are several months old and are not >> >>> >> related to the binary releases :( I've tried to run irake but I'm >> >>> >> getting NotImplementedExceptions when I run it. If anybody has >> >>> >> suggestions that would be greatly appreciated. >> >>> >> >> >>> >> Thanks >> >>> >> >> >>> >> Patrick >> >>> >> _______________________________________________ >> >>> >> Ironruby-core mailing list >> >>> >> Ironruby-core at rubyforge.org >> >>> >> http://rubyforge.org/mailman/listinfo/ironruby-core >> >>> >> >> >>> > _______________________________________________ >> >>> > Ironruby-core mailing list >> >>> > Ironruby-core at rubyforge.org >> >>> > http://rubyforge.org/mailman/listinfo/ironruby-core >> >>> > >> >>> _______________________________________________ >> >>> Ironruby-core mailing list >> >>> Ironruby-core at rubyforge.org >> >>> http://rubyforge.org/mailman/listinfo/ironruby-core >> >> >> >> >> >> _______________________________________________ >> >> Ironruby-core mailing list >> >> Ironruby-core at rubyforge.org >> >> http://rubyforge.org/mailman/listinfo/ironruby-core >> >> >> >> >> > _______________________________________________ >> > Ironruby-core mailing list >> > Ironruby-core at rubyforge.org >> > http://rubyforge.org/mailman/listinfo/ironruby-core >> > >> > _______________________________________________ >> > Ironruby-core mailing list >> > Ironruby-core at rubyforge.org >> > http://rubyforge.org/mailman/listinfo/ironruby-core >> > >> _______________________________________________ >> Ironruby-core mailing list >> Ironruby-core at rubyforge.org >> http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > From ivan at flanders.co.nz Sun May 10 18:16:48 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Mon, 11 May 2009 00:16:48 +0200 Subject: [Ironruby-core] Is it possible to run rake on the latest binary release of IronRuby? In-Reply-To: <35c5ad0c0905101503j46cfdc14j3b5b84340eed05ad@mail.gmail.com> References: <35c5ad0c0905101413gd47b8b5h9ffe8c47b8f85f49@mail.gmail.com> <35c5ad0c0905101503j46cfdc14j3b5b84340eed05ad@mail.gmail.com> Message-ID: if you extract the 0.3 release and copy the compiled binaries without the config file over it should be fine. Alternatively you can change the content of ir.exe.config to match your config. IronRuby needs to know the paths in which it can find stuff like rubygems.rb --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero GSM: +32.486.787.582 Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Bernard Baruch - "Vote for the man who promises least; he'll be the least disappointing." On Mon, May 11, 2009 at 12:03 AM, Patrick van der Velde < petrikvandervelde at gmail.com> wrote: > Hi Jim > > Thanks for that. I grabbed the sources from GitHub. For now I just > grabbed a zip file as I just want to play around with IronRuby. > > I followed the instructions on the website and managed to build the > solution (using VS2008) just fine. No errors / warnings etc. I then > copied all the binaries into another folder. I also copied the cmd > files from the 0.3 release into that folder. I then tried to run irake > but got another error: > > C:\languages\ironruby\bin>irake > :0:in `require': no such file to load -- rubygems (LoadError) > from C:/languages/ironruby/bin/irake:9 > > And when I try to run igem to install rake I get: > > C:\languages\ironruby\bin>igem install rake > :0:in `require': no such file to load -- rubygems (LoadError) > from C:/languages/ironruby/bin/igem:8 > > So any idea where I went wrong? I think I did all the steps in the > right order but given that it's not working I guess I didn't entirely > get it right :( > > Thanks heaps for all your help > > Patrick > > > On Mon, May 11, 2009 at 09:20, Jim Deville wrote: > > Pushed it a little while ago. To build, follow the instructions here: > http://wiki.github.com/ironruby/ironruby/getting-the-sources to get > sources, then here: http://wiki.github.com/ironruby/ironruby/building to > build. If you want to contribute back to the project, you can follow the > instructions here: http://wiki.github.com/ironruby/ironruby/contributing > > > > Hope that helps, feel free to ask if you need help. > > > > JD > > > > ...there is no try > > > > > >> -----Original Message----- > >> From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > >> bounces at rubyforge.org] On Behalf Of Patrick van der Velde > >> Sent: Sunday, May 10, 2009 2:13 PM > >> To: ironruby-core at rubyforge.org > >> Subject: Re: [Ironruby-core] Is it possible to run rake on the latest > binary > >> release of IronRuby? > >> > >> Hi Jim > >> > >> Cool! I'll be waiting for that one then :) Any idea when you'll push it > into the > >> trunk? Also do you know if there is a guide for building IronRuby from > scratch > >> so that I can build it and get the fix? > >> > >> Thanks > >> > >> Patrick > >> > >> On Sun, May 10, 2009 at 20:10, Jim Deville > wrote: > >> > The next time I push, that should be fixed. Tomas just implemented > >> Method#to_proc last week. > >> > > >> > JD > >> > > >> > ....there is no try > >> > Sent from my phone. Please excuse typos and txtspk. > >> > > >> > -----Original Message----- > >> > From: Patrick van der Velde > >> > Sent: May 09, 2009 11:54 PM > >> > To: ironruby-core at rubyforge.org > >> > Subject: Re: [Ironruby-core] Is it possible to run rake on the latest > binary > >> release of IronRuby? > >> > > >> > > >> > Hiya > >> > > >> > Ok so I installed rake and got: > >> > > >> > C:\languages\ironruby\bin>igem install rake Successfully installed > >> > rake-0.8.5 > >> > 1 gem installed > >> > Installing ri documentation for rake-0.8.5... > >> > > >> > Invalid output formatter > >> > > >> > For help on options, try 'rdoc --help' > >> > > >> > Then I assume that not having the documentation is not a problem so I > >> > try to run irake but get: > >> > > >> > C:\languages\ironruby\bin>irake > >> > :0:in `to_proc': The method or operation is not implemented. > >> > (System::NotImplementedException) > >> > from alt_system.rb:0 > >> > from :0:in `require' > >> > from custom_require.rb:26:in `require' > >> > from win32.rb:0 > >> > from :0:in `require' > >> > from custom_require.rb:26:in `require' > >> > from rake.rb:0 > >> > from :0:in `require' > >> > from custom_require.rb:26:in `require' > >> > from rake:0 > >> > from :0:in `load' > >> > from irake:0 > >> > > >> > Any ideas on this one? Am I missing more gems? > >> > > >> > Oh and yes I'm on a Windows machine :) > >> > > >> > Thanks > >> > > >> > Patrick > >> > > >> > > >> > On Sun, May 10, 2009 at 18:34, Ivan Porto Carrero < > ivan at flanders.co.nz> > >> wrote: > >> >> Hi Patrick > >> >> You will need the rake gem to be installed in IronRuby for the irake > >> >> command to work. > >> >> You can do that with the igem command igem install rake I assume > >> >> you're using windows because the igem command is broken again on > >> >> mono. > >> >> --- > >> >> Met vriendelijke groeten - Best regards - Salutations Ivan Porto > >> >> Carrero > >> >> Blog: http://flanders.co.nz > >> >> Twitter: http://twitter.com/casualjim Author of IronRuby in Action > >> >> (http://manning.com/carrero) > >> >> > >> >> Charles Kuralt - "You can find your way across this country using > >> >> burger joints the way a navigator uses stars." > >> >> > >> >> On Sun, May 10, 2009 at 2:11 AM, Patrick van der Velde > >> >> wrote: > >> >>> > >> >>> Hiya > >> >>> > >> >>> Mmm ok I'm a little confused here. So irake does work but possibly > >> >>> not on the latest binary release? Also does irake need rake under > >> >>> the covers or should it just be able to run rake files without any > >> >>> link to Ruby. I haven't got Ruby installed on my machine (but I do > >> >>> have ironruby). Also do I need to set any paths etc? > >> >>> Sorry about all the stupid questions but I'm very new to ironruby > >> >>> (and ruby actually) so I'm not sure where to search for the solution > >> >>> to my problem. > >> >>> > >> >>> Thanks > >> >>> > >> >>> Patrick > >> >>> > >> >>> On Sat, May 9, 2009 at 13:35, Jimmy Schementi > >> >>> wrote: > >> >>> > It definitely works for me, as I can do things like irake > >> >>> > db:migrate, but this is out of my fork's railsconf branch; I'll be > >> >>> > making sure the main repo has all the necessary fixed to run rake > >> >>> > and rails without any major workarounds. > >> >>> > > >> >>> > ~Jimmy > >> >>> > Sent from my phone > >> >>> > > >> >>> > On May 8, 2009, at 4:00 PM, "Patrick van der Velde" > >> >>> > >> >>> > > wrote: > >> >>> > > >> >>> >> Hi All > >> >>> >> > >> >>> >> I was wondering if it was possible to run rake (or irake) on the > >> >>> >> latest binary release of IronRuby. I've searched the mailing list > >> >>> >> but all posts relating to rake are several months old and are not > >> >>> >> related to the binary releases :( I've tried to run irake but I'm > >> >>> >> getting NotImplementedExceptions when I run it. If anybody has > >> >>> >> suggestions that would be greatly appreciated. > >> >>> >> > >> >>> >> Thanks > >> >>> >> > >> >>> >> Patrick > >> >>> >> _______________________________________________ > >> >>> >> Ironruby-core mailing list > >> >>> >> Ironruby-core at rubyforge.org > >> >>> >> http://rubyforge.org/mailman/listinfo/ironruby-core > >> >>> >> > >> >>> > _______________________________________________ > >> >>> > Ironruby-core mailing list > >> >>> > Ironruby-core at rubyforge.org > >> >>> > http://rubyforge.org/mailman/listinfo/ironruby-core > >> >>> > > >> >>> _______________________________________________ > >> >>> Ironruby-core mailing list > >> >>> Ironruby-core at rubyforge.org > >> >>> http://rubyforge.org/mailman/listinfo/ironruby-core > >> >> > >> >> > >> >> _______________________________________________ > >> >> Ironruby-core mailing list > >> >> Ironruby-core at rubyforge.org > >> >> http://rubyforge.org/mailman/listinfo/ironruby-core > >> >> > >> >> > >> > _______________________________________________ > >> > Ironruby-core mailing list > >> > Ironruby-core at rubyforge.org > >> > http://rubyforge.org/mailman/listinfo/ironruby-core > >> > > >> > _______________________________________________ > >> > Ironruby-core mailing list > >> > Ironruby-core at rubyforge.org > >> > http://rubyforge.org/mailman/listinfo/ironruby-core > >> > > >> _______________________________________________ > >> Ironruby-core mailing list > >> Ironruby-core at rubyforge.org > >> http://rubyforge.org/mailman/listinfo/ironruby-core > > > > _______________________________________________ > > Ironruby-core mailing list > > Ironruby-core at rubyforge.org > > http://rubyforge.org/mailman/listinfo/ironruby-core > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > -------------- next part -------------- An HTML attachment was scrubbed... URL: From petrikvandervelde at gmail.com Sun May 10 19:35:05 2009 From: petrikvandervelde at gmail.com (Patrick van der Velde) Date: Mon, 11 May 2009 11:35:05 +1200 Subject: [Ironruby-core] Is it possible to run rake on the latest binary release of IronRuby? In-Reply-To: References: <35c5ad0c0905101413gd47b8b5h9ffe8c47b8f85f49@mail.gmail.com> <35c5ad0c0905101503j46cfdc14j3b5b84340eed05ad@mail.gmail.com> Message-ID: <35c5ad0c0905101635o74c0804enb6481bf618f4c6f0@mail.gmail.com> Hi Ivan Obviously that worked :) Thanks heaps! Patrick On Mon, May 11, 2009 at 10:16, Ivan Porto Carrero wrote: > if you extract the 0.3 release and copy the compiled binaries without the > config file over it should be fine. > Alternatively you can change the content of ir.exe.config to match your > config. > IronRuby needs to know the paths in which it can find stuff like rubygems.rb > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > GSM: +32.486.787.582 > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > Bernard Baruch ?- "Vote for the man who promises least; he'll be the least > disappointing." > > On Mon, May 11, 2009 at 12:03 AM, Patrick van der Velde > wrote: >> >> Hi Jim >> >> Thanks for that. I grabbed the sources from GitHub. For now I just >> grabbed a zip file as I just want to play around with IronRuby. >> >> I followed the instructions on the website and managed to build the >> solution (using VS2008) just fine. No errors / warnings etc. I then >> copied all the binaries into another folder. I also copied the cmd >> files from the 0.3 release into that folder. I then tried to run irake >> but got another error: >> >> C:\languages\ironruby\bin>irake >> :0:in `require': no such file to load -- rubygems (LoadError) >> ? ? ? ?from C:/languages/ironruby/bin/irake:9 >> >> And when I try to run igem to install rake I get: >> >> C:\languages\ironruby\bin>igem install rake >> :0:in `require': no such file to load -- rubygems (LoadError) >> ? ? ? ?from C:/languages/ironruby/bin/igem:8 >> >> So any idea where I went wrong? I think I did all the steps in the >> right order but given that it's not working I guess I didn't entirely >> get it right :( >> >> Thanks heaps for all your help >> >> Patrick >> >> >> On Mon, May 11, 2009 at 09:20, Jim Deville wrote: >> > Pushed it a little while ago. ?To build, follow the instructions here: >> > http://wiki.github.com/ironruby/ironruby/getting-the-sources to get sources, >> > then here: http://wiki.github.com/ironruby/ironruby/building to build. If >> > you want to contribute back to the project, you can follow the instructions >> > here: http://wiki.github.com/ironruby/ironruby/contributing >> > >> > Hope that helps, feel free to ask if you need help. >> > >> > JD >> > >> > ...there is no try >> > >> > >> >> -----Original Message----- >> >> From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- >> >> bounces at rubyforge.org] On Behalf Of Patrick van der Velde >> >> Sent: Sunday, May 10, 2009 2:13 PM >> >> To: ironruby-core at rubyforge.org >> >> Subject: Re: [Ironruby-core] Is it possible to run rake on the latest >> >> binary >> >> release of IronRuby? >> >> >> >> Hi Jim >> >> >> >> Cool! I'll be waiting for that one then :) Any idea when you'll push it >> >> into the >> >> trunk? Also do you know if there is a guide for building IronRuby from >> >> scratch >> >> so that I can build it and get the fix? >> >> >> >> Thanks >> >> >> >> Patrick >> >> >> >> On Sun, May 10, 2009 at 20:10, Jim Deville >> >> wrote: >> >> > The next time I push, that should be fixed. Tomas just implemented >> >> Method#to_proc last week. >> >> > >> >> > JD >> >> > >> >> > ....there is no try >> >> > Sent from my phone. Please excuse typos and txtspk. >> >> > >> >> > -----Original Message----- >> >> > From: Patrick van der Velde >> >> > Sent: May 09, 2009 11:54 PM >> >> > To: ironruby-core at rubyforge.org >> >> > Subject: Re: [Ironruby-core] Is it possible to run rake on the latest >> >> > binary >> >> release of IronRuby? >> >> > >> >> > >> >> > Hiya >> >> > >> >> > Ok so I installed rake and got: >> >> > >> >> > C:\languages\ironruby\bin>igem install rake Successfully installed >> >> > rake-0.8.5 >> >> > 1 gem installed >> >> > Installing ri documentation for rake-0.8.5... >> >> > >> >> > Invalid output formatter >> >> > >> >> > For help on options, try 'rdoc --help' >> >> > >> >> > Then I assume that not having the documentation is not a problem so I >> >> > try to run irake but get: >> >> > >> >> > C:\languages\ironruby\bin>irake >> >> > :0:in `to_proc': The method or operation is not implemented. >> >> > (System::NotImplementedException) >> >> > ? ? ? ?from alt_system.rb:0 >> >> > ? ? ? ?from :0:in `require' >> >> > ? ? ? ?from custom_require.rb:26:in `require' >> >> > ? ? ? ?from win32.rb:0 >> >> > ? ? ? ?from :0:in `require' >> >> > ? ? ? ?from custom_require.rb:26:in `require' >> >> > ? ? ? ?from rake.rb:0 >> >> > ? ? ? ?from :0:in `require' >> >> > ? ? ? ?from custom_require.rb:26:in `require' >> >> > ? ? ? ?from rake:0 >> >> > ? ? ? ?from :0:in `load' >> >> > ? ? ? ?from irake:0 >> >> > >> >> > Any ideas on this one? Am I missing more gems? >> >> > >> >> > Oh and yes I'm on a Windows machine :) >> >> > >> >> > Thanks >> >> > >> >> > Patrick >> >> > >> >> > >> >> > On Sun, May 10, 2009 at 18:34, Ivan Porto Carrero >> >> > >> >> wrote: >> >> >> Hi Patrick >> >> >> You will need the rake gem to be installed in IronRuby for the irake >> >> >> command to work. >> >> >> You can do that with the igem command igem install rake I assume >> >> >> you're using windows because the igem command is broken again on >> >> >> mono. >> >> >> --- >> >> >> Met vriendelijke groeten - Best regards - Salutations Ivan Porto >> >> >> Carrero >> >> >> Blog: http://flanders.co.nz >> >> >> Twitter: http://twitter.com/casualjim Author of IronRuby in Action >> >> >> (http://manning.com/carrero) >> >> >> >> >> >> Charles Kuralt ?- "You can find your way across this country using >> >> >> burger joints the way a navigator uses stars." >> >> >> >> >> >> On Sun, May 10, 2009 at 2:11 AM, Patrick van der Velde >> >> >> wrote: >> >> >>> >> >> >>> Hiya >> >> >>> >> >> >>> Mmm ok I'm a little confused here. So irake does work but possibly >> >> >>> not on the latest binary release? Also does irake need rake under >> >> >>> the covers or should it just be able to run rake files without any >> >> >>> link to Ruby. I haven't got Ruby installed on my machine (but I do >> >> >>> have ironruby). Also do I need to set any paths etc? >> >> >>> Sorry about all the stupid questions but I'm very new to ironruby >> >> >>> (and ruby actually) so I'm not sure where to search for the >> >> >>> solution >> >> >>> to my problem. >> >> >>> >> >> >>> Thanks >> >> >>> >> >> >>> Patrick >> >> >>> >> >> >>> On Sat, May 9, 2009 at 13:35, Jimmy Schementi >> >> >>> wrote: >> >> >>> > It definitely works for me, as I can do things like irake >> >> >>> > db:migrate, but this is out of my fork's railsconf branch; I'll >> >> >>> > be >> >> >>> > making sure the main repo has all the necessary fixed to run rake >> >> >>> > and rails without any major workarounds. >> >> >>> > >> >> >>> > ~Jimmy >> >> >>> > Sent from my phone >> >> >>> > >> >> >>> > On May 8, 2009, at 4:00 PM, "Patrick van der Velde" >> >> >>> > > >> >>> > ?> wrote: >> >> >>> > >> >> >>> >> Hi All >> >> >>> >> >> >> >>> >> I was wondering if it was possible to run rake (or irake) on the >> >> >>> >> latest binary release of IronRuby. I've searched the mailing >> >> >>> >> list >> >> >>> >> but all posts relating to rake are several months old and are >> >> >>> >> not >> >> >>> >> related to the binary releases :( I've tried to run irake but >> >> >>> >> I'm >> >> >>> >> getting NotImplementedExceptions when I run it. If anybody has >> >> >>> >> suggestions that would be greatly appreciated. >> >> >>> >> >> >> >>> >> Thanks >> >> >>> >> >> >> >>> >> Patrick >> >> >>> >> _______________________________________________ >> >> >>> >> Ironruby-core mailing list >> >> >>> >> Ironruby-core at rubyforge.org >> >> >>> >> http://rubyforge.org/mailman/listinfo/ironruby-core >> >> >>> >> >> >> >>> > _______________________________________________ >> >> >>> > Ironruby-core mailing list >> >> >>> > Ironruby-core at rubyforge.org >> >> >>> > http://rubyforge.org/mailman/listinfo/ironruby-core >> >> >>> > >> >> >>> _______________________________________________ >> >> >>> Ironruby-core mailing list >> >> >>> Ironruby-core at rubyforge.org >> >> >>> http://rubyforge.org/mailman/listinfo/ironruby-core >> >> >> >> >> >> >> >> >> _______________________________________________ >> >> >> Ironruby-core mailing list >> >> >> Ironruby-core at rubyforge.org >> >> >> http://rubyforge.org/mailman/listinfo/ironruby-core >> >> >> >> >> >> >> >> > _______________________________________________ >> >> > Ironruby-core mailing list >> >> > Ironruby-core at rubyforge.org >> >> > http://rubyforge.org/mailman/listinfo/ironruby-core >> >> > >> >> > _______________________________________________ >> >> > Ironruby-core mailing list >> >> > Ironruby-core at rubyforge.org >> >> > http://rubyforge.org/mailman/listinfo/ironruby-core >> >> > >> >> _______________________________________________ >> >> Ironruby-core mailing list >> >> Ironruby-core at rubyforge.org >> >> http://rubyforge.org/mailman/listinfo/ironruby-core >> > >> > _______________________________________________ >> > Ironruby-core mailing list >> > Ironruby-core at rubyforge.org >> > http://rubyforge.org/mailman/listinfo/ironruby-core >> > >> _______________________________________________ >> Ironruby-core mailing list >> Ironruby-core at rubyforge.org >> http://rubyforge.org/mailman/listinfo/ironruby-core > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > From xerxes at bigpond.net.au Mon May 11 01:45:04 2009 From: xerxes at bigpond.net.au (Xerxes Battiwalla) Date: Mon, 11 May 2009 15:45:04 +1000 Subject: [Ironruby-core] Interface methods of internal class not defined in IR Message-ID: Hi there, We are using a .NET library which comprises of several classes marked internal where each class exposes functionality through an interface. When attempting to call on these objects in IR, we get an "undefined method" exception. Is there a way to access the interface members of the class when it's internal? I've created the following example to reproduce: ******* In C#: using System; namespace HelloWorldApp { public class HelloFactory { public IHelloWorld NewWorld() { return new HelloWorld(); } } public interface IHelloWorld { void SayHello(); } internal class HelloWorld: IHelloWorld // NOTE THE INTERNAL MODIFIER { public void SayHello() { throw new NotImplementedException(); } } } ******* In Ruby: require "HelloWorldApp.dll" class HelloWorldApp::HelloWorld def say_hello puts "Hello!!" end end @hello_factory = HelloWorldApp::HelloFactory.new @hello_app = @hello_factory.new_world puts "hello_app should be HelloWorldApp::IHelloWorld but was #{@hello_app.class}" @hello_app.say_hello ********* In this example, I expect the system to puts "Hello!!", but instead it throws the "undefined method" exception. If I run IR with the PrivateBindings option it works, but it seems like a workaround I shouldn't have to do, because i'm passing the instance from C# to IR as the interfaced type (my conclusion therefore being it should be able to access it) Any help appreciated. Thanks, Xerx. From Jimmy.Schementi at microsoft.com Mon May 11 02:05:18 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Mon, 11 May 2009 06:05:18 +0000 Subject: [Ironruby-core] Is it possible to run rake on the latest binary release of IronRuby? In-Reply-To: <35c5ad0c0905101413gd47b8b5h9ffe8c47b8f85f49@mail.gmail.com> References: <35c5ad0c0905101413gd47b8b5h9ffe8c47b8f85f49@mail.gmail.com> Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC06EEE7B4@tk5ex14mbxc106.redmond.corp.microsoft.com> An implementation of Method#to_proc already exists in Merlin/Main/Languages/Ruby/Libs/hacks.rb, so if Libs is on your path you can just "require 'hacks'" to make rake work. > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > bounces at rubyforge.org] On Behalf Of Patrick van der Velde > Sent: Sunday, May 10, 2009 2:13 PM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Is it possible to run rake on the latest > binary release of IronRuby? > > Hi Jim > > Cool! I'll be waiting for that one then :) Any idea when you'll push > it into the trunk? Also do you know if there is a guide for building > IronRuby from scratch so that I can build it and get the fix? > > Thanks > > Patrick > > On Sun, May 10, 2009 at 20:10, Jim Deville > wrote: > > The next time I push, that should be fixed. Tomas just implemented > Method#to_proc last week. > > > > JD > > > > ....there is no try > > Sent from my phone. Please excuse typos and txtspk. > > > > -----Original Message----- > > From: Patrick van der Velde > > Sent: May 09, 2009 11:54 PM > > To: ironruby-core at rubyforge.org > > Subject: Re: [Ironruby-core] Is it possible to run rake on the latest > binary release of IronRuby? > > > > > > Hiya > > > > Ok so I installed rake and got: > > > > C:\languages\ironruby\bin>igem install rake > > Successfully installed rake-0.8.5 > > 1 gem installed > > Installing ri documentation for rake-0.8.5... > > > > Invalid output formatter > > > > For help on options, try 'rdoc --help' > > > > Then I assume that not having the documentation is not a problem so I > > try to run irake but get: > > > > C:\languages\ironruby\bin>irake > > :0:in `to_proc': The method or operation is not implemented. > > (System::NotImplementedException) > > from alt_system.rb:0 > > from :0:in `require' > > from custom_require.rb:26:in `require' > > from win32.rb:0 > > from :0:in `require' > > from custom_require.rb:26:in `require' > > from rake.rb:0 > > from :0:in `require' > > from custom_require.rb:26:in `require' > > from rake:0 > > from :0:in `load' > > from irake:0 > > > > Any ideas on this one? Am I missing more gems? > > > > Oh and yes I'm on a Windows machine :) > > > > Thanks > > > > Patrick > > > > > > On Sun, May 10, 2009 at 18:34, Ivan Porto Carrero > wrote: > >> Hi Patrick > >> You will need the rake gem to be installed in IronRuby for the irake > command > >> to work. > >> You can do that with the igem command > >> igem install rake > >> I assume you're using windows because the igem command is broken > again on > >> mono. > >> --- > >> Met vriendelijke groeten - Best regards - Salutations > >> Ivan Porto Carrero > >> Blog: http://flanders.co.nz > >> Twitter: http://twitter.com/casualjim > >> Author of IronRuby in Action (http://manning.com/carrero) > >> > >> Charles Kuralt - "You can find your way across this country using > burger > >> joints the way a navigator uses stars." > >> > >> On Sun, May 10, 2009 at 2:11 AM, Patrick van der Velde > >> wrote: > >>> > >>> Hiya > >>> > >>> Mmm ok I'm a little confused here. So irake does work but possibly > not > >>> on the latest binary release? Also does irake need rake under the > >>> covers or should it just be able to run rake files without any link > to > >>> Ruby. I haven't got Ruby installed on my machine (but I do have > >>> ironruby). Also do I need to set any paths etc? > >>> Sorry about all the stupid questions but I'm very new to ironruby > (and > >>> ruby actually) so I'm not sure where to search for the solution to > my > >>> problem. > >>> > >>> Thanks > >>> > >>> Patrick > >>> > >>> On Sat, May 9, 2009 at 13:35, Jimmy Schementi > >>> wrote: > >>> > It definitely works for me, as I can do things like irake > db:migrate, > >>> > but this is out of my fork's railsconf branch; I'll be making > sure the > >>> > main repo has all the necessary fixed to run rake and rails > without > >>> > any major workarounds. > >>> > > >>> > ~Jimmy > >>> > Sent from my phone > >>> > > >>> > On May 8, 2009, at 4:00 PM, "Patrick van der Velde" > >>> > >>> > > wrote: > >>> > > >>> >> Hi All > >>> >> > >>> >> I was wondering if it was possible to run rake (or irake) on the > >>> >> latest binary release of IronRuby. I've searched the mailing > list but > >>> >> all posts relating to rake are several months old and are not > related > >>> >> to the binary releases :( I've tried to run irake but I'm > getting > >>> >> NotImplementedExceptions when I run it. If anybody has > suggestions > >>> >> that would be greatly appreciated. > >>> >> > >>> >> Thanks > >>> >> > >>> >> Patrick > >>> >> _______________________________________________ > >>> >> Ironruby-core mailing list > >>> >> Ironruby-core at rubyforge.org > >>> >> http://rubyforge.org/mailman/listinfo/ironruby-core > >>> >> > >>> > _______________________________________________ > >>> > Ironruby-core mailing list > >>> > Ironruby-core at rubyforge.org > >>> > http://rubyforge.org/mailman/listinfo/ironruby-core > >>> > > >>> _______________________________________________ > >>> Ironruby-core mailing list > >>> Ironruby-core at rubyforge.org > >>> http://rubyforge.org/mailman/listinfo/ironruby-core > >> > >> > >> _______________________________________________ > >> Ironruby-core mailing list > >> Ironruby-core at rubyforge.org > >> http://rubyforge.org/mailman/listinfo/ironruby-core > >> > >> > > _______________________________________________ > > Ironruby-core mailing list > > Ironruby-core at rubyforge.org > > http://rubyforge.org/mailman/listinfo/ironruby-core > > > > _______________________________________________ > > Ironruby-core mailing list > > Ironruby-core at rubyforge.org > > http://rubyforge.org/mailman/listinfo/ironruby-core > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core From Tomas.Matousek at microsoft.com Mon May 11 02:48:06 2009 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Sun, 10 May 2009 23:48:06 -0700 Subject: [Ironruby-core] Interface methods of internal class not defined in IR In-Reply-To: References: Message-ID: You are right - it should work. We know about this issue. I'll look at fixing it soon, maybe this week. Thanks, Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Xerxes Battiwalla Sent: Sunday, May 10, 2009 10:45 PM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] Interface methods of internal class not defined in IR Hi there, We are using a .NET library which comprises of several classes marked internal where each class exposes functionality through an interface. When attempting to call on these objects in IR, we get an "undefined method" exception. Is there a way to access the interface members of the class when it's internal? I've created the following example to reproduce: ******* In C#: using System; namespace HelloWorldApp { public class HelloFactory { public IHelloWorld NewWorld() { return new HelloWorld(); } } public interface IHelloWorld { void SayHello(); } internal class HelloWorld: IHelloWorld // NOTE THE INTERNAL MODIFIER { public void SayHello() { throw new NotImplementedException(); } } } ******* In Ruby: require "HelloWorldApp.dll" class HelloWorldApp::HelloWorld def say_hello puts "Hello!!" end end @hello_factory = HelloWorldApp::HelloFactory.new @hello_app = @hello_factory.new_world puts "hello_app should be HelloWorldApp::IHelloWorld but was #{@hello_app.class}" @hello_app.say_hello ********* In this example, I expect the system to puts "Hello!!", but instead it throws the "undefined method" exception. If I run IR with the PrivateBindings option it works, but it seems like a workaround I shouldn't have to do, because i'm passing the instance from C# to IR as the interfaced type (my conclusion therefore being it should be able to access it) Any help appreciated. Thanks, Xerx. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From lists at ruby-forum.com Mon May 11 04:42:51 2009 From: lists at ruby-forum.com (Sami Alitalo) Date: Mon, 11 May 2009 10:42:51 +0200 Subject: [Ironruby-core] Problems with win32ole.so In-Reply-To: References: <6d6122f5c1b31953d540d47b2b48c0db@ruby-forum.com> <0303bc5848e76ff378251edc809881ea@ruby-forum.com> Message-ID: <077e5ed6eac6559698945cc82f475c73@ruby-forum.com> Mainly there is application handling through command prompt (ShellExecute). I should first study more those interop features and of course Ruby too cause both are quite new things for me. Sami -- Posted via http://www.ruby-forum.com/. From ivan at flanders.co.nz Tue May 12 03:23:16 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Tue, 12 May 2009 09:23:16 +0200 Subject: [Ironruby-core] interop question Message-ID: Let's say I have these interfaces public interface IWeapon{ void Attack(IWarrior warrior); int Damage(); } public interface IWarrior { int Id { get; } string Name { get; set; } bool IsKilledBy(IWeapon weapon); void Attack(IWarrior target, IWeapon weapon); } And one implementor defined in C# public class Ninja : IWarrior{ private readonly int _id; public string Name { get; set; } public int Id { get { return _id; } } public void Attack(IWarrior target, IWeapon weapon){ weapon.Attack(target); } public bool IsKilledBy(IWeapon weapon) { return weapon.Damage() > 3; } } Now if I create an implementation of IWeapon in Ruby class Shuriken include IWeapon def damage 2 end end which I then proceed to wrap in a forwarding class class ShurikenProxy instance_methods.each do |name| undef_method name unless name =~ /^__|^instance_eval$/ end def initialize @subject = Shuriken.new end def method_missing(m, *a, &b) @subject.send(m, *a, &b) end end Then I would expect this to work: ninja = Ninja.new ninja.is_killed_by ShurikenProxy.new only it tells me that the ruby object isn't an implementation of IWeapon while by all ruby standards it is. if you ask it for its ancestors it's got IWeapon there if you ask it for its class it tells you Shuriken and not ShurikenProxy Is that supposed to happen? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Emma Goldman - "If voting changed anything, they'd make it illegal." -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Tue May 12 07:59:56 2009 From: lists at ruby-forum.com (Shay Friedman) Date: Tue, 12 May 2009 13:59:56 +0200 Subject: [Ironruby-core] Thread priority Message-ID: <5602f055f15a6d2c748744793e6b0681@ruby-forum.com> Hi there, Ruby allows to set the thread priority using the priority= method: Thread.new do Thread.current.priority = -1 ... blah blah blah ... end This is not available in IronRuby because priority maps to the System.Threading.Thread priority property which looks for the ThreadPriority enum. Is it going to change or is this the right behavior for IronRuby? Thanks, Shay. -- Posted via http://www.ruby-forum.com/. From ivan at flanders.co.nz Tue May 12 08:40:37 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Tue, 12 May 2009 14:40:37 +0200 Subject: [Ironruby-core] Thread priority In-Reply-To: <5602f055f15a6d2c748744793e6b0681@ruby-forum.com> References: <5602f055f15a6d2c748744793e6b0681@ruby-forum.com> Message-ID: You can just use the enum from ironruby System::Threading::ThreadPriority.normal --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Emma Goldman - "If voting changed anything, they'd make it illegal." On Tue, May 12, 2009 at 1:59 PM, Shay Friedman wrote: > Hi there, > > Ruby allows to set the thread priority using the priority= method: > Thread.new do > Thread.current.priority = -1 > ... blah blah blah ... > end > > This is not available in IronRuby because priority maps to the > System.Threading.Thread priority property which looks for the > ThreadPriority enum. Is it going to change or is this the right behavior > for IronRuby? > > Thanks, > Shay. > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > -------------- next part -------------- An HTML attachment was scrubbed... URL: From curth at microsoft.com Tue May 12 10:49:50 2009 From: curth at microsoft.com (Curt Hagenlocher) Date: Tue, 12 May 2009 07:49:50 -0700 Subject: [Ironruby-core] interop question In-Reply-To: References: Message-ID: We can?t apply all Ruby standards when we travel back to staticland. When you define and use a Ruby class, we need to create a static CLR type to represent that class. This underlying type is constrained by what can be done with CLR types; and in particular, it?s structure is immutable. So we can?t just go back to this type and tell it that it should now implement IWeapon ? we need to have known this at the time the class is created. Now, it?s possible to be pretty flexible about the ingredients that go into the type. So if the IronRuby community decides to change how this underlying type is created ? perhaps by taking additional metadata into account ? then that?s no problem. But as soon as you create the first instance of ShurikenProxy, that?s when we need to freeze things and actually emit the type. In this particular case, when creating a proxy for an object that implements certain CLR interfaces, the proxy itself will have to implement the same interfaces if the object is going to be passed back to static code. But Ruby?s metaprogramming makes this pretty easy ? get all ancestors of class Module whose to_clr_type is not nil, and simply include those into a newly-created proxy class programmatically. From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Tuesday, May 12, 2009 12:23 AM To: ironruby-core Subject: [Ironruby-core] interop question Let's say I have these interfaces public interface IWeapon{ void Attack(IWarrior warrior); int Damage(); } public interface IWarrior { int Id { get; } string Name { get; set; } bool IsKilledBy(IWeapon weapon); void Attack(IWarrior target, IWeapon weapon); } And one implementor defined in C# public class Ninja : IWarrior{ private readonly int _id; public string Name { get; set; } public int Id { get { return _id; } } public void Attack(IWarrior target, IWeapon weapon){ weapon.Attack(target); } public bool IsKilledBy(IWeapon weapon) { return weapon.Damage() > 3; } } Now if I create an implementation of IWeapon in Ruby class Shuriken include IWeapon def damage 2 end end which I then proceed to wrap in a forwarding class class ShurikenProxy instance_methods.each do |name| undef_method name unless name =~ /^__|^instance_eval$/ end def initialize @subject = Shuriken.new end def method_missing(m, *a, &b) @subject.send(m, *a, &b) end end Then I would expect this to work: ninja = Ninja.new ninja.is_killed_by ShurikenProxy.new only it tells me that the ruby object isn't an implementation of IWeapon while by all ruby standards it is. if you ask it for its ancestors it's got IWeapon there if you ask it for its class it tells you Shuriken and not ShurikenProxy Is that supposed to happen? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Emma Goldman - "If voting changed anything, they'd make it illegal." -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan at flanders.co.nz Tue May 12 11:38:26 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Tue, 12 May 2009 17:38:26 +0200 Subject: [Ironruby-core] interop question In-Reply-To: References: Message-ID: Cool that's what I figured was going on.I will have to invert the way I'm creating proxies now but that's no problem. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Charles Kuralt - "You can find your way across this country using burger joints the way a navigator uses stars." On Tue, May 12, 2009 at 4:49 PM, Curt Hagenlocher wrote: > We can?t apply all Ruby standards when we travel back to staticland. > > > > When you define and use a Ruby class, we need to create a static CLR type > to represent that class. This underlying type is constrained by what can be > done with CLR types; and in particular, it?s structure is immutable. So we > can?t just go back to this type and tell it that it should now implement > IWeapon ? we need to have known this at the time the class is created. > > > > Now, it?s possible to be pretty flexible about the ingredients that go into > the type. So if the IronRuby community decides to change how this underlying > type is created ? perhaps by taking additional metadata into account ? then > that?s no problem. But as soon as you create the first instance of > ShurikenProxy, that?s when we need to freeze things and actually emit the > type. > > > > In this particular case, when creating a proxy for an object that > implements certain CLR interfaces, the proxy itself will have to implement > the same interfaces if the object is going to be passed back to static code. > But Ruby?s metaprogramming makes this pretty easy ? get all ancestors of > class Module whose to_clr_type is not nil, and simply include those into a > newly-created proxy class programmatically. > > > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Ivan Porto Carrero > *Sent:* Tuesday, May 12, 2009 12:23 AM > *To:* ironruby-core > *Subject:* [Ironruby-core] interop question > > > > > > Let's say I have these interfaces > > > > public interface IWeapon{ > > void Attack(IWarrior warrior); > > int Damage(); > > } > > > > public interface IWarrior > > { > > > > int Id { get; } > > string Name { get; set; } > > bool IsKilledBy(IWeapon weapon); > > void Attack(IWarrior target, IWeapon weapon); > > } > > > > And one implementor defined in C# > > > > public class Ninja : IWarrior{ > > > > private readonly int _id; > > > > public string Name { get; set; } > > public int Id { get { return _id; } } > > > > public void Attack(IWarrior target, IWeapon weapon){ > > weapon.Attack(target); > > } > > > > public bool IsKilledBy(IWeapon weapon) > > { > > return weapon.Damage() > 3; > > } > > } > > > > Now if I create an implementation of IWeapon in Ruby > > > > class Shuriken > > > > include IWeapon > > > > def damage > > 2 > > end > > end > > > > which I then proceed to wrap in a forwarding class > > > > class ShurikenProxy > > > > instance_methods.each do |name| > > undef_method name unless name =~ /^__|^instance_eval$/ > > end > > > > def initialize > > @subject = Shuriken.new > > end > > > > def method_missing(m, *a, &b) > > @subject.send(m, *a, &b) > > end > > > > end > > > > Then I would expect this to work: > > > > ninja = Ninja.new > > ninja.is_killed_by ShurikenProxy.new > > > > only it tells me that the ruby object isn't an implementation of IWeapon > > while by all ruby standards it is. if you ask it for its ancestors it's got > IWeapon there > > if you ask it for its class it tells you Shuriken and not ShurikenProxy > > > > Is that supposed to happen? > > > > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > Emma Goldman - "If voting changed anything, they'd make it illegal." > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Tomas.Matousek at microsoft.com Tue May 12 12:56:20 2009 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Tue, 12 May 2009 09:56:20 -0700 Subject: [Ironruby-core] Thread priority In-Reply-To: References: <5602f055f15a6d2c748744793e6b0681@ruby-forum.com> Message-ID: Thread#priority attribute is not implemented yet, that?s why the CLR property is picked up. It should be easy to implement it. Any volunteer? Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Tuesday, May 12, 2009 5:41 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Thread priority You can just use the enum from ironruby System::Threading::ThreadPriority.normal --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Emma Goldman - "If voting changed anything, they'd make it illegal." On Tue, May 12, 2009 at 1:59 PM, Shay Friedman > wrote: Hi there, Ruby allows to set the thread priority using the priority= method: Thread.new do Thread.current.priority = -1 ... blah blah blah ... end This is not available in IronRuby because priority maps to the System.Threading.Thread priority property which looks for the ThreadPriority enum. Is it going to change or is this the right behavior for IronRuby? Thanks, Shay. -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan at flanders.co.nz Tue May 12 15:58:21 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Tue, 12 May 2009 21:58:21 +0200 Subject: [Ironruby-core] interop question In-Reply-To: References: Message-ID: About the metadata.. I think in my case it would be great if I could redirect the methods on the type to methods on a property of that type. So for the ShurikenProxy class I would like to say that it needs to forward all method calls to the property subject for example possibly with an exception list of methods that won't be forwarded. I guess that would get me the behavior I'm expecting. Would that be possible? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Tue, May 12, 2009 at 4:49 PM, Curt Hagenlocher wrote: > We can?t apply all Ruby standards when we travel back to staticland. > > > > When you define and use a Ruby class, we need to create a static CLR type > to represent that class. This underlying type is constrained by what can be > done with CLR types; and in particular, it?s structure is immutable. So we > can?t just go back to this type and tell it that it should now implement > IWeapon ? we need to have known this at the time the class is created. > > > > Now, it?s possible to be pretty flexible about the ingredients that go into > the type. So if the IronRuby community decides to change how this underlying > type is created ? perhaps by taking additional metadata into account ? then > that?s no problem. But as soon as you create the first instance of > ShurikenProxy, that?s when we need to freeze things and actually emit the > type. > > > > In this particular case, when creating a proxy for an object that > implements certain CLR interfaces, the proxy itself will have to implement > the same interfaces if the object is going to be passed back to static code. > But Ruby?s metaprogramming makes this pretty easy ? get all ancestors of > class Module whose to_clr_type is not nil, and simply include those into a > newly-created proxy class programmatically. > > > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Ivan Porto Carrero > *Sent:* Tuesday, May 12, 2009 12:23 AM > *To:* ironruby-core > *Subject:* [Ironruby-core] interop question > > > > > > Let's say I have these interfaces > > > > public interface IWeapon{ > > void Attack(IWarrior warrior); > > int Damage(); > > } > > > > public interface IWarrior > > { > > > > int Id { get; } > > string Name { get; set; } > > bool IsKilledBy(IWeapon weapon); > > void Attack(IWarrior target, IWeapon weapon); > > } > > > > And one implementor defined in C# > > > > public class Ninja : IWarrior{ > > > > private readonly int _id; > > > > public string Name { get; set; } > > public int Id { get { return _id; } } > > > > public void Attack(IWarrior target, IWeapon weapon){ > > weapon.Attack(target); > > } > > > > public bool IsKilledBy(IWeapon weapon) > > { > > return weapon.Damage() > 3; > > } > > } > > > > Now if I create an implementation of IWeapon in Ruby > > > > class Shuriken > > > > include IWeapon > > > > def damage > > 2 > > end > > end > > > > which I then proceed to wrap in a forwarding class > > > > class ShurikenProxy > > > > instance_methods.each do |name| > > undef_method name unless name =~ /^__|^instance_eval$/ > > end > > > > def initialize > > @subject = Shuriken.new > > end > > > > def method_missing(m, *a, &b) > > @subject.send(m, *a, &b) > > end > > > > end > > > > Then I would expect this to work: > > > > ninja = Ninja.new > > ninja.is_killed_by ShurikenProxy.new > > > > only it tells me that the ruby object isn't an implementation of IWeapon > > while by all ruby standards it is. if you ask it for its ancestors it's got > IWeapon there > > if you ask it for its class it tells you Shuriken and not ShurikenProxy > > > > Is that supposed to happen? > > > > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > Emma Goldman - "If voting changed anything, they'd make it illegal." > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From curth at microsoft.com Tue May 12 16:35:10 2009 From: curth at microsoft.com (Curt Hagenlocher) Date: Tue, 12 May 2009 13:35:10 -0700 Subject: [Ironruby-core] interop question In-Reply-To: References: Message-ID: But this redirection can be done entirely at the level of Ruby metaprogramming, can?t it. I?m pretty sure I?ve seen Proxy objects defined in ActiveSupport that do something quite similar. (Full disclosure, though: I?m really a Ruby noob.) By contrast, consider the following class C clr_property :Value, System::Int32, ::get_value, ::set_value def get_value 42 end def set_value raise RuntimeError, 'Read-only, sucker!' end end The hypothetical class method clr_property might set some kind of metadata on the class which would be picked up by the CLS type generator, and turned into a CLS-visible property on the generated type with getter and setter methods. This is the sort of thing I had in mind when I described ?additional metadata?. From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Tuesday, May 12, 2009 12:58 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] interop question About the metadata.. I think in my case it would be great if I could redirect the methods on the type to methods on a property of that type. So for the ShurikenProxy class I would like to say that it needs to forward all method calls to the property subject for example possibly with an exception list of methods that won't be forwarded. I guess that would get me the behavior I'm expecting. Would that be possible? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Tue, May 12, 2009 at 4:49 PM, Curt Hagenlocher > wrote: We can?t apply all Ruby standards when we travel back to staticland. When you define and use a Ruby class, we need to create a static CLR type to represent that class. This underlying type is constrained by what can be done with CLR types; and in particular, it?s structure is immutable. So we can?t just go back to this type and tell it that it should now implement IWeapon ? we need to have known this at the time the class is created. Now, it?s possible to be pretty flexible about the ingredients that go into the type. So if the IronRuby community decides to change how this underlying type is created ? perhaps by taking additional metadata into account ? then that?s no problem. But as soon as you create the first instance of ShurikenProxy, that?s when we need to freeze things and actually emit the type. In this particular case, when creating a proxy for an object that implements certain CLR interfaces, the proxy itself will have to implement the same interfaces if the object is going to be passed back to static code. But Ruby?s metaprogramming makes this pretty easy ? get all ancestors of class Module whose to_clr_type is not nil, and simply include those into a newly-created proxy class programmatically. From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Tuesday, May 12, 2009 12:23 AM To: ironruby-core Subject: [Ironruby-core] interop question Let's say I have these interfaces public interface IWeapon{ void Attack(IWarrior warrior); int Damage(); } public interface IWarrior { int Id { get; } string Name { get; set; } bool IsKilledBy(IWeapon weapon); void Attack(IWarrior target, IWeapon weapon); } And one implementor defined in C# public class Ninja : IWarrior{ private readonly int _id; public string Name { get; set; } public int Id { get { return _id; } } public void Attack(IWarrior target, IWeapon weapon){ weapon.Attack(target); } public bool IsKilledBy(IWeapon weapon) { return weapon.Damage() > 3; } } Now if I create an implementation of IWeapon in Ruby class Shuriken include IWeapon def damage 2 end end which I then proceed to wrap in a forwarding class class ShurikenProxy instance_methods.each do |name| undef_method name unless name =~ /^__|^instance_eval$/ end def initialize @subject = Shuriken.new end def method_missing(m, *a, &b) @subject.send(m, *a, &b) end end Then I would expect this to work: ninja = Ninja.new ninja.is_killed_by ShurikenProxy.new only it tells me that the ruby object isn't an implementation of IWeapon while by all ruby standards it is. if you ask it for its ancestors it's got IWeapon there if you ask it for its class it tells you Shuriken and not ShurikenProxy Is that supposed to happen? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Emma Goldman - "If voting changed anything, they'd make it illegal." _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan at flanders.co.nz Tue May 12 16:53:23 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Tue, 12 May 2009 22:53:23 +0200 Subject: [Ironruby-core] interop question In-Reply-To: References: Message-ID: That would be great for databinding wpf :) --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Vince Lombardi - "We didn't lose the game; we just ran out of time." On Tue, May 12, 2009 at 10:35 PM, Curt Hagenlocher wrote: > But this redirection can be done entirely at the level of Ruby > metaprogramming, can?t it. I?m pretty sure I?ve seen Proxy objects defined > in ActiveSupport that do something quite similar. (Full disclosure, though: > I?m really a Ruby noob.) > > > > By contrast, consider the following > > > > class C > > clr_property :Value, System::Int32, ::get_value, ::set_value > > > > def get_value > > 42 > > end > > def set_value > > raise RuntimeError, 'Read-only, sucker!' > > end > > end > > > > The *hypothetical* class method clr_property might set some kind of > metadata on the class which would be picked up by the CLS type generator, > and turned into a CLS-visible property on the generated type with getter and > setter methods. This is the sort of thing I had in mind when I described > ?additional metadata?. > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Ivan Porto Carrero > *Sent:* Tuesday, May 12, 2009 12:58 PM > *To:* ironruby-core at rubyforge.org > *Subject:* Re: [Ironruby-core] interop question > > > > About the metadata.. I think in my case it would be great if I could > redirect the methods on the type to methods on a property of that type. > > > > So for the ShurikenProxy class I would like to say that it needs to forward > all method calls to the property subject for example possibly with an > exception list of methods that won't be forwarded. I guess that would get me > the behavior I'm expecting. Would that be possible? > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > On Tue, May 12, 2009 at 4:49 PM, Curt Hagenlocher > wrote: > > We can?t apply all Ruby standards when we travel back to staticland. > > > > When you define and use a Ruby class, we need to create a static CLR type > to represent that class. This underlying type is constrained by what can be > done with CLR types; and in particular, it?s structure is immutable. So we > can?t just go back to this type and tell it that it should now implement > IWeapon ? we need to have known this at the time the class is created. > > > > Now, it?s possible to be pretty flexible about the ingredients that go into > the type. So if the IronRuby community decides to change how this underlying > type is created ? perhaps by taking additional metadata into account ? then > that?s no problem. But as soon as you create the first instance of > ShurikenProxy, that?s when we need to freeze things and actually emit the > type. > > > > In this particular case, when creating a proxy for an object that > implements certain CLR interfaces, the proxy itself will have to implement > the same interfaces if the object is going to be passed back to static code. > But Ruby?s metaprogramming makes this pretty easy ? get all ancestors of > class Module whose to_clr_type is not nil, and simply include those into a > newly-created proxy class programmatically. > > > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Ivan Porto Carrero > *Sent:* Tuesday, May 12, 2009 12:23 AM > *To:* ironruby-core > *Subject:* [Ironruby-core] interop question > > > > > > Let's say I have these interfaces > > > > public interface IWeapon{ > > void Attack(IWarrior warrior); > > int Damage(); > > } > > > > public interface IWarrior > > { > > > > int Id { get; } > > string Name { get; set; } > > bool IsKilledBy(IWeapon weapon); > > void Attack(IWarrior target, IWeapon weapon); > > } > > > > And one implementor defined in C# > > > > public class Ninja : IWarrior{ > > > > private readonly int _id; > > > > public string Name { get; set; } > > public int Id { get { return _id; } } > > > > public void Attack(IWarrior target, IWeapon weapon){ > > weapon.Attack(target); > > } > > > > public bool IsKilledBy(IWeapon weapon) > > { > > return weapon.Damage() > 3; > > } > > } > > > > Now if I create an implementation of IWeapon in Ruby > > > > class Shuriken > > > > include IWeapon > > > > def damage > > 2 > > end > > end > > > > which I then proceed to wrap in a forwarding class > > > > class ShurikenProxy > > > > instance_methods.each do |name| > > undef_method name unless name =~ /^__|^instance_eval$/ > > end > > > > def initialize > > @subject = Shuriken.new > > end > > > > def method_missing(m, *a, &b) > > @subject.send(m, *a, &b) > > end > > > > end > > > > Then I would expect this to work: > > > > ninja = Ninja.new > > ninja.is_killed_by ShurikenProxy.new > > > > only it tells me that the ruby object isn't an implementation of IWeapon > > while by all ruby standards it is. if you ask it for its ancestors it's got > IWeapon there > > if you ask it for its class it tells you Shuriken and not ShurikenProxy > > > > Is that supposed to happen? > > > > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > Emma Goldman - "If voting changed anything, they'd make it illegal." > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sanxiyn at gmail.com Wed May 13 02:45:34 2009 From: sanxiyn at gmail.com (Seo Sanghyeon) Date: Wed, 13 May 2009 15:45:34 +0900 Subject: [Ironruby-core] Strange type error Message-ID: <5b0248170905122345j2b4be030w75719ee98d7bb5c@mail.gmail.com> Any idea what's going on in the following? $ gem install chronic $ cat test.rb require 'rubygems' require 'chronic' puts Chronic.parse('3pm') $ mono ir.exe test.rb /var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/repeaters/repeater_time.rb:68:in `next': can't convert IronRuby::Builtins::RubyObject into Float (TypeError) from /var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/repeaters/repeater_time.rb:67:in `next' from :0:in `catch' from mscorlib:0:in `CallSite.Target' from Microsoft.Scripting.Core:0:in `invoke_object__this___CallSite_RubyScope_object_Proc_SymbolId' from /var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/repeaters/repeater_time.rb:107:in `this' from /var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/handlers.rb:348:in `find_within' from mscorlib:0:in `CallSite.Target' from Microsoft.Scripting.Core:0:in `invoke_object__this___CallSite_RubyScope_object_SymbolId' from /var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/handlers.rb:326:in `get_anchor' from /var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/handlers.rb:219:in `handle_r' from /var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/handlers.rb:16707566:in `tokens_to_span' from :0:in `__send__' from mscorlib:0:in `CallSite.Target' from /var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/handlers.rb:50:in `tokens_to_span' from :0:in `each' from mscorlib:0:in `CallSite.Target' from /var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/chronic.rb:84:in `parse' from test.rb:3 from mscorlib:0:in `CallSite.Target' -- Seo Sanghyeon From Shri.Borde at microsoft.com Wed May 13 03:02:40 2009 From: Shri.Borde at microsoft.com (Shri Borde) Date: Wed, 13 May 2009 00:02:40 -0700 Subject: [Ironruby-core] Strange type error In-Reply-To: <5b0248170905122345j2b4be030w75719ee98d7bb5c@mail.gmail.com> References: <5b0248170905122345j2b4be030w75719ee98d7bb5c@mail.gmail.com> Message-ID: <710DF26F214D2B4BB94287123FFE980A2E1C2B0AAC@NA-EXMSG-C104.redmond.corp.microsoft.com> I have seen that error message. The fix was the one-line change in Protocols.cs in http://github.com/shri/ironruby/commit/09b25e8c573464dc5868ab2521bd631a013527c7. You can apply that change by hand (its not in the main ironruby repo yet) and see if that fixes the problem. The error message is somewhat generic, and it may or may not be the same issue. -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Seo Sanghyeon Sent: Tuesday, May 12, 2009 11:46 PM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] Strange type error Any idea what's going on in the following? $ gem install chronic $ cat test.rb require 'rubygems' require 'chronic' puts Chronic.parse('3pm') $ mono ir.exe test.rb /var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/repeaters/repeater_time.rb:68:in `next': can't convert IronRuby::Builtins::RubyObject into Float (TypeError) from /var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/repeaters/repeater_time.rb:67:in `next' from :0:in `catch' from mscorlib:0:in `CallSite.Target' from Microsoft.Scripting.Core:0:in `invoke_object__this___CallSite_RubyScope_object_Proc_SymbolId' from /var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/repeaters/repeater_time.rb:107:in `this' from /var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/handlers.rb:348:in `find_within' from mscorlib:0:in `CallSite.Target' from Microsoft.Scripting.Core:0:in `invoke_object__this___CallSite_RubyScope_object_SymbolId' from /var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/handlers.rb:326:in `get_anchor' from /var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/handlers.rb:219:in `handle_r' from /var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/handlers.rb:16707566:in `tokens_to_span' from :0:in `__send__' from mscorlib:0:in `CallSite.Target' from /var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/handlers.rb:50:in `tokens_to_span' from :0:in `each' from mscorlib:0:in `CallSite.Target' from /var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/chronic.rb:84:in `parse' from test.rb:3 from mscorlib:0:in `CallSite.Target' -- Seo Sanghyeon _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From sanxiyn at gmail.com Wed May 13 03:16:07 2009 From: sanxiyn at gmail.com (Seo Sanghyeon) Date: Wed, 13 May 2009 16:16:07 +0900 Subject: [Ironruby-core] Strange type error In-Reply-To: <710DF26F214D2B4BB94287123FFE980A2E1C2B0AAC@NA-EXMSG-C104.redmond.corp.microsoft.com> References: <5b0248170905122345j2b4be030w75719ee98d7bb5c@mail.gmail.com> <710DF26F214D2B4BB94287123FFE980A2E1C2B0AAC@NA-EXMSG-C104.redmond.corp.microsoft.com> Message-ID: <5b0248170905130016g2d4f9ca9qe6cd888755aa6280@mail.gmail.com> 2009/5/13 Shri Borde : > I have seen that error message. The fix was the one-line change in Protocols.cs in http://github.com/shri/ironruby/commit/09b25e8c573464dc5868ab2521bd631a013527c7. You can apply that change by hand (its not in the main ironruby repo yet) and see if that fixes the problem. The error message is somewhat generic, and it may or may not be the same issue. It didn't fix the problem. Probably a different issue. -- Seo Sanghyeon From Jimmy.Schementi at microsoft.com Wed May 13 11:53:24 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Wed, 13 May 2009 15:53:24 +0000 Subject: [Ironruby-core] Strange type error In-Reply-To: <5b0248170905130016g2d4f9ca9qe6cd888755aa6280@mail.gmail.com> References: <5b0248170905122345j2b4be030w75719ee98d7bb5c@mail.gmail.com> <710DF26F214D2B4BB94287123FFE980A2E1C2B0AAC@NA-EXMSG-C104.redmond.corp.microsoft.com> <5b0248170905130016g2d4f9ca9qe6cd888755aa6280@mail.gmail.com> Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC06EFE4A6@tk5ex14mbxc106.redmond.corp.microsoft.com> http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=1211 IronRuby's Time implementation doesn't allow this, while MRI does. n = Time.now class RespondToF def to_f 5.0 end end n + RespondToF.new Chronic does something like this in repeaters/repeater_time.rb:76 ~js > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > bounces at rubyforge.org] On Behalf Of Seo Sanghyeon > Sent: Wednesday, May 13, 2009 12:16 AM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Strange type error > > 2009/5/13 Shri Borde : > > I have seen that error message. The fix was the one-line change in > Protocols.cs in > http://github.com/shri/ironruby/commit/09b25e8c573464dc5868ab2521bd631a > 013527c7. You can apply that change by hand (its not in the main > ironruby repo yet) and see if that fixes the problem. The error message > is somewhat generic, and it may or may not be the same issue. > > It didn't fix the problem. Probably a different issue. > > -- > Seo Sanghyeon > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core From ivan at flanders.co.nz Wed May 13 11:57:16 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Wed, 13 May 2009 17:57:16 +0200 Subject: [Ironruby-core] more interop questions Message-ID: Hi I got into a discussion with Roy Osherhove about overriding statics. I know in C# it can't be done obviously and as long as I stay in Ruby you can. I understand this may seem like straight-forward stuff. Can you give me a pointer where I can take stock of what I can and can't do to CLR objects and in which cases ruby things apply? But when you go back and call it from a C# class it takes the CLR implementation public class MyClassWithAStatic{ public string HelloWorld(){ return "Hello World!"; } public static string GoodByeWorld(){ return "Goodbye world!"; } } public class StaticCaller{ public string CallsStatic(){ return MyClassWithAStatic.GoodByeWorld(); } } console session: (master) ? ir IronRuby 0.4.0.0 on .NET 2.0.50727.4918 Copyright (c) Microsoft Corporation. All rights reserved. >>> require 'spec/bin/ClrModels.dll' => true >>> include ClrModels => Object >>> MyClassWithAStatic => ClrModels::MyClassWithAStatic >>> MyClassWithAStatic.good_bye_world => 'Goodbye world!' >>> sc = StaticCaller.new => ClrModels.StaticCaller >>> sc.calls_static => 'Goodbye world!' >>> class MyClassWithAStatic ... def self.good_bye_world ... "From Ruby we say goodbye to you" ... end ... end => nil >>> MyClassWithAStatic.good_bye_world => "From Ruby we say goodbye to you" >>> sc = StaticCaller.new => ClrModels.StaticCaller >>> sc.calls_static => 'Goodbye world!' New session to figure out if something could be done before the type was actually created + C:\dev\caricature (master) ? ir IronRuby 0.4.0.0 on .NET 2.0.50727.4918 Copyright (c) Microsoft Corporation. All rights reserved. >>> require 'spec/bin/ClrModels.dll' => true >>> class MyClassWithAStatic ... def self.good_bye_world ... "From Ruby we say goodbye to you" ... end ... end => nil >>> ClrModels::StaticCaller.new.calls_static => 'Goodbye world!' --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Don Marquis - "Procrastination is the art of keeping up with yesterday." -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan at flanders.co.nz Wed May 13 12:20:23 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Wed, 13 May 2009 18:20:23 +0200 Subject: [Ironruby-core] more interop questions In-Reply-To: References: Message-ID: I know these sound like pretty basic questions.. but I'm playing devil's advocate here (maybe rubyist advocate is better suited) and I imagine I will need a good chunk in a chapter somewhere to explain this stuff really clearly. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Wed, May 13, 2009 at 5:57 PM, Ivan Porto Carrero wrote: > Hi > I got into a discussion with Roy Osherhove about overriding statics. > > I know in C# it can't be done obviously and as long as I stay in Ruby you > can. I understand this may seem like straight-forward stuff. Can you give me > a pointer where I can take stock of what I can and can't do to CLR objects > and in which cases ruby things apply? > > But when you go back and call it from a C# class it takes the CLR > implementation > > public class MyClassWithAStatic{ > > public string HelloWorld(){ > return "Hello World!"; > } > > public static string GoodByeWorld(){ > return "Goodbye world!"; > } > } > > public class StaticCaller{ > > public string CallsStatic(){ > return MyClassWithAStatic.GoodByeWorld(); > } > } > > console session: > (master) ? ir > IronRuby 0.4.0.0 on .NET 2.0.50727.4918 > Copyright (c) Microsoft Corporation. All rights reserved. > > >>> require 'spec/bin/ClrModels.dll' > => true > >>> include ClrModels > => Object > >>> MyClassWithAStatic > => ClrModels::MyClassWithAStatic > >>> MyClassWithAStatic.good_bye_world > => 'Goodbye world!' > >>> sc = StaticCaller.new > => ClrModels.StaticCaller > >>> sc.calls_static > => 'Goodbye world!' > >>> class MyClassWithAStatic > ... def self.good_bye_world > ... "From Ruby we say goodbye to you" > ... end > ... end > => nil > >>> MyClassWithAStatic.good_bye_world > => "From Ruby we say goodbye to you" > >>> sc = StaticCaller.new > => ClrModels.StaticCaller > >>> sc.calls_static > => 'Goodbye world!' > > New session to figure out if something could be done before the type was > actually created > > + C:\dev\caricature > (master) ? ir > IronRuby 0.4.0.0 on .NET 2.0.50727.4918 > Copyright (c) Microsoft Corporation. All rights reserved. > > >>> require 'spec/bin/ClrModels.dll' > => true > >>> class MyClassWithAStatic > ... def self.good_bye_world > ... "From Ruby we say goodbye to you" > ... end > ... end > => nil > >>> ClrModels::StaticCaller.new.calls_static > => 'Goodbye world!' > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > Don Marquis - "Procrastination is the art of keeping up with yesterday." > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Tomas.Matousek at microsoft.com Wed May 13 12:37:17 2009 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Wed, 13 May 2009 09:37:17 -0700 Subject: [Ironruby-core] more interop questions In-Reply-To: References: Message-ID: It?s pretty simple: your can define a Ruby method on any class/interface. The method will only be visible from Ruby unless the class is a Ruby dynamic object (implements IDynamicObjectProvider using Ruby binders). For such dynamic objects Ruby methods will be available when invoked from dynamic expression in C# 4.0. The methods are also invokable via ObjectOperations class in Hosting API. Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Wednesday, May 13, 2009 9:20 AM To: ironruby-core Subject: Re: [Ironruby-core] more interop questions I know these sound like pretty basic questions.. but I'm playing devil's advocate here (maybe rubyist advocate is better suited) and I imagine I will need a good chunk in a chapter somewhere to explain this stuff really clearly. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Wed, May 13, 2009 at 5:57 PM, Ivan Porto Carrero > wrote: Hi I got into a discussion with Roy Osherhove about overriding statics. I know in C# it can't be done obviously and as long as I stay in Ruby you can. I understand this may seem like straight-forward stuff. Can you give me a pointer where I can take stock of what I can and can't do to CLR objects and in which cases ruby things apply? But when you go back and call it from a C# class it takes the CLR implementation public class MyClassWithAStatic{ public string HelloWorld(){ return "Hello World!"; } public static string GoodByeWorld(){ return "Goodbye world!"; } } public class StaticCaller{ public string CallsStatic(){ return MyClassWithAStatic.GoodByeWorld(); } } console session: (master) ? ir IronRuby 0.4.0.0 on .NET 2.0.50727.4918 Copyright (c) Microsoft Corporation. All rights reserved. >>> require 'spec/bin/ClrModels.dll' => true >>> include ClrModels => Object >>> MyClassWithAStatic => ClrModels::MyClassWithAStatic >>> MyClassWithAStatic.good_bye_world => 'Goodbye world!' >>> sc = StaticCaller.new => ClrModels.StaticCaller >>> sc.calls_static => 'Goodbye world!' >>> class MyClassWithAStatic ... def self.good_bye_world ... "From Ruby we say goodbye to you" ... end ... end => nil >>> MyClassWithAStatic.good_bye_world => "From Ruby we say goodbye to you" >>> sc = StaticCaller.new => ClrModels.StaticCaller >>> sc.calls_static => 'Goodbye world!' New session to figure out if something could be done before the type was actually created + C:\dev\caricature (master) ? ir IronRuby 0.4.0.0 on .NET 2.0.50727.4918 Copyright (c) Microsoft Corporation. All rights reserved. >>> require 'spec/bin/ClrModels.dll' => true >>> class MyClassWithAStatic ... def self.good_bye_world ... "From Ruby we say goodbye to you" ... end ... end => nil >>> ClrModels::StaticCaller.new.calls_static => 'Goodbye world!' --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Don Marquis - "Procrastination is the art of keeping up with yesterday." -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jimmy.Schementi at microsoft.com Wed May 13 13:03:13 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Wed, 13 May 2009 17:03:13 +0000 Subject: [Ironruby-core] more interop questions In-Reply-To: References: Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC06EFE63B@tk5ex14mbxc106.redmond.corp.microsoft.com> I want to re-emphasize and expand a bit on what Tomas said: monkey-patching .NET will only be visible from Ruby. You could look at this as a feature of IronRuby as it will never break .NET code. In reality, it?s a limitation of the CLR which does not allow modification of types once they are created. Ivan, this is exactly why a special mocking framework needs to be built for IronRuby =) To make this a bit more concrete, here?s a simple example: class Foo { public int Bar() { return 42; } public void SayBar() { System.Console.WriteLine(Bar()); } } The SayBar() method is compiled to call the method Bar(). When this Ruby code is executed: class Foo def Bar ?Monkey patched!? end end The .NET ?Foo? class is not changed, but a new type is created and the Ruby method resolution knows to check this Ruby class first, then the ?Foo? .NET type (I?m drastically overly-simplifying the way method lookup works, but for this example it?ll do =P). So when Bar() is called from Ruby it will give you the Ruby method: >>> Foo.new.Bar => ?Monkey Patched!? But the SayBar() method will always call the static version of Bar(), because monkey-patching has no effect on the .NET view of the world. >>> Foo.new.SayBar 42 => nil The only way to truly modify the ?.NET-view? from Ruby is via System.Reflection. Today C# code can only call into DLR code by using the DLR Hosting API, though as Tomas mentioned that is improving in C#4. I?ll add this to the wiki, as I?m beginning to build up our .NET integration documentation ? keep asking questions like this to make my life easier =) ~Jimmy From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Tomas Matousek Sent: Wednesday, May 13, 2009 9:37 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] more interop questions It?s pretty simple: your can define a Ruby method on any class/interface. The method will only be visible from Ruby unless the class is a Ruby dynamic object (implements IDynamicObjectProvider using Ruby binders). For such dynamic objects Ruby methods will be available when invoked from dynamic expression in C# 4.0. The methods are also invokable via ObjectOperations class in Hosting API. Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Wednesday, May 13, 2009 9:20 AM To: ironruby-core Subject: Re: [Ironruby-core] more interop questions I know these sound like pretty basic questions.. but I'm playing devil's advocate here (maybe rubyist advocate is better suited) and I imagine I will need a good chunk in a chapter somewhere to explain this stuff really clearly. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Wed, May 13, 2009 at 5:57 PM, Ivan Porto Carrero > wrote: Hi I got into a discussion with Roy Osherhove about overriding statics. I know in C# it can't be done obviously and as long as I stay in Ruby you can. I understand this may seem like straight-forward stuff. Can you give me a pointer where I can take stock of what I can and can't do to CLR objects and in which cases ruby things apply? But when you go back and call it from a C# class it takes the CLR implementation public class MyClassWithAStatic{ public string HelloWorld(){ return "Hello World!"; } public static string GoodByeWorld(){ return "Goodbye world!"; } } public class StaticCaller{ public string CallsStatic(){ return MyClassWithAStatic.GoodByeWorld(); } } console session: (master) ? ir IronRuby 0.4.0.0 on .NET 2.0.50727.4918 Copyright (c) Microsoft Corporation. All rights reserved. >>> require 'spec/bin/ClrModels.dll' => true >>> include ClrModels => Object >>> MyClassWithAStatic => ClrModels::MyClassWithAStatic >>> MyClassWithAStatic.good_bye_world => 'Goodbye world!' >>> sc = StaticCaller.new => ClrModels.StaticCaller >>> sc.calls_static => 'Goodbye world!' >>> class MyClassWithAStatic ... def self.good_bye_world ... "From Ruby we say goodbye to you" ... end ... end => nil >>> MyClassWithAStatic.good_bye_world => "From Ruby we say goodbye to you" >>> sc = StaticCaller.new => ClrModels.StaticCaller >>> sc.calls_static => 'Goodbye world!' New session to figure out if something could be done before the type was actually created + C:\dev\caricature (master) ? ir IronRuby 0.4.0.0 on .NET 2.0.50727.4918 Copyright (c) Microsoft Corporation. All rights reserved. >>> require 'spec/bin/ClrModels.dll' => true >>> class MyClassWithAStatic ... def self.good_bye_world ... "From Ruby we say goodbye to you" ... end ... end => nil >>> ClrModels::StaticCaller.new.calls_static => 'Goodbye world!' --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Don Marquis - "Procrastination is the art of keeping up with yesterday." -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdeville at microsoft.com Wed May 13 14:46:28 2009 From: jdeville at microsoft.com (Jim Deville) Date: Wed, 13 May 2009 18:46:28 +0000 Subject: [Ironruby-core] srand implemented? In-Reply-To: References: Message-ID: Has anyone replied to this? JD ...there is no try > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > bounces at rubyforge.org] On Behalf Of Justin Bailey > Sent: Tuesday, April 21, 2009 9:37 AM > To: ironruby-core at rubyforge.org > Subject: [Ironruby-core] srand implemented? > > Is srand implemented? How can I seed the random number generator if not? > A quick search showed some discussion about it last May but I didn't see any > activity since then ... > > Justin > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core From Shri.Borde at microsoft.com Wed May 13 15:41:40 2009 From: Shri.Borde at microsoft.com (Shri Borde) Date: Wed, 13 May 2009 12:41:40 -0700 Subject: [Ironruby-core] more interop questions In-Reply-To: <0047ECBFA2E0DF4A834AA369282A5AFC06EFE63B@tk5ex14mbxc106.redmond.corp.microsoft.com> References: <0047ECBFA2E0DF4A834AA369282A5AFC06EFE63B@tk5ex14mbxc106.redmond.corp.microsoft.com> Message-ID: <710DF26F214D2B4BB94287123FFE980A2E1C2B0D26@NA-EXMSG-C104.redmond.corp.microsoft.com> For the devil?s advocate position Ivan was arguing for, you could argue that IronRuby should only allow *adding* new members to CLR types, not to edit or delete existing CLR members. The added members would be visible only from Ruby. From C#, you will get compiler errors anyway if you try to call these added members (unless you use ?dynamic? in C# 4.0), and so having two different views of the CLR type is OK here since there is no scope for confusion. This would be somewhat similar to the way C# extension methods work ? the real methods of the type get precedence, and extension methods (comparable to monkey-patched Ruby methods) get lower precedence during overload resolution. Building a special mocking framework for IronRuby does not change the basic fact that CLR types are unmodifiable. A special framework will work only if the app is all IronRuby code, but it will break when C# is thrown in the mix. The current plan is to allow monkey-patching of CLR members on CLR types. It does give power but has some unpredictability as well. Feedback and real-world experience is welcome about whether this is the right thing or not. From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Jimmy Schementi Sent: Wednesday, May 13, 2009 10:03 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] more interop questions I want to re-emphasize and expand a bit on what Tomas said: monkey-patching .NET will only be visible from Ruby. You could look at this as a feature of IronRuby as it will never break .NET code. In reality, it?s a limitation of the CLR which does not allow modification of types once they are created. Ivan, this is exactly why a special mocking framework needs to be built for IronRuby =) To make this a bit more concrete, here?s a simple example: class Foo { public int Bar() { return 42; } public void SayBar() { System.Console.WriteLine(Bar()); } } The SayBar() method is compiled to call the method Bar(). When this Ruby code is executed: class Foo def Bar ?Monkey patched!? end end The .NET ?Foo? class is not changed, but a new type is created and the Ruby method resolution knows to check this Ruby class first, then the ?Foo? .NET type (I?m drastically overly-simplifying the way method lookup works, but for this example it?ll do =P). So when Bar() is called from Ruby it will give you the Ruby method: >>> Foo.new.Bar => ?Monkey Patched!? But the SayBar() method will always call the static version of Bar(), because monkey-patching has no effect on the .NET view of the world. >>> Foo.new.SayBar 42 => nil The only way to truly modify the ?.NET-view? from Ruby is via System.Reflection. Today C# code can only call into DLR code by using the DLR Hosting API, though as Tomas mentioned that is improving in C#4. I?ll add this to the wiki, as I?m beginning to build up our .NET integration documentation ? keep asking questions like this to make my life easier =) ~Jimmy From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Tomas Matousek Sent: Wednesday, May 13, 2009 9:37 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] more interop questions It?s pretty simple: your can define a Ruby method on any class/interface. The method will only be visible from Ruby unless the class is a Ruby dynamic object (implements IDynamicObjectProvider using Ruby binders). For such dynamic objects Ruby methods will be available when invoked from dynamic expression in C# 4.0. The methods are also invokable via ObjectOperations class in Hosting API. Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Wednesday, May 13, 2009 9:20 AM To: ironruby-core Subject: Re: [Ironruby-core] more interop questions I know these sound like pretty basic questions.. but I'm playing devil's advocate here (maybe rubyist advocate is better suited) and I imagine I will need a good chunk in a chapter somewhere to explain this stuff really clearly. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Wed, May 13, 2009 at 5:57 PM, Ivan Porto Carrero > wrote: Hi I got into a discussion with Roy Osherhove about overriding statics. I know in C# it can't be done obviously and as long as I stay in Ruby you can. I understand this may seem like straight-forward stuff. Can you give me a pointer where I can take stock of what I can and can't do to CLR objects and in which cases ruby things apply? But when you go back and call it from a C# class it takes the CLR implementation public class MyClassWithAStatic{ public string HelloWorld(){ return "Hello World!"; } public static string GoodByeWorld(){ return "Goodbye world!"; } } public class StaticCaller{ public string CallsStatic(){ return MyClassWithAStatic.GoodByeWorld(); } } console session: (master) ? ir IronRuby 0.4.0.0 on .NET 2.0.50727.4918 Copyright (c) Microsoft Corporation. All rights reserved. >>> require 'spec/bin/ClrModels.dll' => true >>> include ClrModels => Object >>> MyClassWithAStatic => ClrModels::MyClassWithAStatic >>> MyClassWithAStatic.good_bye_world => 'Goodbye world!' >>> sc = StaticCaller.new => ClrModels.StaticCaller >>> sc.calls_static => 'Goodbye world!' >>> class MyClassWithAStatic ... def self.good_bye_world ... "From Ruby we say goodbye to you" ... end ... end => nil >>> MyClassWithAStatic.good_bye_world => "From Ruby we say goodbye to you" >>> sc = StaticCaller.new => ClrModels.StaticCaller >>> sc.calls_static => 'Goodbye world!' New session to figure out if something could be done before the type was actually created + C:\dev\caricature (master) ? ir IronRuby 0.4.0.0 on .NET 2.0.50727.4918 Copyright (c) Microsoft Corporation. All rights reserved. >>> require 'spec/bin/ClrModels.dll' => true >>> class MyClassWithAStatic ... def self.good_bye_world ... "From Ruby we say goodbye to you" ... end ... end => nil >>> ClrModels::StaticCaller.new.calls_static => 'Goodbye world!' --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Don Marquis - "Procrastination is the art of keeping up with yesterday." -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan at flanders.co.nz Wed May 13 16:38:44 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Wed, 13 May 2009 22:38:44 +0200 Subject: [Ironruby-core] more interop questions In-Reply-To: References: <0047ECBFA2E0DF4A834AA369282A5AFC06EFE63B@tk5ex14mbxc106.redmond.corp.microsoft.com> <928de89c0905131256j6b5bea1es2533c4b22bfea3e0@mail.gmail.com> Message-ID: o right.. so implementing that interface on any CLR type would be enough to make it play nice? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Jay Leno - "Don't forget Mother's Day. Or as they call it in Beverly Hills, Dad's Third Wife Day." On Wed, May 13, 2009 at 10:23 PM, Curt Hagenlocher wrote: > You only get the dynamic behavior from C# if the actual underlying type > implements IDynamicMetaObjectProvider. In this case, Bar() returns an object > of type ?System.Int32? ? which does not implement that interface. > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Stefan Dobrev > *Sent:* Wednesday, May 13, 2009 12:57 PM > > *To:* ironruby-core at rubyforge.org > *Subject:* Re: [Ironruby-core] more interop questions > > > > I suppose we will get the dynamic behavior if the Foo changes like this: > > class Foo { > > public *dynamic *Bar() { > > return 42; > > } > > public void SayBar() { > > System.Console.WriteLine(Bar()); > > } > > } > > Right? > > 2009/5/13 Jimmy Schementi > > I want to re-emphasize and expand a bit on what Tomas said: *monkey-patching > .NET will only be visible from Ruby*. You could look at this as a *feature > *of IronRuby as it will never break .NET code. In reality, it?s a > limitation of the CLR which does not allow modification of types once they > are created. > > > > Ivan, this is exactly why a special mocking framework needs to be built for > IronRuby =) > > > > To make this a bit more concrete, here?s a simple example: > > > > class Foo { > > public int Bar() { > > return 42; > > } > > public void SayBar() { > > System.Console.WriteLine(Bar()); > > } > > } > > > > The SayBar() method is compiled to call the method Bar(). When this Ruby > code is executed: > > > > class Foo > > def Bar > > ?Monkey patched!? > > end > > end > > > > The .NET ?Foo? class is not changed, but a new type is created and the Ruby > method resolution knows to check this Ruby class first, then the ?Foo? .NET > type (I?m drastically overly-simplifying the way method lookup works, but > for this example it?ll do =P). So when Bar() is called from Ruby it will > give you the Ruby method: > > > > >>> Foo.new.Bar > > => ?Monkey Patched!? > > > > But the SayBar() method will always call the static version of Bar(), > because monkey-patching has no effect on the .NET view of the world. > > > > >>> Foo.new.SayBar > > 42 > > => nil > > > > The only way to truly modify the ?.NET-view? from Ruby is via > System.Reflection. Today C# code can only call into DLR code by using the > DLR Hosting API, though as Tomas mentioned that is improving in C#4. > > > > I?ll add this to the wiki, as I?m beginning to build up our .NET > integration documentation ? keep asking questions like this to make my life > easier =) > > > > ~Jimmy > > > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Tomas Matousek > *Sent:* Wednesday, May 13, 2009 9:37 AM > *To:* ironruby-core at rubyforge.org > > > *Subject:* Re: [Ironruby-core] more interop questions > > > > It?s pretty simple: your can define a Ruby method on any class/interface. > The method will only be visible from Ruby unless the class is a Ruby dynamic > object (implements IDynamicObjectProvider using Ruby binders). For such > dynamic objects Ruby methods will be available when invoked from dynamic > expression in C# 4.0. The methods are also invokable via ObjectOperations > class in Hosting API. > > > > Tomas > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Ivan Porto Carrero > *Sent:* Wednesday, May 13, 2009 9:20 AM > *To:* ironruby-core > *Subject:* Re: [Ironruby-core] more interop questions > > > > I know these sound like pretty basic questions.. but I'm playing devil's > advocate here (maybe rubyist advocate is better suited) and I imagine I will > need a good chunk in a chapter somewhere to explain this stuff really > clearly. > > > > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > On Wed, May 13, 2009 at 5:57 PM, Ivan Porto Carrero > wrote: > > Hi > > > > I got into a discussion with Roy Osherhove about overriding statics. > > > > I know in C# it can't be done obviously and as long as I stay in Ruby you > can. I understand this may seem like straight-forward stuff. Can you give me > a pointer where I can take stock of what I can and can't do to CLR objects > and in which cases ruby things apply? > > > > But when you go back and call it from a C# class it takes the CLR > implementation > > > > public class MyClassWithAStatic{ > > > > public string HelloWorld(){ > > return "Hello World!"; > > } > > > > public static string GoodByeWorld(){ > > return "Goodbye world!"; > > } > > } > > > > public class StaticCaller{ > > > > public string CallsStatic(){ > > return MyClassWithAStatic.GoodByeWorld(); > > } > > } > > > console session: > > (master) ? ir > > IronRuby 0.4.0.0 on .NET 2.0.50727.4918 > > Copyright (c) Microsoft Corporation. All rights reserved. > > > > >>> require 'spec/bin/ClrModels.dll' > > => true > > >>> include ClrModels > > => Object > > >>> MyClassWithAStatic > > => ClrModels::MyClassWithAStatic > > >>> MyClassWithAStatic.good_bye_world > > => 'Goodbye world!' > > >>> sc = StaticCaller.new > > => ClrModels.StaticCaller > > >>> sc.calls_static > > => 'Goodbye world!' > > >>> class MyClassWithAStatic > > ... def self.good_bye_world > > ... "From Ruby we say goodbye to you" > > ... end > > ... end > > => nil > > >>> MyClassWithAStatic.good_bye_world > > => "From Ruby we say goodbye to you" > > >>> sc = StaticCaller.new > > => ClrModels.StaticCaller > > >>> sc.calls_static > > => 'Goodbye world!' > > > > New session to figure out if something could be done before the type was > actually created > > > > + C:\dev\caricature > > (master) ? ir > > IronRuby 0.4.0.0 on .NET 2.0.50727.4918 > > Copyright (c) Microsoft Corporation. All rights reserved. > > > > >>> require 'spec/bin/ClrModels.dll' > > => true > > >>> class MyClassWithAStatic > > ... def self.good_bye_world > > ... "From Ruby we say goodbye to you" > > ... end > > ... end > > => nil > > >>> ClrModels::StaticCaller.new.calls_static > > => 'Goodbye world!' > > > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > Don Marquis - "Procrastination is the art of keeping up with yesterday." > > > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan at flanders.co.nz Wed May 13 16:46:55 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Wed, 13 May 2009 22:46:55 +0200 Subject: [Ironruby-core] more interop questions In-Reply-To: <710DF26F214D2B4BB94287123FFE980A2E1C2B0D26@NA-EXMSG-C104.redmond.corp.microsoft.com> References: <0047ECBFA2E0DF4A834AA369282A5AFC06EFE63B@tk5ex14mbxc106.redmond.corp.microsoft.com> <710DF26F214D2B4BB94287123FFE980A2E1C2B0D26@NA-EXMSG-C104.redmond.corp.microsoft.com> Message-ID: Well actually at this point I have progressed in searching for a way to cheat.But I didn't find a way yet that will work with signed 3rd party signed assemblies like say sharepoint. I can use Mono.Cecil to change some of the types to include AOP hooks so I can inject ruby in them and get the expected result by just not calling the real method body. That should work for everything that isn't signed. if the signed assemblies aren't being referenced by anything else than your source code then that will still work by recompiling the source code against the new assemblies. I think that should get me pretty far in what I'm trying to achieve with the mocker. I need to be able to intercept the method call, execute ruby and decide whether or not to call the previous method. Then I'm only stuck on how to get around 3rd party signed assemblies with keys that I don't have access to. In my case the expected result is when I'm working from ruby things should behave like ruby. So if I monkey patch some method it should just replace the thing also when C# calls it :) --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Vince Lombardi - "We didn't lose the game; we just ran out of time." On Wed, May 13, 2009 at 9:41 PM, Shri Borde wrote: > For the devil?s advocate position Ivan was arguing for, you could argue > that IronRuby should only allow **adding** new members to CLR types, not > to edit or delete existing CLR members. The added members would be visible > only from Ruby. From C#, you will get compiler errors anyway if you try to > call these added members (unless you use ?dynamic? in C# 4.0), and so having > two different views of the CLR type is OK here since there is no scope for > confusion. > > > > This would be somewhat similar to the way C# extension methods work ? the > real methods of the type get precedence, and extension methods (comparable > to monkey-patched Ruby methods) get lower precedence during overload > resolution. > > > > Building a special mocking framework for IronRuby does not change the basic > fact that CLR types are unmodifiable. A special framework will work only if > the app is all IronRuby code, but it will break when C# is thrown in the > mix. > > > > The current plan is to allow monkey-patching of CLR members on CLR types. > It does give power but has some unpredictability as well. Feedback and > real-world experience is welcome about whether this is the right thing or > not. > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Jimmy Schementi > *Sent:* Wednesday, May 13, 2009 10:03 AM > > *To:* ironruby-core at rubyforge.org > *Subject:* Re: [Ironruby-core] more interop questions > > > > I want to re-emphasize and expand a bit on what Tomas said: *monkey-patching > .NET will only be visible from Ruby*. You could look at this as a *feature > *of IronRuby as it will never break .NET code. In reality, it?s a > limitation of the CLR which does not allow modification of types once they > are created. > > > > Ivan, this is exactly why a special mocking framework needs to be built for > IronRuby =) > > > > To make this a bit more concrete, here?s a simple example: > > > > class Foo { > > public int Bar() { > > return 42; > > } > > public void SayBar() { > > System.Console.WriteLine(Bar()); > > } > > } > > > > The SayBar() method is compiled to call the method Bar(). When this Ruby > code is executed: > > > > class Foo > > def Bar > > ?Monkey patched!? > > end > > end > > > > The .NET ?Foo? class is not changed, but a new type is created and the Ruby > method resolution knows to check this Ruby class first, then the ?Foo? .NET > type (I?m drastically overly-simplifying the way method lookup works, but > for this example it?ll do =P). So when Bar() is called from Ruby it will > give you the Ruby method: > > > > >>> Foo.new.Bar > > => ?Monkey Patched!? > > > > But the SayBar() method will always call the static version of Bar(), > because monkey-patching has no effect on the .NET view of the world. > > > > >>> Foo.new.SayBar > > 42 > > => nil > > > > The only way to truly modify the ?.NET-view? from Ruby is via > System.Reflection. Today C# code can only call into DLR code by using the > DLR Hosting API, though as Tomas mentioned that is improving in C#4. > > > > I?ll add this to the wiki, as I?m beginning to build up our .NET > integration documentation ? keep asking questions like this to make my life > easier =) > > > > ~Jimmy > > > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Tomas Matousek > *Sent:* Wednesday, May 13, 2009 9:37 AM > *To:* ironruby-core at rubyforge.org > *Subject:* Re: [Ironruby-core] more interop questions > > > > It?s pretty simple: your can define a Ruby method on any class/interface. > The method will only be visible from Ruby unless the class is a Ruby dynamic > object (implements IDynamicObjectProvider using Ruby binders). For such > dynamic objects Ruby methods will be available when invoked from dynamic > expression in C# 4.0. The methods are also invokable via ObjectOperations > class in Hosting API. > > > > Tomas > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Ivan Porto Carrero > *Sent:* Wednesday, May 13, 2009 9:20 AM > *To:* ironruby-core > *Subject:* Re: [Ironruby-core] more interop questions > > > > I know these sound like pretty basic questions.. but I'm playing devil's > advocate here (maybe rubyist advocate is better suited) and I imagine I will > need a good chunk in a chapter somewhere to explain this stuff really > clearly. > > > > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > On Wed, May 13, 2009 at 5:57 PM, Ivan Porto Carrero > wrote: > > Hi > > > > I got into a discussion with Roy Osherhove about overriding statics. > > > > I know in C# it can't be done obviously and as long as I stay in Ruby you > can. I understand this may seem like straight-forward stuff. Can you give me > a pointer where I can take stock of what I can and can't do to CLR objects > and in which cases ruby things apply? > > > > But when you go back and call it from a C# class it takes the CLR > implementation > > > > public class MyClassWithAStatic{ > > > > public string HelloWorld(){ > > return "Hello World!"; > > } > > > > public static string GoodByeWorld(){ > > return "Goodbye world!"; > > } > > } > > > > public class StaticCaller{ > > > > public string CallsStatic(){ > > return MyClassWithAStatic.GoodByeWorld(); > > } > > } > > > console session: > > (master) ? ir > > IronRuby 0.4.0.0 on .NET 2.0.50727.4918 > > Copyright (c) Microsoft Corporation. All rights reserved. > > > > >>> require 'spec/bin/ClrModels.dll' > > => true > > >>> include ClrModels > > => Object > > >>> MyClassWithAStatic > > => ClrModels::MyClassWithAStatic > > >>> MyClassWithAStatic.good_bye_world > > => 'Goodbye world!' > > >>> sc = StaticCaller.new > > => ClrModels.StaticCaller > > >>> sc.calls_static > > => 'Goodbye world!' > > >>> class MyClassWithAStatic > > ... def self.good_bye_world > > ... "From Ruby we say goodbye to you" > > ... end > > ... end > > => nil > > >>> MyClassWithAStatic.good_bye_world > > => "From Ruby we say goodbye to you" > > >>> sc = StaticCaller.new > > => ClrModels.StaticCaller > > >>> sc.calls_static > > => 'Goodbye world!' > > > > New session to figure out if something could be done before the type was > actually created > > > > + C:\dev\caricature > > (master) ? ir > > IronRuby 0.4.0.0 on .NET 2.0.50727.4918 > > Copyright (c) Microsoft Corporation. All rights reserved. > > > > >>> require 'spec/bin/ClrModels.dll' > > => true > > >>> class MyClassWithAStatic > > ... def self.good_bye_world > > ... "From Ruby we say goodbye to you" > > ... end > > ... end > > => nil > > >>> ClrModels::StaticCaller.new.calls_static > > => 'Goodbye world!' > > > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > Don Marquis - "Procrastination is the art of keeping up with yesterday." > > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Shri.Borde at microsoft.com Wed May 13 16:58:24 2009 From: Shri.Borde at microsoft.com (Shri Borde) Date: Wed, 13 May 2009 13:58:24 -0700 Subject: [Ironruby-core] more interop questions In-Reply-To: References: <0047ECBFA2E0DF4A834AA369282A5AFC06EFE63B@tk5ex14mbxc106.redmond.corp.microsoft.com> <710DF26F214D2B4BB94287123FFE980A2E1C2B0D26@NA-EXMSG-C104.redmond.corp.microsoft.com> Message-ID: <710DF26F214D2B4BB94287123FFE980A2E1C2B0DB1@NA-EXMSG-C104.redmond.corp.microsoft.com> If you really want to push the envelope that far, you can use the Profiling APIs (http://msdn.microsoft.com/en-us/magazine/cc300553.aspx) to replace the IL method bodies. That will work with signed assemblies, and you don?t need to change any source code either. Its very powerful, but pretty complicated as well. From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Wednesday, May 13, 2009 1:47 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] more interop questions Well actually at this point I have progressed in searching for a way to cheat. But I didn't find a way yet that will work with signed 3rd party signed assemblies like say sharepoint. I can use Mono.Cecil to change some of the types to include AOP hooks so I can inject ruby in them and get the expected result by just not calling the real method body. That should work for everything that isn't signed. if the signed assemblies aren't being referenced by anything else than your source code then that will still work by recompiling the source code against the new assemblies. I think that should get me pretty far in what I'm trying to achieve with the mocker. I need to be able to intercept the method call, execute ruby and decide whether or not to call the previous method. Then I'm only stuck on how to get around 3rd party signed assemblies with keys that I don't have access to. In my case the expected result is when I'm working from ruby things should behave like ruby. So if I monkey patch some method it should just replace the thing also when C# calls it :) --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Vince Lombardi - "We didn't lose the game; we just ran out of time." On Wed, May 13, 2009 at 9:41 PM, Shri Borde > wrote: For the devil?s advocate position Ivan was arguing for, you could argue that IronRuby should only allow *adding* new members to CLR types, not to edit or delete existing CLR members. The added members would be visible only from Ruby. From C#, you will get compiler errors anyway if you try to call these added members (unless you use ?dynamic? in C# 4.0), and so having two different views of the CLR type is OK here since there is no scope for confusion. This would be somewhat similar to the way C# extension methods work ? the real methods of the type get precedence, and extension methods (comparable to monkey-patched Ruby methods) get lower precedence during overload resolution. Building a special mocking framework for IronRuby does not change the basic fact that CLR types are unmodifiable. A special framework will work only if the app is all IronRuby code, but it will break when C# is thrown in the mix. The current plan is to allow monkey-patching of CLR members on CLR types. It does give power but has some unpredictability as well. Feedback and real-world experience is welcome about whether this is the right thing or not. From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Jimmy Schementi Sent: Wednesday, May 13, 2009 10:03 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] more interop questions I want to re-emphasize and expand a bit on what Tomas said: monkey-patching .NET will only be visible from Ruby. You could look at this as a feature of IronRuby as it will never break .NET code. In reality, it?s a limitation of the CLR which does not allow modification of types once they are created. Ivan, this is exactly why a special mocking framework needs to be built for IronRuby =) To make this a bit more concrete, here?s a simple example: class Foo { public int Bar() { return 42; } public void SayBar() { System.Console.WriteLine(Bar()); } } The SayBar() method is compiled to call the method Bar(). When this Ruby code is executed: class Foo def Bar ?Monkey patched!? end end The .NET ?Foo? class is not changed, but a new type is created and the Ruby method resolution knows to check this Ruby class first, then the ?Foo? .NET type (I?m drastically overly-simplifying the way method lookup works, but for this example it?ll do =P). So when Bar() is called from Ruby it will give you the Ruby method: >>> Foo.new.Bar => ?Monkey Patched!? But the SayBar() method will always call the static version of Bar(), because monkey-patching has no effect on the .NET view of the world. >>> Foo.new.SayBar 42 => nil The only way to truly modify the ?.NET-view? from Ruby is via System.Reflection. Today C# code can only call into DLR code by using the DLR Hosting API, though as Tomas mentioned that is improving in C#4. I?ll add this to the wiki, as I?m beginning to build up our .NET integration documentation ? keep asking questions like this to make my life easier =) ~Jimmy From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Tomas Matousek Sent: Wednesday, May 13, 2009 9:37 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] more interop questions It?s pretty simple: your can define a Ruby method on any class/interface. The method will only be visible from Ruby unless the class is a Ruby dynamic object (implements IDynamicObjectProvider using Ruby binders). For such dynamic objects Ruby methods will be available when invoked from dynamic expression in C# 4.0. The methods are also invokable via ObjectOperations class in Hosting API. Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Wednesday, May 13, 2009 9:20 AM To: ironruby-core Subject: Re: [Ironruby-core] more interop questions I know these sound like pretty basic questions.. but I'm playing devil's advocate here (maybe rubyist advocate is better suited) and I imagine I will need a good chunk in a chapter somewhere to explain this stuff really clearly. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Wed, May 13, 2009 at 5:57 PM, Ivan Porto Carrero > wrote: Hi I got into a discussion with Roy Osherhove about overriding statics. I know in C# it can't be done obviously and as long as I stay in Ruby you can. I understand this may seem like straight-forward stuff. Can you give me a pointer where I can take stock of what I can and can't do to CLR objects and in which cases ruby things apply? But when you go back and call it from a C# class it takes the CLR implementation public class MyClassWithAStatic{ public string HelloWorld(){ return "Hello World!"; } public static string GoodByeWorld(){ return "Goodbye world!"; } } public class StaticCaller{ public string CallsStatic(){ return MyClassWithAStatic.GoodByeWorld(); } } console session: (master) ? ir IronRuby 0.4.0.0 on .NET 2.0.50727.4918 Copyright (c) Microsoft Corporation. All rights reserved. >>> require 'spec/bin/ClrModels.dll' => true >>> include ClrModels => Object >>> MyClassWithAStatic => ClrModels::MyClassWithAStatic >>> MyClassWithAStatic.good_bye_world => 'Goodbye world!' >>> sc = StaticCaller.new => ClrModels.StaticCaller >>> sc.calls_static => 'Goodbye world!' >>> class MyClassWithAStatic ... def self.good_bye_world ... "From Ruby we say goodbye to you" ... end ... end => nil >>> MyClassWithAStatic.good_bye_world => "From Ruby we say goodbye to you" >>> sc = StaticCaller.new => ClrModels.StaticCaller >>> sc.calls_static => 'Goodbye world!' New session to figure out if something could be done before the type was actually created + C:\dev\caricature (master) ? ir IronRuby 0.4.0.0 on .NET 2.0.50727.4918 Copyright (c) Microsoft Corporation. All rights reserved. >>> require 'spec/bin/ClrModels.dll' => true >>> class MyClassWithAStatic ... def self.good_bye_world ... "From Ruby we say goodbye to you" ... end ... end => nil >>> ClrModels::StaticCaller.new.calls_static => 'Goodbye world!' --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Don Marquis - "Procrastination is the art of keeping up with yesterday." _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core -------------- next part -------------- An HTML attachment was scrubbed... URL: From Shri.Borde at microsoft.com Wed May 13 17:00:02 2009 From: Shri.Borde at microsoft.com (Shri Borde) Date: Wed, 13 May 2009 14:00:02 -0700 Subject: [Ironruby-core] more interop questions References: <0047ECBFA2E0DF4A834AA369282A5AFC06EFE63B@tk5ex14mbxc106.redmond.corp.microsoft.com> <710DF26F214D2B4BB94287123FFE980A2E1C2B0D26@NA-EXMSG-C104.redmond.corp.microsoft.com> Message-ID: <710DF26F214D2B4BB94287123FFE980A2E1C2B0DB5@NA-EXMSG-C104.redmond.corp.microsoft.com> The link you want is http://msdn.microsoft.com/en-us/magazine/cc188743.aspx From: Shri Borde Sent: Wednesday, May 13, 2009 1:58 PM To: ironruby-core at rubyforge.org Subject: RE: [Ironruby-core] more interop questions If you really want to push the envelope that far, you can use the Profiling APIs (http://msdn.microsoft.com/en-us/magazine/cc300553.aspx) to replace the IL method bodies. That will work with signed assemblies, and you don?t need to change any source code either. Its very powerful, but pretty complicated as well. From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Wednesday, May 13, 2009 1:47 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] more interop questions Well actually at this point I have progressed in searching for a way to cheat. But I didn't find a way yet that will work with signed 3rd party signed assemblies like say sharepoint. I can use Mono.Cecil to change some of the types to include AOP hooks so I can inject ruby in them and get the expected result by just not calling the real method body. That should work for everything that isn't signed. if the signed assemblies aren't being referenced by anything else than your source code then that will still work by recompiling the source code against the new assemblies. I think that should get me pretty far in what I'm trying to achieve with the mocker. I need to be able to intercept the method call, execute ruby and decide whether or not to call the previous method. Then I'm only stuck on how to get around 3rd party signed assemblies with keys that I don't have access to. In my case the expected result is when I'm working from ruby things should behave like ruby. So if I monkey patch some method it should just replace the thing also when C# calls it :) --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Vince Lombardi - "We didn't lose the game; we just ran out of time." On Wed, May 13, 2009 at 9:41 PM, Shri Borde > wrote: For the devil?s advocate position Ivan was arguing for, you could argue that IronRuby should only allow *adding* new members to CLR types, not to edit or delete existing CLR members. The added members would be visible only from Ruby. From C#, you will get compiler errors anyway if you try to call these added members (unless you use ?dynamic? in C# 4.0), and so having two different views of the CLR type is OK here since there is no scope for confusion. This would be somewhat similar to the way C# extension methods work ? the real methods of the type get precedence, and extension methods (comparable to monkey-patched Ruby methods) get lower precedence during overload resolution. Building a special mocking framework for IronRuby does not change the basic fact that CLR types are unmodifiable. A special framework will work only if the app is all IronRuby code, but it will break when C# is thrown in the mix. The current plan is to allow monkey-patching of CLR members on CLR types. It does give power but has some unpredictability as well. Feedback and real-world experience is welcome about whether this is the right thing or not. From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Jimmy Schementi Sent: Wednesday, May 13, 2009 10:03 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] more interop questions I want to re-emphasize and expand a bit on what Tomas said: monkey-patching .NET will only be visible from Ruby. You could look at this as a feature of IronRuby as it will never break .NET code. In reality, it?s a limitation of the CLR which does not allow modification of types once they are created. Ivan, this is exactly why a special mocking framework needs to be built for IronRuby =) To make this a bit more concrete, here?s a simple example: class Foo { public int Bar() { return 42; } public void SayBar() { System.Console.WriteLine(Bar()); } } The SayBar() method is compiled to call the method Bar(). When this Ruby code is executed: class Foo def Bar ?Monkey patched!? end end The .NET ?Foo? class is not changed, but a new type is created and the Ruby method resolution knows to check this Ruby class first, then the ?Foo? .NET type (I?m drastically overly-simplifying the way method lookup works, but for this example it?ll do =P). So when Bar() is called from Ruby it will give you the Ruby method: >>> Foo.new.Bar => ?Monkey Patched!? But the SayBar() method will always call the static version of Bar(), because monkey-patching has no effect on the .NET view of the world. >>> Foo.new.SayBar 42 => nil The only way to truly modify the ?.NET-view? from Ruby is via System.Reflection. Today C# code can only call into DLR code by using the DLR Hosting API, though as Tomas mentioned that is improving in C#4. I?ll add this to the wiki, as I?m beginning to build up our .NET integration documentation ? keep asking questions like this to make my life easier =) ~Jimmy From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Tomas Matousek Sent: Wednesday, May 13, 2009 9:37 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] more interop questions It?s pretty simple: your can define a Ruby method on any class/interface. The method will only be visible from Ruby unless the class is a Ruby dynamic object (implements IDynamicObjectProvider using Ruby binders). For such dynamic objects Ruby methods will be available when invoked from dynamic expression in C# 4.0. The methods are also invokable via ObjectOperations class in Hosting API. Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Wednesday, May 13, 2009 9:20 AM To: ironruby-core Subject: Re: [Ironruby-core] more interop questions I know these sound like pretty basic questions.. but I'm playing devil's advocate here (maybe rubyist advocate is better suited) and I imagine I will need a good chunk in a chapter somewhere to explain this stuff really clearly. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Wed, May 13, 2009 at 5:57 PM, Ivan Porto Carrero > wrote: Hi I got into a discussion with Roy Osherhove about overriding statics. I know in C# it can't be done obviously and as long as I stay in Ruby you can. I understand this may seem like straight-forward stuff. Can you give me a pointer where I can take stock of what I can and can't do to CLR objects and in which cases ruby things apply? But when you go back and call it from a C# class it takes the CLR implementation public class MyClassWithAStatic{ public string HelloWorld(){ return "Hello World!"; } public static string GoodByeWorld(){ return "Goodbye world!"; } } public class StaticCaller{ public string CallsStatic(){ return MyClassWithAStatic.GoodByeWorld(); } } console session: (master) ? ir IronRuby 0.4.0.0 on .NET 2.0.50727.4918 Copyright (c) Microsoft Corporation. All rights reserved. >>> require 'spec/bin/ClrModels.dll' => true >>> include ClrModels => Object >>> MyClassWithAStatic => ClrModels::MyClassWithAStatic >>> MyClassWithAStatic.good_bye_world => 'Goodbye world!' >>> sc = StaticCaller.new => ClrModels.StaticCaller >>> sc.calls_static => 'Goodbye world!' >>> class MyClassWithAStatic ... def self.good_bye_world ... "From Ruby we say goodbye to you" ... end ... end => nil >>> MyClassWithAStatic.good_bye_world => "From Ruby we say goodbye to you" >>> sc = StaticCaller.new => ClrModels.StaticCaller >>> sc.calls_static => 'Goodbye world!' New session to figure out if something could be done before the type was actually created + C:\dev\caricature (master) ? ir IronRuby 0.4.0.0 on .NET 2.0.50727.4918 Copyright (c) Microsoft Corporation. All rights reserved. >>> require 'spec/bin/ClrModels.dll' => true >>> class MyClassWithAStatic ... def self.good_bye_world ... "From Ruby we say goodbye to you" ... end ... end => nil >>> ClrModels::StaticCaller.new.calls_static => 'Goodbye world!' --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Don Marquis - "Procrastination is the art of keeping up with yesterday." _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core -------------- next part -------------- An HTML attachment was scrubbed... URL: From Tomas.Matousek at microsoft.com Wed May 13 17:02:11 2009 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Wed, 13 May 2009 14:02:11 -0700 Subject: [Ironruby-core] more interop questions In-Reply-To: References: <0047ECBFA2E0DF4A834AA369282A5AFC06EFE63B@tk5ex14mbxc106.redmond.corp.microsoft.com> <928de89c0905131256j6b5bea1es2533c4b22bfea3e0@mail.gmail.com> Message-ID: Yes, if the implementation uses Ruby binder for method lookup. See RubyObject.Meta.cs for an example. Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Wednesday, May 13, 2009 1:39 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] more interop questions o right.. so implementing that interface on any CLR type would be enough to make it play nice? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Jay Leno - "Don't forget Mother's Day. Or as they call it in Beverly Hills, Dad's Third Wife Day." On Wed, May 13, 2009 at 10:23 PM, Curt Hagenlocher > wrote: You only get the dynamic behavior from C# if the actual underlying type implements IDynamicMetaObjectProvider. In this case, Bar() returns an object of type ?System.Int32? ? which does not implement that interface. From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Stefan Dobrev Sent: Wednesday, May 13, 2009 12:57 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] more interop questions I suppose we will get the dynamic behavior if the Foo changes like this: class Foo { public dynamic Bar() { return 42; } public void SayBar() { System.Console.WriteLine(Bar()); } } Right? 2009/5/13 Jimmy Schementi > I want to re-emphasize and expand a bit on what Tomas said: monkey-patching .NET will only be visible from Ruby. You could look at this as a feature of IronRuby as it will never break .NET code. In reality, it?s a limitation of the CLR which does not allow modification of types once they are created. Ivan, this is exactly why a special mocking framework needs to be built for IronRuby =) To make this a bit more concrete, here?s a simple example: class Foo { public int Bar() { return 42; } public void SayBar() { System.Console.WriteLine(Bar()); } } The SayBar() method is compiled to call the method Bar(). When this Ruby code is executed: class Foo def Bar ?Monkey patched!? end end The .NET ?Foo? class is not changed, but a new type is created and the Ruby method resolution knows to check this Ruby class first, then the ?Foo? .NET type (I?m drastically overly-simplifying the way method lookup works, but for this example it?ll do =P). So when Bar() is called from Ruby it will give you the Ruby method: >>> Foo.new.Bar => ?Monkey Patched!? But the SayBar() method will always call the static version of Bar(), because monkey-patching has no effect on the .NET view of the world. >>> Foo.new.SayBar 42 => nil The only way to truly modify the ?.NET-view? from Ruby is via System.Reflection. Today C# code can only call into DLR code by using the DLR Hosting API, though as Tomas mentioned that is improving in C#4. I?ll add this to the wiki, as I?m beginning to build up our .NET integration documentation ? keep asking questions like this to make my life easier =) ~Jimmy From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Tomas Matousek Sent: Wednesday, May 13, 2009 9:37 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] more interop questions It?s pretty simple: your can define a Ruby method on any class/interface. The method will only be visible from Ruby unless the class is a Ruby dynamic object (implements IDynamicObjectProvider using Ruby binders). For such dynamic objects Ruby methods will be available when invoked from dynamic expression in C# 4.0. The methods are also invokable via ObjectOperations class in Hosting API. Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Wednesday, May 13, 2009 9:20 AM To: ironruby-core Subject: Re: [Ironruby-core] more interop questions I know these sound like pretty basic questions.. but I'm playing devil's advocate here (maybe rubyist advocate is better suited) and I imagine I will need a good chunk in a chapter somewhere to explain this stuff really clearly. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Wed, May 13, 2009 at 5:57 PM, Ivan Porto Carrero > wrote: Hi I got into a discussion with Roy Osherhove about overriding statics. I know in C# it can't be done obviously and as long as I stay in Ruby you can. I understand this may seem like straight-forward stuff. Can you give me a pointer where I can take stock of what I can and can't do to CLR objects and in which cases ruby things apply? But when you go back and call it from a C# class it takes the CLR implementation public class MyClassWithAStatic{ public string HelloWorld(){ return "Hello World!"; } public static string GoodByeWorld(){ return "Goodbye world!"; } } public class StaticCaller{ public string CallsStatic(){ return MyClassWithAStatic.GoodByeWorld(); } } console session: (master) ? ir IronRuby 0.4.0.0 on .NET 2.0.50727.4918 Copyright (c) Microsoft Corporation. All rights reserved. >>> require 'spec/bin/ClrModels.dll' => true >>> include ClrModels => Object >>> MyClassWithAStatic => ClrModels::MyClassWithAStatic >>> MyClassWithAStatic.good_bye_world => 'Goodbye world!' >>> sc = StaticCaller.new => ClrModels.StaticCaller >>> sc.calls_static => 'Goodbye world!' >>> class MyClassWithAStatic ... def self.good_bye_world ... "From Ruby we say goodbye to you" ... end ... end => nil >>> MyClassWithAStatic.good_bye_world => "From Ruby we say goodbye to you" >>> sc = StaticCaller.new => ClrModels.StaticCaller >>> sc.calls_static => 'Goodbye world!' New session to figure out if something could be done before the type was actually created + C:\dev\caricature (master) ? ir IronRuby 0.4.0.0 on .NET 2.0.50727.4918 Copyright (c) Microsoft Corporation. All rights reserved. >>> require 'spec/bin/ClrModels.dll' => true >>> class MyClassWithAStatic ... def self.good_bye_world ... "From Ruby we say goodbye to you" ... end ... end => nil >>> ClrModels::StaticCaller.new.calls_static => 'Goodbye world!' --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Don Marquis - "Procrastination is the art of keeping up with yesterday." _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan at flanders.co.nz Wed May 13 17:09:15 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Wed, 13 May 2009 23:09:15 +0200 Subject: [Ironruby-core] more interop questions In-Reply-To: <710DF26F214D2B4BB94287123FFE980A2E1C2B0DB1@NA-EXMSG-C104.redmond.corp.microsoft.com> References: <0047ECBFA2E0DF4A834AA369282A5AFC06EFE63B@tk5ex14mbxc106.redmond.corp.microsoft.com> <710DF26F214D2B4BB94287123FFE980A2E1C2B0D26@NA-EXMSG-C104.redmond.corp.microsoft.com> <710DF26F214D2B4BB94287123FFE980A2E1C2B0DB1@NA-EXMSG-C104.redmond.corp.microsoft.com> Message-ID: Let's just say that won't be a in a 1.0 release :) Thanks I was quietly hoping not to have to resort to that. The silver lining: A push to get into COM interop and ironruby But nailing the mocking thing right could be a huge on-ramp for ironruby usage.. I get the feeling that most of the .NET interest comes from the testing and silverlight integration part --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Yogi Berra - "If you ask me anything I don't know, I'm not going to answer." On Wed, May 13, 2009 at 10:58 PM, Shri Borde wrote: > If you really want to push the envelope that far, you can use the > Profiling APIs (http://msdn.microsoft.com/en-us/magazine/cc300553.aspx) to > replace the IL method bodies. That will work with signed assemblies, and you > don?t need to change any source code either. Its very powerful, but pretty > complicated as well. > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Ivan Porto Carrero > *Sent:* Wednesday, May 13, 2009 1:47 PM > > *To:* ironruby-core at rubyforge.org > *Subject:* Re: [Ironruby-core] more interop questions > > > > Well actually at this point I have progressed in searching for a way to > cheat. > > But I didn't find a way yet that will work with signed 3rd party signed > assemblies like say sharepoint. > > > > I can use Mono.Cecil to change some of the types to include AOP hooks so I > can inject ruby in them and get the expected result by just not calling the > real method body. That should work for everything that isn't signed. if the > signed assemblies aren't being referenced by anything else than your source > code then that will still work by recompiling the source code against the > new assemblies. > > > > I think that should get me pretty far in what I'm trying to achieve with > the mocker. > > I need to be able to intercept the method call, execute ruby and decide > whether or not to call the previous method. > > > > Then I'm only stuck on how to get around 3rd party signed assemblies with > keys that I don't have access to. > > > > In my case the expected result is when I'm working from ruby things should > behave like ruby. So if I monkey patch some method it should just replace > the thing also when C# calls it :) > > > > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > Vince Lombardi - "We didn't lose the game; we just ran out of time." > > On Wed, May 13, 2009 at 9:41 PM, Shri Borde > wrote: > > For the devil?s advocate position Ivan was arguing for, you could argue > that IronRuby should only allow **adding** new members to CLR types, not > to edit or delete existing CLR members. The added members would be visible > only from Ruby. From C#, you will get compiler errors anyway if you try to > call these added members (unless you use ?dynamic? in C# 4.0), and so having > two different views of the CLR type is OK here since there is no scope for > confusion. > > > > This would be somewhat similar to the way C# extension methods work ? the > real methods of the type get precedence, and extension methods (comparable > to monkey-patched Ruby methods) get lower precedence during overload > resolution. > > > > Building a special mocking framework for IronRuby does not change the basic > fact that CLR types are unmodifiable. A special framework will work only if > the app is all IronRuby code, but it will break when C# is thrown in the > mix. > > > > The current plan is to allow monkey-patching of CLR members on CLR types. > It does give power but has some unpredictability as well. Feedback and > real-world experience is welcome about whether this is the right thing or > not. > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Jimmy Schementi > *Sent:* Wednesday, May 13, 2009 10:03 AM > > > *To:* ironruby-core at rubyforge.org > *Subject:* Re: [Ironruby-core] more interop questions > > > > I want to re-emphasize and expand a bit on what Tomas said: *monkey-patching > .NET will only be visible from Ruby*. You could look at this as a *feature > *of IronRuby as it will never break .NET code. In reality, it?s a > limitation of the CLR which does not allow modification of types once they > are created. > > > > Ivan, this is exactly why a special mocking framework needs to be built for > IronRuby =) > > > > To make this a bit more concrete, here?s a simple example: > > > > class Foo { > > public int Bar() { > > return 42; > > } > > public void SayBar() { > > System.Console.WriteLine(Bar()); > > } > > } > > > > The SayBar() method is compiled to call the method Bar(). When this Ruby > code is executed: > > > > class Foo > > def Bar > > ?Monkey patched!? > > end > > end > > > > The .NET ?Foo? class is not changed, but a new type is created and the Ruby > method resolution knows to check this Ruby class first, then the ?Foo? .NET > type (I?m drastically overly-simplifying the way method lookup works, but > for this example it?ll do =P). So when Bar() is called from Ruby it will > give you the Ruby method: > > > > >>> Foo.new.Bar > > => ?Monkey Patched!? > > > > But the SayBar() method will always call the static version of Bar(), > because monkey-patching has no effect on the .NET view of the world. > > > > >>> Foo.new.SayBar > > 42 > > => nil > > > > The only way to truly modify the ?.NET-view? from Ruby is via > System.Reflection. Today C# code can only call into DLR code by using the > DLR Hosting API, though as Tomas mentioned that is improving in C#4. > > > > I?ll add this to the wiki, as I?m beginning to build up our .NET > integration documentation ? keep asking questions like this to make my life > easier =) > > > > ~Jimmy > > > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Tomas Matousek > *Sent:* Wednesday, May 13, 2009 9:37 AM > *To:* ironruby-core at rubyforge.org > *Subject:* Re: [Ironruby-core] more interop questions > > > > It?s pretty simple: your can define a Ruby method on any class/interface. > The method will only be visible from Ruby unless the class is a Ruby dynamic > object (implements IDynamicObjectProvider using Ruby binders). For such > dynamic objects Ruby methods will be available when invoked from dynamic > expression in C# 4.0. The methods are also invokable via ObjectOperations > class in Hosting API. > > > > Tomas > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Ivan Porto Carrero > *Sent:* Wednesday, May 13, 2009 9:20 AM > *To:* ironruby-core > *Subject:* Re: [Ironruby-core] more interop questions > > > > I know these sound like pretty basic questions.. but I'm playing devil's > advocate here (maybe rubyist advocate is better suited) and I imagine I will > need a good chunk in a chapter somewhere to explain this stuff really > clearly. > > > > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > On Wed, May 13, 2009 at 5:57 PM, Ivan Porto Carrero > wrote: > > Hi > > > > I got into a discussion with Roy Osherhove about overriding statics. > > > > I know in C# it can't be done obviously and as long as I stay in Ruby you > can. I understand this may seem like straight-forward stuff. Can you give me > a pointer where I can take stock of what I can and can't do to CLR objects > and in which cases ruby things apply? > > > > But when you go back and call it from a C# class it takes the CLR > implementation > > > > public class MyClassWithAStatic{ > > > > public string HelloWorld(){ > > return "Hello World!"; > > } > > > > public static string GoodByeWorld(){ > > return "Goodbye world!"; > > } > > } > > > > public class StaticCaller{ > > > > public string CallsStatic(){ > > return MyClassWithAStatic.GoodByeWorld(); > > } > > } > > > console session: > > (master) ? ir > > IronRuby 0.4.0.0 on .NET 2.0.50727.4918 > > Copyright (c) Microsoft Corporation. All rights reserved. > > > > >>> require 'spec/bin/ClrModels.dll' > > => true > > >>> include ClrModels > > => Object > > >>> MyClassWithAStatic > > => ClrModels::MyClassWithAStatic > > >>> MyClassWithAStatic.good_bye_world > > => 'Goodbye world!' > > >>> sc = StaticCaller.new > > => ClrModels.StaticCaller > > >>> sc.calls_static > > => 'Goodbye world!' > > >>> class MyClassWithAStatic > > ... def self.good_bye_world > > ... "From Ruby we say goodbye to you" > > ... end > > ... end > > => nil > > >>> MyClassWithAStatic.good_bye_world > > => "From Ruby we say goodbye to you" > > >>> sc = StaticCaller.new > > => ClrModels.StaticCaller > > >>> sc.calls_static > > => 'Goodbye world!' > > > > New session to figure out if something could be done before the type was > actually created > > > > + C:\dev\caricature > > (master) ? ir > > IronRuby 0.4.0.0 on .NET 2.0.50727.4918 > > Copyright (c) Microsoft Corporation. All rights reserved. > > > > >>> require 'spec/bin/ClrModels.dll' > > => true > > >>> class MyClassWithAStatic > > ... def self.good_bye_world > > ... "From Ruby we say goodbye to you" > > ... end > > ... end > > => nil > > >>> ClrModels::StaticCaller.new.calls_static > > => 'Goodbye world!' > > > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > Don Marquis - "Procrastination is the art of keeping up with yesterday." > > > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan at flanders.co.nz Wed May 13 17:27:49 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Wed, 13 May 2009 23:27:49 +0200 Subject: [Ironruby-core] more interop questions In-Reply-To: <710DF26F214D2B4BB94287123FFE980A2E1C2B0DB5@NA-EXMSG-C104.redmond.corp.microsoft.com> References: <0047ECBFA2E0DF4A834AA369282A5AFC06EFE63B@tk5ex14mbxc106.redmond.corp.microsoft.com> <710DF26F214D2B4BB94287123FFE980A2E1C2B0D26@NA-EXMSG-C104.redmond.corp.microsoft.com> <710DF26F214D2B4BB94287123FFE980A2E1C2B0DB5@NA-EXMSG-C104.redmond.corp.microsoft.com> Message-ID: I am sure glad I bought the IL assembler bible a couple of weeks ago. Thanks a lot for the links On Wed, May 13, 2009 at 11:00 PM, Shri Borde wrote: > The link you want is > http://msdn.microsoft.com/en-us/magazine/cc188743.aspx > > > > *From:* Shri Borde > *Sent:* Wednesday, May 13, 2009 1:58 PM > > *To:* ironruby-core at rubyforge.org > *Subject:* RE: [Ironruby-core] more interop questions > > > > If you really want to push the envelope that far, you can use the Profiling > APIs (http://msdn.microsoft.com/en-us/magazine/cc300553.aspx) to replace > the IL method bodies. That will work with signed assemblies, and you don?t > need to change any source code either. Its very powerful, but pretty > complicated as well. > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Ivan Porto Carrero > *Sent:* Wednesday, May 13, 2009 1:47 PM > > *To:* ironruby-core at rubyforge.org > *Subject:* Re: [Ironruby-core] more interop questions > > > > Well actually at this point I have progressed in searching for a way to > cheat. > > But I didn't find a way yet that will work with signed 3rd party signed > assemblies like say sharepoint. > > > > I can use Mono.Cecil to change some of the types to include AOP hooks so I > can inject ruby in them and get the expected result by just not calling the > real method body. That should work for everything that isn't signed. if the > signed assemblies aren't being referenced by anything else than your source > code then that will still work by recompiling the source code against the > new assemblies. > > > > I think that should get me pretty far in what I'm trying to achieve with > the mocker. > > I need to be able to intercept the method call, execute ruby and decide > whether or not to call the previous method. > > > > Then I'm only stuck on how to get around 3rd party signed assemblies with > keys that I don't have access to. > > > > In my case the expected result is when I'm working from ruby things should > behave like ruby. So if I monkey patch some method it should just replace > the thing also when C# calls it :) > > > > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > Vince Lombardi - "We didn't lose the game; we just ran out of time." > > On Wed, May 13, 2009 at 9:41 PM, Shri Borde > wrote: > > For the devil?s advocate position Ivan was arguing for, you could argue > that IronRuby should only allow **adding** new members to CLR types, not > to edit or delete existing CLR members. The added members would be visible > only from Ruby. From C#, you will get compiler errors anyway if you try to > call these added members (unless you use ?dynamic? in C# 4.0), and so having > two different views of the CLR type is OK here since there is no scope for > confusion. > > > > This would be somewhat similar to the way C# extension methods work ? the > real methods of the type get precedence, and extension methods (comparable > to monkey-patched Ruby methods) get lower precedence during overload > resolution. > > > > Building a special mocking framework for IronRuby does not change the basic > fact that CLR types are unmodifiable. A special framework will work only if > the app is all IronRuby code, but it will break when C# is thrown in the > mix. > > > > The current plan is to allow monkey-patching of CLR members on CLR types. > It does give power but has some unpredictability as well. Feedback and > real-world experience is welcome about whether this is the right thing or > not. > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Jimmy Schementi > *Sent:* Wednesday, May 13, 2009 10:03 AM > > > *To:* ironruby-core at rubyforge.org > *Subject:* Re: [Ironruby-core] more interop questions > > > > I want to re-emphasize and expand a bit on what Tomas said: *monkey-patching > .NET will only be visible from Ruby*. You could look at this as a *feature > *of IronRuby as it will never break .NET code. In reality, it?s a > limitation of the CLR which does not allow modification of types once they > are created. > > > > Ivan, this is exactly why a special mocking framework needs to be built for > IronRuby =) > > > > To make this a bit more concrete, here?s a simple example: > > > > class Foo { > > public int Bar() { > > return 42; > > } > > public void SayBar() { > > System.Console.WriteLine(Bar()); > > } > > } > > > > The SayBar() method is compiled to call the method Bar(). When this Ruby > code is executed: > > > > class Foo > > def Bar > > ?Monkey patched!? > > end > > end > > > > The .NET ?Foo? class is not changed, but a new type is created and the Ruby > method resolution knows to check this Ruby class first, then the ?Foo? .NET > type (I?m drastically overly-simplifying the way method lookup works, but > for this example it?ll do =P). So when Bar() is called from Ruby it will > give you the Ruby method: > > > > >>> Foo.new.Bar > > => ?Monkey Patched!? > > > > But the SayBar() method will always call the static version of Bar(), > because monkey-patching has no effect on the .NET view of the world. > > > > >>> Foo.new.SayBar > > 42 > > => nil > > > > The only way to truly modify the ?.NET-view? from Ruby is via > System.Reflection. Today C# code can only call into DLR code by using the > DLR Hosting API, though as Tomas mentioned that is improving in C#4. > > > > I?ll add this to the wiki, as I?m beginning to build up our .NET > integration documentation ? keep asking questions like this to make my life > easier =) > > > > ~Jimmy > > > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Tomas Matousek > *Sent:* Wednesday, May 13, 2009 9:37 AM > *To:* ironruby-core at rubyforge.org > *Subject:* Re: [Ironruby-core] more interop questions > > > > It?s pretty simple: your can define a Ruby method on any class/interface. > The method will only be visible from Ruby unless the class is a Ruby dynamic > object (implements IDynamicObjectProvider using Ruby binders). For such > dynamic objects Ruby methods will be available when invoked from dynamic > expression in C# 4.0. The methods are also invokable via ObjectOperations > class in Hosting API. > > > > Tomas > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Ivan Porto Carrero > *Sent:* Wednesday, May 13, 2009 9:20 AM > *To:* ironruby-core > *Subject:* Re: [Ironruby-core] more interop questions > > > > I know these sound like pretty basic questions.. but I'm playing devil's > advocate here (maybe rubyist advocate is better suited) and I imagine I will > need a good chunk in a chapter somewhere to explain this stuff really > clearly. > > > > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > On Wed, May 13, 2009 at 5:57 PM, Ivan Porto Carrero > wrote: > > Hi > > > > I got into a discussion with Roy Osherhove about overriding statics. > > > > I know in C# it can't be done obviously and as long as I stay in Ruby you > can. I understand this may seem like straight-forward stuff. Can you give me > a pointer where I can take stock of what I can and can't do to CLR objects > and in which cases ruby things apply? > > > > But when you go back and call it from a C# class it takes the CLR > implementation > > > > public class MyClassWithAStatic{ > > > > public string HelloWorld(){ > > return "Hello World!"; > > } > > > > public static string GoodByeWorld(){ > > return "Goodbye world!"; > > } > > } > > > > public class StaticCaller{ > > > > public string CallsStatic(){ > > return MyClassWithAStatic.GoodByeWorld(); > > } > > } > > > console session: > > (master) ? ir > > IronRuby 0.4.0.0 on .NET 2.0.50727.4918 > > Copyright (c) Microsoft Corporation. All rights reserved. > > > > >>> require 'spec/bin/ClrModels.dll' > > => true > > >>> include ClrModels > > => Object > > >>> MyClassWithAStatic > > => ClrModels::MyClassWithAStatic > > >>> MyClassWithAStatic.good_bye_world > > => 'Goodbye world!' > > >>> sc = StaticCaller.new > > => ClrModels.StaticCaller > > >>> sc.calls_static > > => 'Goodbye world!' > > >>> class MyClassWithAStatic > > ... def self.good_bye_world > > ... "From Ruby we say goodbye to you" > > ... end > > ... end > > => nil > > >>> MyClassWithAStatic.good_bye_world > > => "From Ruby we say goodbye to you" > > >>> sc = StaticCaller.new > > => ClrModels.StaticCaller > > >>> sc.calls_static > > => 'Goodbye world!' > > > > New session to figure out if something could be done before the type was > actually created > > > > + C:\dev\caricature > > (master) ? ir > > IronRuby 0.4.0.0 on .NET 2.0.50727.4918 > > Copyright (c) Microsoft Corporation. All rights reserved. > > > > >>> require 'spec/bin/ClrModels.dll' > > => true > > >>> class MyClassWithAStatic > > ... def self.good_bye_world > > ... "From Ruby we say goodbye to you" > > ... end > > ... end > > => nil > > >>> ClrModels::StaticCaller.new.calls_static > > => 'Goodbye world!' > > > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > Don Marquis - "Procrastination is the art of keeping up with yesterday." > > > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Thu May 14 12:29:54 2009 From: lists at ruby-forum.com (Merrell Reed) Date: Thu, 14 May 2009 18:29:54 +0200 Subject: [Ironruby-core] IronRuby and Cucumber - undefined method `bin_path' for In-Reply-To: References: Message-ID: <83396c81d8392315c945e38efe7c66d1@ruby-forum.com> I just copied the the bin_path code from C:\path\to\ruby\lib\ruby\site_ruby\1.8\rubygems.rb to \path\to\ironruby\libraries\lib\ruby\site_ruby\1.8\rubygems.rb and it works fine with cucumber but I am now getting some new errors with a frozen object being called. I have also fixed the problem with expand_path I removed Path and used a stack and parsed the path myself but I am a contributing noob and not sure really how to add this. But I was able to get rspec running with my .net code. I made a bat that calls spec (in ruby folder) mycode.rb using ironruby Matt Otto wrote: > Hello, > > I'm running into the following issue trying to run cucumber with the > latest iron ruby source from git: > c:/ruby/bin/cucumber:19: undefined method `bin_path' for Gem:Module > (NoMethodError) > > This occurs when running either icucumber --help or the i18n cucumber > sample. I've not tried any of the other examples. > > Yesterday morning I was able to get the scenarios in the i18n examples > to partially execute until they failed with > "Unable to cast from Func to BlockCallTargetN" and :0:in `concat': > can't modify frozen object (TypeError)". exceptions, but after > updating this morning I'm only seeing the undefined method exception. > > I'm currently sharing gems between MRI and Iron Ruby if that matters, > and am using the instructions found here for cucumber: > http://wiki.github.com/aslakhellesoy/cucumber/ironruby-and-net > > Does anyone have any ideas? Or should I file a bug for this on > CodePlex? Also if you need more information let me know. > > Thanks in advance, > Matt -- Posted via http://www.ruby-forum.com/. From Jimmy.Schementi at microsoft.com Thu May 14 13:01:29 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Thu, 14 May 2009 17:01:29 +0000 Subject: [Ironruby-core] IronRuby and Cucumber - undefined method `bin_path' for In-Reply-To: <83396c81d8392315c945e38efe7c66d1@ruby-forum.com> References: <83396c81d8392315c945e38efe7c66d1@ruby-forum.com> Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC06F0DC88@tk5ex14mbxc106.redmond.corp.microsoft.com> Thanks for reporting these issues. I'm well aware of these issues with running Cucumber, and am working on getting it running today. The "frozen object" issue is with optparse, and Shri already has a fix for it. I'll get the instructions updated on the cucumber wiki to run it with IronRuby. Merrell, if you have a fix to expand_path, please commit/push it to your fork of IronRuby and send a link to the commit + some description to this list. More detailed instructions are here: http://wiki.github.com/ironruby/ironruby/contributing. ~js > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > bounces at rubyforge.org] On Behalf Of Merrell Reed > Sent: Thursday, May 14, 2009 9:30 AM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] IronRuby and Cucumber - undefined method > `bin_path' for > > I just copied the the bin_path code from > C:\path\to\ruby\lib\ruby\site_ruby\1.8\rubygems.rb to > \path\to\ironruby\libraries\lib\ruby\site_ruby\1.8\rubygems.rb and it > works fine with cucumber but I am now getting some new errors with a > frozen object being called. > > I have also fixed the problem with expand_path I removed Path and used > a > stack and parsed the path myself but I am a contributing noob and not > sure really how to add this. > > But I was able to get rspec running with my .net code. I made a bat > that > calls spec (in ruby folder) mycode.rb using ironruby > > > Matt Otto wrote: > > Hello, > > > > I'm running into the following issue trying to run cucumber with the > > latest iron ruby source from git: > > c:/ruby/bin/cucumber:19: undefined method `bin_path' for Gem:Module > > (NoMethodError) > > > > This occurs when running either icucumber --help or the i18n cucumber > > sample. I've not tried any of the other examples. > > > > Yesterday morning I was able to get the scenarios in the i18n > examples > > to partially execute until they failed with > > "Unable to cast from Func to BlockCallTargetN" and :0:in `concat': > > can't modify frozen object (TypeError)". exceptions, but after > > updating this morning I'm only seeing the undefined method exception. > > > > I'm currently sharing gems between MRI and Iron Ruby if that matters, > > and am using the instructions found here for cucumber: > > http://wiki.github.com/aslakhellesoy/cucumber/ironruby-and-net > > > > Does anyone have any ideas? Or should I file a bug for this on > > CodePlex? Also if you need more information let me know. > > > > Thanks in advance, > > Matt > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core From ivan at flanders.co.nz Thu May 14 15:23:16 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Thu, 14 May 2009 21:23:16 +0200 Subject: [Ironruby-core] aaah yes ... clr interop Message-ID: I'm sorry I'll probably keep hitting all those points while I'm writing integration specs. Ok so would it be possible to have a way to configure the underlying type which methods it needs to redefine with a new operator public class SomeClass{ public void MyMethod(){ } } public class Inheritor : SomeClass { public new void MyMethod(){ //some new logic here } } something like class Inheritor < SomeClass redef_method :my_method end -- --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) -------------- next part -------------- An HTML attachment was scrubbed... URL: From curth at microsoft.com Thu May 14 16:31:53 2009 From: curth at microsoft.com (Curt Hagenlocher) Date: Thu, 14 May 2009 13:31:53 -0700 Subject: [Ironruby-core] aaah yes ... clr interop In-Reply-To: References: Message-ID: In principle, this is absolutely something that could be done (though I wouldn?t expect we would do it any time soon). *but*, this doesn?t do what I think you want. Previously-compiled calls to SomeClass.MyMethod won?t actually end up going to Inheritor.MyMethod even if the object is of type Inheritor. The base method would have to be defined as ?virtual?, or the new method will end up in a new slot on the method table. From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Thursday, May 14, 2009 12:23 PM To: ironruby-core Subject: [Ironruby-core] aaah yes ... clr interop I'm sorry I'll probably keep hitting all those points while I'm writing integration specs. Ok so would it be possible to have a way to configure the underlying type which methods it needs to redefine with a new operator public class SomeClass{ public void MyMethod(){ } } public class Inheritor : SomeClass { public new void MyMethod(){ //some new logic here } } something like class Inheritor < SomeClass redef_method :my_method end -- --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan at flanders.co.nz Thu May 14 16:41:43 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Thu, 14 May 2009 22:41:43 +0200 Subject: [Ironruby-core] aaah yes ... clr interop In-Reply-To: References: Message-ID: ok... makes sense. I'll add it to the distant future features list :)And if it doesn't actually really invoke the method on the Inheritor then the redefine_method probably doesn't make much sense to implement. On Thu, May 14, 2009 at 10:31 PM, Curt Hagenlocher wrote: > In principle, this is absolutely something that could be done (though I > wouldn?t expect we would do it any time soon). > > > > **but**, this doesn?t do what I think you want. Previously-compiled calls > to SomeClass.MyMethod won?t actually end up going to Inheritor.MyMethod even > if the object is of type Inheritor. The base method would have to be defined > as ?virtual?, or the new method will end up in a new slot on the method > table. > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Ivan Porto Carrero > *Sent:* Thursday, May 14, 2009 12:23 PM > *To:* ironruby-core > *Subject:* [Ironruby-core] aaah yes ... clr interop > > > > I'm sorry I'll probably keep hitting all those points while I'm writing > integration specs. > > > > Ok so would it be possible to have a way to configure the underlying type > which methods it needs to redefine with a new operator > > > > public class SomeClass{ > > public void MyMethod(){ > > } > > } > > > > public class Inheritor : SomeClass { > > public new void MyMethod(){ > > //some new logic here > > } > > } > > > > something like > > > > class Inheritor < SomeClass > > > > redef_method :my_method > > > > end > > > > > > > -- > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > -- --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero GSM: +32.486.787.582 Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Yogi Berra - "If you ask me anything I don't know, I'm not going to answer." -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Thu May 14 17:51:30 2009 From: lists at ruby-forum.com (Huw Collingbourne) Date: Thu, 14 May 2009 23:51:30 +0200 Subject: [Ironruby-core] [OT] Interesting DLR links ? In-Reply-To: <4a68b8cf0905141314k2c36a85aw3e9ecd4040a20b74@mail.gmail.com> References: <4a68b8cf0905132308g4b2f5e73j13c69bba4fceb25d@mail.gmail.com> <4a68b8cf0905141314k2c36a85aw3e9ecd4040a20b74@mail.gmail.com> Message-ID: <9032ba89b7a5853e1d4534f6b33e64a3@ruby-forum.com> http://www.bitwisemag.com/2/Building-your-own-Language-without,175 http://www.bitwisemag.com/2/DLR-Build-Your-Own-Language http://www.bitwisemag.com/2/Building-your-own-Language-without http://www.bitwisemag.com/2/DLR-Build-Your-Own-Language-part-3 The above is a series of articles by Dermot Hogan, chief architecht of the Visual Studio Ruby In Steel IDE and the IronRuby In Steel IDE. best wishes Huw Collingbourne SapphireSteel Software http://www.sapphiresteel.com -- Posted via http://www.ruby-forum.com/. From ivan at flanders.co.nz Thu May 14 18:54:33 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Fri, 15 May 2009 00:54:33 +0200 Subject: [Ironruby-core] mocking with ironruby Message-ID: Caricature is ready to make it's first steps into the world. It works with the null object pattern and for CLR interop. I still need to do statics for ruby objects etc. but for instance methods etc it should be fine. So if anybody wants to have a play feel free :) --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) -------------- next part -------------- An HTML attachment was scrubbed... URL: From pascal.normandin at convergentware.com Fri May 15 00:04:52 2009 From: pascal.normandin at convergentware.com (Pascal Normandin) Date: Fri, 15 May 2009 00:04:52 -0400 Subject: [Ironruby-core] Thread priority In-Reply-To: References: <5602f055f15a6d2c748744793e6b0681@ruby-forum.com> Message-ID: <001201c9d512$4ca74cd0$e5f5e670$%normandin@convergentware.com> Hello, I?ve looked into this and it is pretty easy to implement. But I have a question before I send any modification. The Clr Thread works with 5 levels (Lowest, BelowNormal, Normal, AboveNormal and Highest) but based on the ruby doc a ruby thread works with an integer for priority. So I?ve decided to go with the following mapping Lowest <= -2 BelowNormal == -1 Normal == 0 AboveNormal ==1 Highestvalues >= 2 Is that correct ? Excuse me if that?s too basic but I?m pretty new to Ruby and even newer to IronRuby. Thanks; Pascal From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Tomas Matousek Sent: May-12-09 12:56 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Thread priority Thread#priority attribute is not implemented yet, that?s why the CLR property is picked up. It should be easy to implement it. Any volunteer? Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Tuesday, May 12, 2009 5:41 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Thread priority You can just use the enum from ironruby System::Threading::ThreadPriority.normal --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Emma Goldman - "If voting changed anything, they'd make it illegal." On Tue, May 12, 2009 at 1:59 PM, Shay Friedman wrote: Hi there, Ruby allows to set the thread priority using the priority= method: Thread.new do Thread.current.priority = -1 ... blah blah blah ... end This is not available in IronRuby because priority maps to the System.Threading.Thread priority property which looks for the ThreadPriority enum. Is it going to change or is this the right behavior for IronRuby? Thanks, Shay. -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Fri May 15 11:20:22 2009 From: lists at ruby-forum.com (Shay Friedman) Date: Fri, 15 May 2009 17:20:22 +0200 Subject: [Ironruby-core] Code Review: Fix for File.print misbehavior Message-ID: Commit Description: Using the File.print method after the global input record separator had been changed generated a different output than the MRI. For example, consider the next code block: $\ = ">>" file = File.open("a.txt","w") file.print "One ", 1, ", Two ", 2 file.close Output file on MRI: One 1, Two 2>> Output file on IronRuby: One >>1>>, Two >>2>> This commit fixes this behavior. Commit site: http://github.com/shayfriedman/ironruby/commit/0ccacf09b53c231f21851391d616b0fa53026197 Files changed: Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/IoOps.cs Thanks, Shay. -- Posted via http://www.ruby-forum.com/. From Shri.Borde at microsoft.com Fri May 15 13:06:07 2009 From: Shri.Borde at microsoft.com (Shri Borde) Date: Fri, 15 May 2009 10:06:07 -0700 Subject: [Ironruby-core] Code Review: Fix for File.print misbehavior In-Reply-To: References: Message-ID: <710DF26F214D2B4BB94287123FFE980A2E1C3C27E4@NA-EXMSG-C104.redmond.corp.microsoft.com> Thanks for the first patch, Shay! Couple of questions and comments. Have you signed the contributor agreement mentioned at the top of http://wiki.github.com/ironruby/ironruby/contributing? Please see http://wiki.github.com/ironruby/ironruby/modifying-the-sources for coding conventions. Opening braces should go on the same line as the "if" statement. You should make sure that there is a RubySpec spec for your fixes. In this case, there should be a spec in Merlin\External.LCA_RESTRICTED\Languages\IronRuby\mspec\rubyspec\core\io\print_spec.rb. It does look like the example "writes each obj.to_s to the stream and appends $\\ (if any) given multiple objects" corresponds to your fix. If there is an existing spec, you should delete the corresponding tag from Merlin\External.LCA_RESTRICTED\Languages\IronRuby\mspec\ironruby-tags\core\io\print_tags.txt. Please delete the print_tags.txt file since there are not more tags left in that file. You did run irtests.bat, right? There are currently 5 known failures from run.bat and 19 from the RubySpec specs (all of which should go away with the next push from Microsoft TFS to GIT). Thanks again! Shri -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shay Friedman Sent: Friday, May 15, 2009 8:20 AM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] Code Review: Fix for File.print misbehavior Commit Description: Using the File.print method after the global input record separator had been changed generated a different output than the MRI. For example, consider the next code block: $\ = ">>" file = File.open("a.txt","w") file.print "One ", 1, ", Two ", 2 file.close Output file on MRI: One 1, Two 2>> Output file on IronRuby: One >>1>>, Two >>2>> This commit fixes this behavior. Commit site: http://github.com/shayfriedman/ironruby/commit/0ccacf09b53c231f21851391d616b0fa53026197 Files changed: Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/IoOps.cs Thanks, Shay. -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From jdeville at microsoft.com Fri May 15 16:00:22 2009 From: jdeville at microsoft.com (Jim Deville) Date: Fri, 15 May 2009 20:00:22 +0000 Subject: [Ironruby-core] Code Review: Fix for File.print misbehavior Message-ID: Shay has signed the agreement JD ....there is no try Sent from my phone. Please excuse typos and txtspk. -----Original Message----- From: Shri Borde Sent: May 15, 2009 11:49 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Code Review: Fix for File.print misbehavior Thanks for the first patch, Shay! Couple of questions and comments. Have you signed the contributor agreement mentioned at the top of http://wiki.github.com/ironruby/ironruby/contributing? Please see http://wiki.github.com/ironruby/ironruby/modifying-the-sources for coding conventions. Opening braces should go on the same line as the "if" statement. You should make sure that there is a RubySpec spec for your fixes. In this case, there should be a spec in Merlin\External.LCA_RESTRICTED\Languages\IronRuby\mspec\rubyspec\core\io\print_spec.rb. It does look like the example "writes each obj.to_s to the stream and appends $\\ (if any) given multiple objects" corresponds to your fix. If there is an existing spec, you should delete the corresponding tag from Merlin\External.LCA_RESTRICTED\Languages\IronRuby\mspec\ironruby-tags\core\io\print_tags.txt. Please delete the print_tags.txt file since there are not more tags left in that file. You did run irtests.bat, right? There are currently 5 known failures from run.bat and 19 from the RubySpec specs (all of which should go away with the next push from Microsoft TFS to GIT). Thanks again! Shri -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shay Friedman Sent: Friday, May 15, 2009 8:20 AM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] Code Review: Fix for File.print misbehavior Commit Description: Using the File.print method after the global input record separator had been changed generated a different output than the MRI. For example, consider the next code block: $\ = ">>" file = File.open("a.txt","w") file.print "One ", 1, ", Two ", 2 file.close Output file on MRI: One 1, Two 2>> Output file on IronRuby: One >>1>>, Two >>2>> This commit fixes this behavior. Commit site: http://github.com/shayfriedman/ironruby/commit/0ccacf09b53c231f21851391d616b0fa53026197 Files changed: Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/IoOps.cs Thanks, Shay. -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From lists at ruby-forum.com Sat May 16 01:50:41 2009 From: lists at ruby-forum.com (Shay Friedman) Date: Sat, 16 May 2009 07:50:41 +0200 Subject: [Ironruby-core] Code Review: Fix for File.print misbehavior In-Reply-To: <710DF26F214D2B4BB94287123FFE980A2E1C3C27E4@NA-EXMSG-C104.redmond.corp.microsoft.com> References: <710DF26F214D2B4BB94287123FFE980A2E1C3C27E4@NA-EXMSG-C104.redmond.corp.microsoft.com> Message-ID: Hi Shri, Regarding the contributor agreement - yes, I've signed that (Jim Deville helped me with that). Regarding the coding conventions - I didn't notice the "modifying the sources" page, sorrry for that... I would pay attention to that next time. About RubySpec - "writes each obj.to_s to the stream and appends $\\ (if any) given multiple objects" really seems like the corresponding test to my fix. What are the tags for? The test mentioned on print_tags.txt should also pass after this commit. About irtests - I ran it. I saw the 5 failures from run.bat but I couldn't find the place where the RubySpec specs failures were presented. What am I doing wrong? Thanks! Shay. -- Posted via http://www.ruby-forum.com/. From Shri.Borde at microsoft.com Sat May 16 02:30:00 2009 From: Shri.Borde at microsoft.com (Shri Borde) Date: Fri, 15 May 2009 23:30:00 -0700 Subject: [Ironruby-core] Code Review: Fix for File.print misbehavior In-Reply-To: References: <710DF26F214D2B4BB94287123FFE980A2E1C3C27E4@NA-EXMSG-C104.redmond.corp.microsoft.com> Message-ID: <710DF26F214D2B4BB94287123FFE980A2E1C3C2A83@NA-EXMSG-C104.redmond.corp.microsoft.com> "writes each obj.to_s to the stream and appends $\\ (if any) given multiple objects" does not have a tag for it. If it did, it would be in Merlin\External.LCA_RESTRICTED\Languages\IronRuby\mspec\ironruby-tags\core\io\print_tags.txt, but that file only has a tag for "writes $_.to_s followed by $\ (if any) to the stream if no arguments given". I incorrectly thought that these were the same test name, but clearly they are not. It's a mystery how "writes each obj.to_s to the stream and appends $\\ (if any) given multiple objects" works, but your example below fails. Could you could step into IoOps.Print for this test without your fix and see how it works? Else, I can try it next week. Shri -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shay Friedman Sent: Friday, May 15, 2009 10:51 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Code Review: Fix for File.print misbehavior Hi Shri, Regarding the contributor agreement - yes, I've signed that (Jim Deville helped me with that). Regarding the coding conventions - I didn't notice the "modifying the sources" page, sorrry for that... I would pay attention to that next time. About RubySpec - "writes each obj.to_s to the stream and appends $\\ (if any) given multiple objects" really seems like the corresponding test to my fix. What are the tags for? The test mentioned on print_tags.txt should also pass after this commit. About irtests - I ran it. I saw the 5 failures from run.bat but I couldn't find the place where the RubySpec specs failures were presented. What am I doing wrong? Thanks! Shay. -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From lists at ruby-forum.com Sat May 16 03:45:34 2009 From: lists at ruby-forum.com (Shay Friedman) Date: Sat, 16 May 2009 09:45:34 +0200 Subject: [Ironruby-core] Code Review: Fix for File.print misbehavior In-Reply-To: <710DF26F214D2B4BB94287123FFE980A2E1C3C2A83@NA-EXMSG-C104.redmond.corp.microsoft.com> References: <710DF26F214D2B4BB94287123FFE980A2E1C3C27E4@NA-EXMSG-C104.redmond.corp.microsoft.com> <710DF26F214D2B4BB94287123FFE980A2E1C3C2A83@NA-EXMSG-C104.redmond.corp.microsoft.com> Message-ID: <6d3433b03a9e0ecfa905ff541745a86d@ruby-forum.com> I couldn't follow the code exactly but what I did find, was that this test never reached the code inside IOOps.Print. The behavior is really strange, I tried to print the value on the screen and the value were really incorrect (the $\ delimiter is added after each argument) but the $stdout.print call inside the lambda expression got it correctly... I did that: it "writes each obj.to_s to the stream and appends $\\ (if any) given multiple objects" do o, o2 = Object.new, Object.new def o.to_s(); 'o'; end def o2.to_s(); 'o2'; end puts $stdout.print(o, o2) lambda { $stdout.print(o, o2) }.should output("#{o.to_s}#{o2.to_s}#{$\}") end And it wrote "o->o2->nil" on the screen... But when I changed the output it to "123" the test failed and told me: Expected: $stdout: "123" got: $stdout: "oo2->" So I'm really confused... like I said, my breakpoint inside the print method never gets hit so I can't really tell which "print" method is invoked... Shay. -- Posted via http://www.ruby-forum.com/. From jdeville at microsoft.com Sat May 16 04:34:20 2009 From: jdeville at microsoft.com (Jim Deville) Date: Sat, 16 May 2009 08:34:20 +0000 Subject: [Ironruby-core] Thread priority In-Reply-To: <001201c9d512$4ca74cd0$e5f5e670$%normandin@convergentware.com> References: <5602f055f15a6d2c748744793e6b0681@ruby-forum.com> <001201c9d512$4ca74cd0$e5f5e670$%normandin@convergentware.com> Message-ID: That looks good to me. Will you be able to do relative priorities < -2 and > 2? Also, have we received a contribution agreement from you yet? Thanks, JD ?there is no try From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Pascal Normandin Sent: Thursday, May 14, 2009 9:05 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Thread priority Hello, I?ve looked into this and it is pretty easy to implement. But I have a question before I send any modification. The Clr Thread works with 5 levels (Lowest, BelowNormal, Normal, AboveNormal and Highest) but based on the ruby doc a ruby thread works with an integer for priority. So I?ve decided to go with the following mapping Lowest <= -2 BelowNormal == -1 Normal == 0 AboveNormal ==1 Highestvalues >= 2 Is that correct ? Excuse me if that?s too basic but I?m pretty new to Ruby and even newer to IronRuby. Thanks; Pascal From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Tomas Matousek Sent: May-12-09 12:56 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Thread priority Thread#priority attribute is not implemented yet, that?s why the CLR property is picked up. It should be easy to implement it. Any volunteer? Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Tuesday, May 12, 2009 5:41 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Thread priority You can just use the enum from ironruby System::Threading::ThreadPriority.normal --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Emma Goldman - "If voting changed anything, they'd make it illegal." On Tue, May 12, 2009 at 1:59 PM, Shay Friedman > wrote: Hi there, Ruby allows to set the thread priority using the priority= method: Thread.new do Thread.current.priority = -1 ... blah blah blah ... end This is not available in IronRuby because priority maps to the System.Threading.Thread priority property which looks for the ThreadPriority enum. Is it going to change or is this the right behavior for IronRuby? Thanks, Shay. -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan at flanders.co.nz Sat May 16 04:37:54 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Sat, 16 May 2009 10:37:54 +0200 Subject: [Ironruby-core] broken again on mono Message-ID: Hi IronRuby is broken again on mono. It throws NullReference Exceptions for a lot of operations. It also complains about something not being bound to $exception Just indicating this in case somebody wants to pick it up. There is only 1 change required in the context.rb file to make it build on mono. on line 378 in context.rb change source = project_root + "Config\\Unsigned\\app.config" to source = project_root + "Config/Unsigned/app.config" and some command output +ivan at ivan-mbp:~ ? iirb :0:in `require': unbound variable: $exception (TypeError) from /Users/ivan/bin/iirb:10 +ivan at ivan-mbp:~ ? igem list :0:in `<=>': Object reference not set to an instance of an object (System::NullReferenceException) from /Users/ivan/lib/ruby/site_ruby/1.8/rubygems/version.rb:123:in `<=>' from /Users/ivan/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:25 from IronRuby.Libraries:0:in `Compare' from :0:in `>' from mscorlib:0:in `CallSite.Target' from /Users/ivan/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:129:in `satisfy?' from :0:in `[]' from mscorlib:0:in `CallSite.Target' from /Users/ivan/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:122:in `satisfied_by?' from /Users/ivan/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:122:in `satisfied_by?' from IronRuby.Libraries:0:in `<>m__3' from :0:in `each' from mscorlib:0:in `CallSite.Target' from IronRuby.Libraries:0:in `Each' from IronRuby.Libraries:0:in `TrueForItems' from :0:in `all?' from mscorlib:0:in `CallSite.Target' from /Users/ivan/bin/igem:14 -- --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdeville at microsoft.com Sat May 16 04:39:05 2009 From: jdeville at microsoft.com (Jim Deville) Date: Sat, 16 May 2009 08:39:05 +0000 Subject: [Ironruby-core] mocking with ironruby In-Reply-To: References: Message-ID: I?m assuming I can find this on your Github? JD ?there is no try From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Thursday, May 14, 2009 3:55 PM To: ironruby-core Subject: [Ironruby-core] mocking with ironruby Caricature is ready to make it's first steps into the world. It works with the null object pattern and for CLR interop. I still need to do statics for ruby objects etc. but for instance methods etc it should be fine. So if anybody wants to have a play feel free :) --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan at flanders.co.nz Sat May 16 05:14:32 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Sat, 16 May 2009 11:14:32 +0200 Subject: [Ironruby-core] mocking with ironruby In-Reply-To: References: Message-ID: Yep http://github.com/casualjim/caricature On Sat, May 16, 2009 at 10:39 AM, Jim Deville wrote: > I?m assuming I can find this on your Github? > > > > JD > > > > ?there is no try > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Ivan Porto Carrero > *Sent:* Thursday, May 14, 2009 3:55 PM > *To:* ironruby-core > *Subject:* [Ironruby-core] mocking with ironruby > > > > Caricature is ready to make it's first steps into the world. > > > > It works with the null object pattern and for CLR interop. I still need to > do statics for ruby objects etc. but for instance methods etc it should be > fine. > > So if anybody wants to have a play feel free :) > > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > -- --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero GSM: +32.486.787.582 Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Vince Lombardi - "We didn't lose the game; we just ran out of time." -------------- next part -------------- An HTML attachment was scrubbed... URL: From pascal.normandin at convergentware.com Sat May 16 10:54:32 2009 From: pascal.normandin at convergentware.com (Pascal Normandin) Date: Sat, 16 May 2009 10:54:32 -0400 Subject: [Ironruby-core] Thread priority In-Reply-To: References: <5602f055f15a6d2c748744793e6b0681@ruby-forum.com> <001201c9d512$4ca74cd0$e5f5e670$%normandin@convergentware.com> Message-ID: <002901c9d636$38d597f0$aa80c7d0$%normandin@convergentware.com> Hello, I?ve send an email to ssiadmin today ? just waiting for the followup. Regarding the thread priority at this time anything lower to -2 will be mapped to Clr thread priority Lowest and anything above 2 will be mapped to Highest. So something like this could happen thr.priority=1000 puts thr.priority #=> 2 So even if you set 1000 the next time you check this value it will be 2 as 1000 is mapped to Highest Is that acceptable ? I guess best way of implementing this to be closer to the ruby spec would be to keep a priority variable in the Thread objet and then adjust the Clr priority based on all the threads that are currently running. i.e. if we have the following threads running with the following priorities T1 = P10 T2 = P20 T3 = P30 T4 = P40 T5 = P50 Then we readjust the Clr priorities to Lowest == 10 BelowNormal == 20 Normal == 30 AboveNormal == 40 Highest == 50 And if there is more than 5 priorities some would need to be regrouped together. Doing that will require some dynamic compilation of thread priorities and add a little overhead ? Anyways that may not be necessary, what do you think ? Pascal From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Jim Deville Sent: May-16-09 4:34 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Thread priority That looks good to me. Will you be able to do relative priorities < -2 and > 2? Also, have we received a contribution agreement from you yet? Thanks, JD ?there is no try From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Pascal Normandin Sent: Thursday, May 14, 2009 9:05 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Thread priority Hello, I?ve looked into this and it is pretty easy to implement. But I have a question before I send any modification. The Clr Thread works with 5 levels (Lowest, BelowNormal, Normal, AboveNormal and Highest) but based on the ruby doc a ruby thread works with an integer for priority. So I?ve decided to go with the following mapping Lowest <= -2 BelowNormal == -1 Normal == 0 AboveNormal ==1 Highestvalues >= 2 Is that correct ? Excuse me if that?s too basic but I?m pretty new to Ruby and even newer to IronRuby. Thanks; Pascal From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Tomas Matousek Sent: May-12-09 12:56 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Thread priority Thread#priority attribute is not implemented yet, that?s why the CLR property is picked up. It should be easy to implement it. Any volunteer? Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Tuesday, May 12, 2009 5:41 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Thread priority You can just use the enum from ironruby System::Threading::ThreadPriority.normal --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Emma Goldman - "If voting changed anything, they'd make it illegal." On Tue, May 12, 2009 at 1:59 PM, Shay Friedman wrote: Hi there, Ruby allows to set the thread priority using the priority= method: Thread.new do Thread.current.priority = -1 ... blah blah blah ... end This is not available in IronRuby because priority maps to the System.Threading.Thread priority property which looks for the ThreadPriority enum. Is it going to change or is this the right behavior for IronRuby? Thanks, Shay. -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core -------------- next part -------------- An HTML attachment was scrubbed... URL: From Shri.Borde at microsoft.com Sat May 16 18:01:03 2009 From: Shri.Borde at microsoft.com (Shri Borde) Date: Sat, 16 May 2009 15:01:03 -0700 Subject: [Ironruby-core] Code Review: Fix for File.print misbehavior In-Reply-To: <6d3433b03a9e0ecfa905ff541745a86d@ruby-forum.com> References: <710DF26F214D2B4BB94287123FFE980A2E1C3C27E4@NA-EXMSG-C104.redmond.corp.microsoft.com> <710DF26F214D2B4BB94287123FFE980A2E1C3C2A83@NA-EXMSG-C104.redmond.corp.microsoft.com> <6d3433b03a9e0ecfa905ff541745a86d@ruby-forum.com> Message-ID: <710DF26F214D2B4BB94287123FFE980A2E1C3C2AAA@NA-EXMSG-C104.redmond.corp.microsoft.com> The problem is because of mspec itself. In External.LCA_RESTRICTED\Languages\IronRuby\mspec\mspec\lib\mspec\matchers\output.rb, the code sets $stdout to a helper class (IOStub) so that it can capture the output. However, what this means is that calls to $stdout.print that the test makes now go to IOStub#print rather than to the real implementation of IO#print, and this masks the bug. A better solution would be to use StringIO in matchers\output.rb rather than IOStub. If you are included to pursue this (which would be great), you could try the change and/or send email to http://groups.google.com/group/rubyspec to discuss the change. However, since this is a preexisting issue, you could leave it for another day if you want. So consider your change code-reviewed, and you can chose separately to pursue (or not) the issue with matchers\output.rb. -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shay Friedman Sent: Saturday, May 16, 2009 12:46 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Code Review: Fix for File.print misbehavior I couldn't follow the code exactly but what I did find, was that this test never reached the code inside IOOps.Print. The behavior is really strange, I tried to print the value on the screen and the value were really incorrect (the $\ delimiter is added after each argument) but the $stdout.print call inside the lambda expression got it correctly... I did that: it "writes each obj.to_s to the stream and appends $\\ (if any) given multiple objects" do o, o2 = Object.new, Object.new def o.to_s(); 'o'; end def o2.to_s(); 'o2'; end puts $stdout.print(o, o2) lambda { $stdout.print(o, o2) }.should output("#{o.to_s}#{o2.to_s}#{$\}") end And it wrote "o->o2->nil" on the screen... But when I changed the output it to "123" the test failed and told me: Expected: $stdout: "123" got: $stdout: "oo2->" So I'm really confused... like I said, my breakpoint inside the print method never gets hit so I can't really tell which "print" method is invoked... Shay. -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From jdeville at microsoft.com Sat May 16 19:05:58 2009 From: jdeville at microsoft.com (Jim Deville) Date: Sat, 16 May 2009 23:05:58 +0000 Subject: [Ironruby-core] Code Review: Fix for File.print misbehavior Message-ID: I would be opposed to making the MSpec runner depend on any more stdlibs. I would suggest making a helper that swaps the IOStub with the real stdout for the duration of a block. JD ....there is no try Sent from my phone. Please excuse typos and txtspk. -----Original Message----- From: Shri Borde Sent: May 16, 2009 3:11 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Code Review: Fix for File.print misbehavior The problem is because of mspec itself. In External.LCA_RESTRICTED\Languages\IronRuby\mspec\mspec\lib\mspec\matchers\output.rb, the code sets $stdout to a helper class (IOStub) so that it can capture the output. However, what this means is that calls to $stdout.print that the test makes now go to IOStub#print rather than to the real implementation of IO#print, and this masks the bug. A better solution would be to use StringIO in matchers\output.rb rather than IOStub. If you are included to pursue this (which would be great), you could try the change and/or send email to http://groups.google.com/group/rubyspec to discuss the change. However, since this is a preexisting issue, you could leave it for another day if you want. So consider your change code-reviewed, and you can chose separately to pursue (or not) the issue with matchers\output.rb. -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shay Friedman Sent: Saturday, May 16, 2009 12:46 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Code Review: Fix for File.print misbehavior I couldn't follow the code exactly but what I did find, was that this test never reached the code inside IOOps.Print. The behavior is really strange, I tried to print the value on the screen and the value were really incorrect (the $\ delimiter is added after each argument) but the $stdout.print call inside the lambda expression got it correctly... I did that: it "writes each obj.to_s to the stream and appends $\\ (if any) given multiple objects" do o, o2 = Object.new, Object.new def o.to_s(); 'o'; end def o2.to_s(); 'o2'; end puts $stdout.print(o, o2) lambda { $stdout.print(o, o2) }.should output("#{o.to_s}#{o2.to_s}#{$\}") end And it wrote "o->o2->nil" on the screen... But when I changed the output it to "123" the test failed and told me: Expected: $stdout: "123" got: $stdout: "oo2->" So I'm really confused... like I said, my breakpoint inside the print method never gets hit so I can't really tell which "print" method is invoked... Shay. -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From jdeville at microsoft.com Sat May 16 20:40:39 2009 From: jdeville at microsoft.com (Jim Deville) Date: Sun, 17 May 2009 00:40:39 +0000 Subject: [Ironruby-core] broken again on mono In-Reply-To: References: Message-ID: Thanks for the heads up, I?ll apply this fix. JD ?there is no try From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Saturday, May 16, 2009 1:38 AM To: ironruby-core Subject: [Ironruby-core] broken again on mono Hi IronRuby is broken again on mono. It throws NullReference Exceptions for a lot of operations. It also complains about something not being bound to $exception Just indicating this in case somebody wants to pick it up. There is only 1 change required in the context.rb file to make it build on mono. on line 378 in context.rb change source = project_root + "Config\\Unsigned\\app.config" to source = project_root + "Config/Unsigned/app.config" and some command output +ivan at ivan-mbp:~ ? iirb :0:in `require': unbound variable: $exception (TypeError) from /Users/ivan/bin/iirb:10 +ivan at ivan-mbp:~ ? igem list :0:in `<=>': Object reference not set to an instance of an object (System::NullReferenceException) from /Users/ivan/lib/ruby/site_ruby/1.8/rubygems/version.rb:123:in `<=>' from /Users/ivan/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:25 from IronRuby.Libraries:0:in `Compare' from :0:in `>' from mscorlib:0:in `CallSite.Target' from /Users/ivan/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:129:in `satisfy?' from :0:in `[]' from mscorlib:0:in `CallSite.Target' from /Users/ivan/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:122:in `satisfied_by?' from /Users/ivan/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:122:in `satisfied_by?' from IronRuby.Libraries:0:in `<>m__3' from :0:in `each' from mscorlib:0:in `CallSite.Target' from IronRuby.Libraries:0:in `Each' from IronRuby.Libraries:0:in `TrueForItems' from :0:in `all?' from mscorlib:0:in `CallSite.Target' from /Users/ivan/bin/igem:14 -- --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdeville at microsoft.com Sat May 16 21:16:57 2009 From: jdeville at microsoft.com (Jim Deville) Date: Sun, 17 May 2009 01:16:57 +0000 Subject: [Ironruby-core] Thread priority In-Reply-To: <002901c9d636$38d597f0$aa80c7d0$%normandin@convergentware.com> References: <5602f055f15a6d2c748744793e6b0681@ruby-forum.com> <001201c9d512$4ca74cd0$e5f5e670$%normandin@convergentware.com> <002901c9d636$38d597f0$aa80c7d0$%normandin@convergentware.com> Message-ID: If ssiadmin doesn?t get to you by Monday, ping me and I?ll follow up with them. Threading on IronRuby is already different from threading on MRI due to the native threads, so we have to forge some paths that others don?t. In this case, after talking to Charles Nutter, JRuby does what you describe. Knowing that, I think we should go with your first (basic mapping) plan unless Shri or Tomas have any objections. JD ?there is no try From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Pascal Normandin Sent: Saturday, May 16, 2009 7:55 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Thread priority Hello, I?ve send an email to ssiadmin today ? just waiting for the followup. Regarding the thread priority at this time anything lower to -2 will be mapped to Clr thread priority Lowest and anything above 2 will be mapped to Highest. So something like this could happen thr.priority=1000 puts thr.priority #=> 2 So even if you set 1000 the next time you check this value it will be 2 as 1000 is mapped to Highest Is that acceptable ? I guess best way of implementing this to be closer to the ruby spec would be to keep a priority variable in the Thread objet and then adjust the Clr priority based on all the threads that are currently running. i.e. if we have the following threads running with the following priorities T1 = P10 T2 = P20 T3 = P30 T4 = P40 T5 = P50 Then we readjust the Clr priorities to Lowest == 10 BelowNormal == 20 Normal == 30 AboveNormal == 40 Highest == 50 And if there is more than 5 priorities some would need to be regrouped together. Doing that will require some dynamic compilation of thread priorities and add a little overhead ? Anyways that may not be necessary, what do you think ? Pascal From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Jim Deville Sent: May-16-09 4:34 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Thread priority That looks good to me. Will you be able to do relative priorities < -2 and > 2? Also, have we received a contribution agreement from you yet? Thanks, JD ?there is no try From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Pascal Normandin Sent: Thursday, May 14, 2009 9:05 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Thread priority Hello, I?ve looked into this and it is pretty easy to implement. But I have a question before I send any modification. The Clr Thread works with 5 levels (Lowest, BelowNormal, Normal, AboveNormal and Highest) but based on the ruby doc a ruby thread works with an integer for priority. So I?ve decided to go with the following mapping Lowest <= -2 BelowNormal == -1 Normal == 0 AboveNormal ==1 Highestvalues >= 2 Is that correct ? Excuse me if that?s too basic but I?m pretty new to Ruby and even newer to IronRuby. Thanks; Pascal From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Tomas Matousek Sent: May-12-09 12:56 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Thread priority Thread#priority attribute is not implemented yet, that?s why the CLR property is picked up. It should be easy to implement it. Any volunteer? Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Tuesday, May 12, 2009 5:41 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Thread priority You can just use the enum from ironruby System::Threading::ThreadPriority.normal --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Emma Goldman - "If voting changed anything, they'd make it illegal." On Tue, May 12, 2009 at 1:59 PM, Shay Friedman > wrote: Hi there, Ruby allows to set the thread priority using the priority= method: Thread.new do Thread.current.priority = -1 ... blah blah blah ... end This is not available in IronRuby because priority maps to the System.Threading.Thread priority property which looks for the ThreadPriority enum. Is it going to change or is this the right behavior for IronRuby? Thanks, Shay. -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core -------------- next part -------------- An HTML attachment was scrubbed... URL: From Shri.Borde at microsoft.com Sun May 17 01:24:15 2009 From: Shri.Borde at microsoft.com (Shri Borde) Date: Sat, 16 May 2009 22:24:15 -0700 Subject: [Ironruby-core] Code Review: Fix for File.print misbehavior In-Reply-To: References: Message-ID: <710DF26F214D2B4BB94287123FFE980A2E1BF2E014@NA-EXMSG-C104.redmond.corp.microsoft.com> The "output" matcher from the snippet below swaps stdout with IOStub in order to be able to capture the output of the block. Swapping IOStub back with real stdout will not work as you will not know what the block printed... lambda { $stdout.print(o, o2) }.should output("#{o.to_s}#{o2.to_s}#{$\}") One hybrid way to fix this would be for the "output" matcher to take an IO object as a second optional parameter that is used to capture the output intead of using IOStub. Then print_spec.rb could provide a StringIO object. Currently, print_spec.rb is busted and does not test what it is supposed to. Taking a dependency on a stdlib (stringio) would not be worse thing in this case. I do not feel strongly about fixing this right now... ________________________________________ From: ironruby-core-bounces at rubyforge.org [ironruby-core-bounces at rubyforge.org] On Behalf Of Jim Deville [jdeville at microsoft.com] Sent: Saturday, May 16, 2009 4:05 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Code Review: Fix for File.print misbehavior I would be opposed to making the MSpec runner depend on any more stdlibs. I would suggest making a helper that swaps the IOStub with the real stdout for the duration of a block. JD ....there is no try Sent from my phone. Please excuse typos and txtspk. -----Original Message----- From: Shri Borde Sent: May 16, 2009 3:11 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Code Review: Fix for File.print misbehavior The problem is because of mspec itself. In External.LCA_RESTRICTED\Languages\IronRuby\mspec\mspec\lib\mspec\matchers\output.rb, the code sets $stdout to a helper class (IOStub) so that it can capture the output. However, what this means is that calls to $stdout.print that the test makes now go to IOStub#print rather than to the real implementation of IO#print, and this masks the bug. A better solution would be to use StringIO in matchers\output.rb rather than IOStub. If you are included to pursue this (which would be great), you could try the change and/or send email to http://groups.google.com/group/rubyspec to discuss the change. However, since this is a preexisting issue, you could leave it for another day if you want. So consider your change code-reviewed, and you can chose separately to pursue (or not) the issue with matchers\output.rb. -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shay Friedman Sent: Saturday, May 16, 2009 12:46 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Code Review: Fix for File.print misbehavior I couldn't follow the code exactly but what I did find, was that this test never reached the code inside IOOps.Print. The behavior is really strange, I tried to print the value on the screen and the value were really incorrect (the $\ delimiter is added after each argument) but the $stdout.print call inside the lambda expression got it correctly... I did that: it "writes each obj.to_s to the stream and appends $\\ (if any) given multiple objects" do o, o2 = Object.new, Object.new def o.to_s(); 'o'; end def o2.to_s(); 'o2'; end puts $stdout.print(o, o2) lambda { $stdout.print(o, o2) }.should output("#{o.to_s}#{o2.to_s}#{$\}") end And it wrote "o->o2->nil" on the screen... But when I changed the output it to "123" the test failed and told me: Expected: $stdout: "123" got: $stdout: "oo2->" So I'm really confused... like I said, my breakpoint inside the print method never gets hit so I can't really tell which "print" method is invoked... Shay. -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From ivan at flanders.co.nz Wed May 20 02:54:06 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Wed, 20 May 2009 08:54:06 +0200 Subject: [Ironruby-core] interface generic w/ generic methods Message-ID: Hi I'm observing the following behavior when I try to implement a CLR interface with generic method definitions. So let's say an interface contains the following method definition public interface IRubyEngine { T CreateInstance(RubyClass rubyClass); } in ruby class MyEngine include IRubyEngine end So far so good nothing has actually been created yet. MyEngine.new => raises (master) ? ir IronRuby 0.4.0.0 on .NET 2.0.50727.4918 Copyright (c) Microsoft Corporation. All rights reserved. >>> require 'bin/System.Web.Mvc.IronRuby.dll' => true >>> class MyEngine ... include System::Web::Mvc::IronRuby::Core::IRubyEngine ... end => MyEngine >>> MyEngine.new mscorlib:0:in `_TermCreateClass': Method 'ExecuteFile' in type 'IronRuby.Classes.Object$1' from assembly 'Snippets.scripting, Version=0.0.0. 0, Culture=neutral, PublicKeyToken=null' does not have an implementation. (System::TypeLoadException) from mscorlib:0:in `CreateTypeNoLock' from mscorlib:0:in `CreateType' from c:\tools\ironruby\ndp\fx\src\core\microsoft\scripting\Actions\DynamicMetaObjectBinder.cs:96:in `Bind' from c:\tools\ironruby\ndp\fx\src\core\microsoft\scripting\Actions\CallSiteBinder.cs:79:in `BindDelegate' from :0 >>> exit in the console output above it complains about a different method but the idea is the same. that method def was T ExecuteFile(string path, bool throwIfNotExist); Do I put this on codeplex or is that the expected behavior? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdeville at microsoft.com Wed May 20 11:42:13 2009 From: jdeville at microsoft.com (Jim Deville) Date: Wed, 20 May 2009 15:42:13 +0000 Subject: [Ironruby-core] interface generic w/ generic methods In-Reply-To: References: Message-ID: Two points: 1) We should probably have a clearer error message in this case. 2) That seems to be a bug since the behavior is different if IRubyEngine declares non-generic methods. Please file a bug on CP with both points. JD ?there is no try From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Tuesday, May 19, 2009 11:54 PM To: ironruby-core Subject: [Ironruby-core] interface generic w/ generic methods Hi I'm observing the following behavior when I try to implement a CLR interface with generic method definitions. So let's say an interface contains the following method definition public interface IRubyEngine { T CreateInstance(RubyClass rubyClass); } in ruby class MyEngine include IRubyEngine end So far so good nothing has actually been created yet. MyEngine.new => raises (master) ? ir IronRuby 0.4.0.0 on .NET 2.0.50727.4918 Copyright (c) Microsoft Corporation. All rights reserved. >>> require 'bin/System.Web.Mvc.IronRuby.dll' => true >>> class MyEngine ... include System::Web::Mvc::IronRuby::Core::IRubyEngine ... end => MyEngine >>> MyEngine.new mscorlib:0:in `_TermCreateClass': Method 'ExecuteFile' in type 'IronRuby.Classes.Object$1' from assembly 'Snippets.scripting, Version=0.0.0. 0, Culture=neutral, PublicKeyToken=null' does not have an implementation. (System::TypeLoadException) from mscorlib:0:in `CreateTypeNoLock' from mscorlib:0:in `CreateType' from c:\tools\ironruby\ndp\fx\src\core\microsoft\scripting\Actions\DynamicMetaObjectBinder.cs:96:in `Bind' from c:\tools\ironruby\ndp\fx\src\core\microsoft\scripting\Actions\CallSiteBinder.cs:79:in `BindDelegate' from :0 >>> exit in the console output above it complains about a different method but the idea is the same. that method def was T ExecuteFile(string path, bool throwIfNotExist); Do I put this on codeplex or is that the expected behavior? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jimmy.Schementi at microsoft.com Wed May 20 22:33:56 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Thu, 21 May 2009 02:33:56 +0000 Subject: [Ironruby-core] ATTN: IronRuby 0.5 Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC07C0CA03@tk5ex14mbxc106.redmond.corp.microsoft.com> I'm pleased to announce a new release of IronRuby: IronRuby 0.5! Download IronRuby 0.5: http://ironruby.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=25902#DownloadId=68919 You can also check out the source code for this release: http://github.com/ironruby/ironruby/tree/v0.5.0 Staying true to our "Conference-driven development schedule," this release is in conjunction with RailsConf '09, where IronRuby was demonstrated running real Rails applications and deploying them on IIS. A ton of work has been done in this release to get real Ruby programs running well, like RubyGems, Rake, Sinatra, and Rails. Read more about IronRuby at RailsConf: http://blog.jimmy.schementi.com/2009/05/ironruby-at-railsconf-2009.html Special thanks to Daniele Alessandri, Jirapong Nanta, and Ray Vernagus, who contributed code during this release, and everyone else who has submitted bugs, updated the wikis, or built software on-top of IronRuby. What's in the Release? A big language feature of this past release was adaptive compilation; the ability to start-up quicker with a fast interpreter, and then compile code that gets interpreted more than two times. This brought Rails startup time down from 89 seconds to 34 seconds, giving Rails approximately 2.5x quicker startup. Since this compiles "hot" code, your Rails application will get faster after an initial set of requests. There is a lot more to do for performance, but this was a great accomplishment. Here are some more interesting changes: * Removes ClrString. CLR strings are referred to as System::String * Removes IronRuby library. "require 'IronRuby'" is no longer needed; IronRuby module is now a built-in module. * Integer/Float operations for all CLR primitive numeric types * System::Char and System::String methods so that they behave like an immutable UTF-8 encoded string * Improves handling of BOM in 1.8 mode * Debugger visualizer for RubyObject so that VS will display the result of to_s in the Watch window. * Adds support for .NET operators (op_* special methods) * Implements bitwise operators on flag enums * Precompilation of simple Ruby method invocations * Improves performance for file IO#read method. Previously we were 10x slower than MRI, now we are approx. 1.5-times faster. * Tons of fixes to File, String, Array, and other built-in types to drive up RubySpec and Ruby application test-suite pass-rates. Note: Silverlight binaries have not been included in this release; they will be added back in a very-near point release. For detailed information, please see the CHANGELOG (which is much more verbose now. including all commit messages for the release ... not just syncing to head of tfs): http://rubyforge.org/frs/shownotes.php?release_id=34684 Bugs closed: 375 "ir script\server" causes a YAML parser error 461 Generic type conversion from Fixnum to Integer 467 "igem install rails" fails 499 Pathname#cleanpath messes up the pathname 545 __FILE__ doesn't return a canonicalized path 578 yield fails in eval'd code 605 Array#hash should properly handle recursive arrays 614 ci_files set needed in mspec config 674 autoload does not use File::SEPARATOR 1021 Time class instance ... and various old RubyForge bugs during the move to CodePlex Please test out IronRuby 0.5 and let us know if you have any issues. Enjoy! From Jimmy.Schementi at microsoft.com Wed May 20 23:23:49 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Thu, 21 May 2009 03:23:49 +0000 Subject: [Ironruby-core] [ATTN] IronRuby CTP for .NET 4.0 Beta 1 Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC07C0CC05@tk5ex14mbxc106.redmond.corp.microsoft.com> The IronRuby team is pleased to announce the release of the IronRuby CTP for .NET 4.0 Beta 1: http://ironruby.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27606 This release corresponds with the shipping of Visual Studio 2010 Beta 1, which includes .NET 4.0 Beta 1: http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx This is a preview of IronRuby running under the Dynamic Language Runtime, whichis is built directly into .NET 4.0! This release allows you to use IronRuby objects and types as .NET 4.0 dynamic objects from within C# and Visual Basic code. These binaries are roughly equivalent to the functionality found in IronRuby 0.3. Please also note that the IronRuby CTP for .NET 4.0 Beta 1 will run only under .NET 4.0 Beta 1. This release also includes the binaries for the IronPython 2.6 CTP for .NET 4.0 Beta 1: http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27320 - The IronRuby Team From ryan.riley at panesofglass.org Thu May 21 09:10:55 2009 From: ryan.riley at panesofglass.org (Ryan Riley) Date: Thu, 21 May 2009 08:10:55 -0500 Subject: [Ironruby-core] [ATTN] IronRuby CTP for .NET 4.0 Beta 1 In-Reply-To: <0047ECBFA2E0DF4A834AA369282A5AFC07C0CC05@tk5ex14mbxc106.redmond.corp.microsoft.com> References: <0047ECBFA2E0DF4A834AA369282A5AFC07C0CC05@tk5ex14mbxc106.redmond.corp.microsoft.com> Message-ID: Is there a plan to allow users to build from source and still run within VS2010? Ryan Riley ryan.riley at panesofglass.org http://panesofglass.org/ http://wizardsofsmart.net/ On Wed, May 20, 2009 at 10:23 PM, Jimmy Schementi < Jimmy.Schementi at microsoft.com> wrote: > The IronRuby team is pleased to announce the release of the IronRuby CTP > for .NET 4.0 Beta 1: > http://ironruby.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27606 > > This release corresponds with the shipping of Visual Studio 2010 Beta 1, > which includes .NET 4.0 Beta 1: > http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx > > This is a preview of IronRuby running under the Dynamic Language Runtime, > whichis is built directly into .NET 4.0! This release allows you to use > IronRuby objects and types as .NET 4.0 dynamic objects from within C# and > Visual Basic code. These binaries are roughly equivalent to the > functionality found in IronRuby 0.3. Please also note that the IronRuby CTP > for .NET 4.0 Beta 1 will run only under .NET 4.0 Beta 1. > > This release also includes the binaries for the IronPython 2.6 CTP for .NET > 4.0 Beta 1: > http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27320 > > - The IronRuby Team > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > -------------- next part -------------- An HTML attachment was scrubbed... URL: From curth at microsoft.com Thu May 21 10:51:42 2009 From: curth at microsoft.com (Curt Hagenlocher) Date: Thu, 21 May 2009 07:51:42 -0700 Subject: [Ironruby-core] [ATTN] IronRuby CTP for .NET 4.0 Beta 1 In-Reply-To: References: <0047ECBFA2E0DF4A834AA369282A5AFC07C0CC05@tk5ex14mbxc106.redmond.corp.microsoft.com> Message-ID: The Developer Division source tree was branched over a month ago in preparation for the beta release. Ruby and DLR development continued on the ?head? branch, while stabilization and fixes were applied to the ?beta 1? branch. Because of this, there?s some chance that changes have been made to either Ruby or the (non-core) DLR which prevent Ruby head from working with the beta 1 CLR. In other words, this would require a bit of work ? first to identify whether or not any changes are needed to work with the older version, and then to actually make a branch on github and do that work. In other words, this is basically a resourcing problem ? and IronRuby doesn?t really have any Microsoft resources to spare for something that is essentially ?dead-end? work. But anything that could possibly be needed to do this work is publicly available and open sourced. So in short, our plan is to let you do the work! :) You have the source ? what?s stopping you?! From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ryan Riley Sent: Thursday, May 21, 2009 6:11 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] [ATTN] IronRuby CTP for .NET 4.0 Beta 1 Is there a plan to allow users to build from source and still run within VS2010? Ryan Riley ryan.riley at panesofglass.org http://panesofglass.org/ http://wizardsofsmart.net/ On Wed, May 20, 2009 at 10:23 PM, Jimmy Schementi > wrote: The IronRuby team is pleased to announce the release of the IronRuby CTP for .NET 4.0 Beta 1: http://ironruby.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27606 This release corresponds with the shipping of Visual Studio 2010 Beta 1, which includes .NET 4.0 Beta 1: http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx This is a preview of IronRuby running under the Dynamic Language Runtime, whichis is built directly into .NET 4.0! This release allows you to use IronRuby objects and types as .NET 4.0 dynamic objects from within C# and Visual Basic code. These binaries are roughly equivalent to the functionality found in IronRuby 0.3. Please also note that the IronRuby CTP for .NET 4.0 Beta 1 will run only under .NET 4.0 Beta 1. This release also includes the binaries for the IronPython 2.6 CTP for .NET 4.0 Beta 1: http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27320 - The IronRuby Team _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core -------------- next part -------------- An HTML attachment was scrubbed... URL: From ryan.riley at panesofglass.org Thu May 21 11:26:42 2009 From: ryan.riley at panesofglass.org (Ryan Riley) Date: Thu, 21 May 2009 10:26:42 -0500 Subject: [Ironruby-core] [ATTN] IronRuby CTP for .NET 4.0 Beta 1 In-Reply-To: References: <0047ECBFA2E0DF4A834AA369282A5AFC07C0CC05@tk5ex14mbxc106.redmond.corp.microsoft.com> Message-ID: Nothing stopping me, just wondering if something already existed. :) Ryan Riley ryan.riley at panesofglass.org http://panesofglass.org/ http://wizardsofsmart.net/ On Thu, May 21, 2009 at 9:51 AM, Curt Hagenlocher wrote: > The Developer Division source tree was branched over a month ago in > preparation for the beta release. Ruby and DLR development continued on the > ?head? branch, while stabilization and fixes were applied to the ?beta 1? > branch. Because of this, there?s some chance that changes have been made to > either Ruby or the (non-core) DLR which prevent Ruby head from working with > the beta 1 CLR. In other words, this would require a bit of work ? first to > identify whether or not any changes are needed to work with the older > version, and then to actually make a branch on github and do that work. > > > > In other words, this is basically a resourcing problem ? and IronRuby > doesn?t really have any Microsoft resources to spare for something that is > essentially ?dead-end? work. But anything that could possibly be needed to > do this work is publicly available and open sourced. > > > > So in short, our plan is to let you do the work! :) You have the source ? > what?s stopping you?! > -------------- next part -------------- An HTML attachment was scrubbed... URL: From curth at microsoft.com Thu May 21 18:08:28 2009 From: curth at microsoft.com (Curt Hagenlocher) Date: Thu, 21 May 2009 15:08:28 -0700 Subject: [Ironruby-core] Code Review: Protected3 In-Reply-To: References: Message-ID: Looks good! -----Original Message----- From: Tomas Matousek Sent: Thursday, May 21, 2009 2:50 PM To: IronRuby External Code Reviewers; Rowan Code Reviewers Cc: ironruby-core at rubyforge.org Subject: Code Review: Protected3 tfpt review "/shelveset:Protected3;REDMOND\tomat" Small changes in DLR. Ruby: Fixes handling of CLR protected and private methods and properties. Enables generic methods in ClsTypeEmitter. Removes RubyCallFlag.TryCall - it's not used anymore. Notes on visibility: Ruby visibility is orthogonal to CLR visibility. Ruby visibility is mutable (can be changed using Kernel#public/private/protected methods), CLR visibility is not. A CLR method group can comprise of methods of different CLR visibility. Ruby visibility applies on the group as a whole. Ruby-protected members can only be called from a scope whose self immediate class is a descendant of the method owner. CLR-protected members can only be called if the receiver is a descendant of the method owner. Ruby-private members can only be called with an implicit receiver (self). CLR-private members can only be called in PrivateBinding mode (-X:PrivateBinding command line option), the receiver might be explicit or implicit. Tests: Since protected methods can only be called on a derived class instance the specs need to be adjusted accordingly. I've fixed generic_spec nad overload_spec and commented out a block in protected_spec - all the cases there need to be changed to negative cases (all should fail). Removed ROWAN_BIN check in External.LCA_RESTRICTED\Languages\IronRuby\mspec\default.mspec so that mspec picks up IR_OPTIONS even if ROWAN_BIN is not set. Tomas From jdeville at microsoft.com Thu May 21 18:20:55 2009 From: jdeville at microsoft.com (Jim Deville) Date: Thu, 21 May 2009 22:20:55 +0000 Subject: [Ironruby-core] Code Review: Protected3 In-Reply-To: References: Message-ID: For the protected tests, can you add specs that test that the protected .NET methods are callable from an instance_eval? @klass.instance_eval {public_protected_overload("abc")}.should equal_clr_string("protected overload") Don't worry about protected_spec though, I'll fix that. Other than that, test looks good. JD ...there is no try > -----Original Message----- > From: Curt Hagenlocher > Sent: Thursday, May 21, 2009 3:08 PM > To: Tomas Matousek; IronRuby External Code Reviewers; Rowan Code > Reviewers > Cc: ironruby-core at rubyforge.org > Subject: RE: Code Review: Protected3 > > Looks good! > > -----Original Message----- > From: Tomas Matousek > Sent: Thursday, May 21, 2009 2:50 PM > To: IronRuby External Code Reviewers; Rowan Code Reviewers > Cc: ironruby-core at rubyforge.org > Subject: Code Review: Protected3 > > tfpt review "/shelveset:Protected3;REDMOND\tomat" > > Small changes in DLR. > > Ruby: > Fixes handling of CLR protected and private methods and properties. > Enables generic methods in ClsTypeEmitter. > Removes RubyCallFlag.TryCall - it's not used anymore. > > Notes on visibility: > Ruby visibility is orthogonal to CLR visibility. > Ruby visibility is mutable (can be changed using > Kernel#public/private/protected methods), CLR visibility is not. > A CLR method group can comprise of methods of different CLR visibility. > Ruby visibility applies on the group as a whole. > > Ruby-protected members can only be called from a scope whose self > immediate class is a descendant of the method owner. > CLR-protected members can only be called if the receiver is a descendant of > the method owner. > > Ruby-private members can only be called with an implicit receiver (self). > CLR-private members can only be called in PrivateBinding mode (- > X:PrivateBinding command line option), the receiver might be explicit or > implicit. > > Tests: > Since protected methods can only be called on a derived class instance the > specs need to be adjusted accordingly. > I've fixed generic_spec nad overload_spec and commented out a block in > protected_spec - all the cases there need to be changed to negative cases > (all should fail). > Removed ROWAN_BIN check in > External.LCA_RESTRICTED\Languages\IronRuby\mspec\default.mspec so > that mspec picks up IR_OPTIONS even if ROWAN_BIN is not set. > > Tomas From jdeville at microsoft.com Thu May 21 18:26:38 2009 From: jdeville at microsoft.com (Jim Deville) Date: Thu, 21 May 2009 22:26:38 +0000 Subject: [Ironruby-core] Code Review: Protected3 In-Reply-To: References: Message-ID: After chatting with Tomas, not adding those tests makes sense due to differences in CLR protected behavior. I misunderstood his explanation below. JD ...there is no try > -----Original Message----- > From: Jim Deville > Sent: Thursday, May 21, 2009 3:21 PM > To: Curt Hagenlocher; Tomas Matousek; IronRuby External Code Reviewers; > Rowan Code Reviewers > Cc: ironruby-core at rubyforge.org > Subject: RE: Code Review: Protected3 > > For the protected tests, can you add specs that test that the protected .NET > methods are callable from an instance_eval? > > @klass.instance_eval {public_protected_overload("abc")}.should > equal_clr_string("protected overload") > > Don't worry about protected_spec though, I'll fix that. > > Other than that, test looks good. > > JD > > ...there is no try > > > -----Original Message----- > > From: Curt Hagenlocher > > Sent: Thursday, May 21, 2009 3:08 PM > > To: Tomas Matousek; IronRuby External Code Reviewers; Rowan Code > > Reviewers > > Cc: ironruby-core at rubyforge.org > > Subject: RE: Code Review: Protected3 > > > > Looks good! > > > > -----Original Message----- > > From: Tomas Matousek > > Sent: Thursday, May 21, 2009 2:50 PM > > To: IronRuby External Code Reviewers; Rowan Code Reviewers > > Cc: ironruby-core at rubyforge.org > > Subject: Code Review: Protected3 > > > > tfpt review "/shelveset:Protected3;REDMOND\tomat" > > > > Small changes in DLR. > > > > Ruby: > > Fixes handling of CLR protected and private methods and properties. > > Enables generic methods in ClsTypeEmitter. > > Removes RubyCallFlag.TryCall - it's not used anymore. > > > > Notes on visibility: > > Ruby visibility is orthogonal to CLR visibility. > > Ruby visibility is mutable (can be changed using > > Kernel#public/private/protected methods), CLR visibility is not. > > A CLR method group can comprise of methods of different CLR visibility. > > Ruby visibility applies on the group as a whole. > > > > Ruby-protected members can only be called from a scope whose self > > immediate class is a descendant of the method owner. > > CLR-protected members can only be called if the receiver is a > > descendant of the method owner. > > > > Ruby-private members can only be called with an implicit receiver (self). > > CLR-private members can only be called in PrivateBinding mode (- > > X:PrivateBinding command line option), the receiver might be explicit > > or implicit. > > > > Tests: > > Since protected methods can only be called on a derived class > > instance the specs need to be adjusted accordingly. > > I've fixed generic_spec nad overload_spec and commented out a block > > in protected_spec - all the cases there need to be changed to negative > > cases (all should fail). > > Removed ROWAN_BIN check in > > External.LCA_RESTRICTED\Languages\IronRuby\mspec\default.mspec so > that > > mspec picks up IR_OPTIONS even if ROWAN_BIN is not set. > > > > Tomas From curth at microsoft.com Thu May 21 18:45:36 2009 From: curth at microsoft.com (Curt Hagenlocher) Date: Thu, 21 May 2009 15:45:36 -0700 Subject: [Ironruby-core] Code Review: NoAdaptive In-Reply-To: References: Message-ID: Looks good -----Original Message----- From: Tomas Matousek Sent: Thursday, May 21, 2009 3:33 PM To: IronRuby External Code Reviewers; Rowan Code Reviewers Cc: ironruby-core at rubyforge.org Subject: Code Review: NoAdaptive tfpt review "/shelveset:NoAdaptive;REDMOND\tomat" Moves NoAdaptiveCompilation flag up to LangaugeOptions and implements it for Ruby. Tomas From jdeville at microsoft.com Fri May 22 16:11:59 2009 From: jdeville at microsoft.com (Jim Deville) Date: Fri, 22 May 2009 20:11:59 +0000 Subject: [Ironruby-core] Code Review: regressions In-Reply-To: References: Message-ID: F2F with Jimmy JD ...there is no try > -----Original Message----- > From: Jim Deville > Sent: Friday, May 22, 2009 1:04 PM > To: IronRuby External Code Reviewers > Cc: ironruby-core at rubyforge.org > Subject: Code Review: regressions > > tfpt review "/shelveset:regressions;REDMOND\jdeville" > Comment : > Regressions tests for the following CP bugs. > > !!!!!Note that closing 1351 means we are upgrading redist-libs and > rubygems!!!! > > : > ID Title > 374 irails Foo: undefined method for OpenSLL::Random.random_bytes > > 459 throw FileNotFoundException => rescue Errno.NoEntryError > 466 ''.split(//, -1) returns [""] instead of [] > 572 Error when running Cucumber examples with IronRuby > 614 ci_files set needed in mspec config > 718 IronRuby ignores RUBYLIB environment variable > 727 to_proc not working > 814 Allocator underfined for (TypeError) > 940 Can't inherit from abstract classes > 1028 Missing conversion from Duration to Fixnum (ActiveSupport)? > 1351 redist-libs should have rubygems-1.3.1 > 1352 Test Defects > > Also: > * Categorizes uncategorized specs > * includes a TraceListener in default.mspec. This will prevent Assert > windows from being popped up in SNAP or if you set the environment > variable SILENTASSERT. This works for both Rubyspec and the interop tests > From sanxiyn at gmail.com Sun May 24 06:08:46 2009 From: sanxiyn at gmail.com (Seo Sanghyeon) Date: Sun, 24 May 2009 19:08:46 +0900 Subject: [Ironruby-core] Rake 0.8.7 and IronRuby 0.5 Message-ID: <5b0248170905240308h33e0a04bvf9c7ec2ac6395e30@mail.gmail.com> I installed IronRuby 0.5, and ran igem install rake, which installed Rake 0.8.7. Now rake/testtask launches new Ruby process using RakeFileUtils.ruby, which ultimately calls Kernel.system. When tests fail, $? is examined, but it is Fixnum, not Process::Status, so Rake barfs. Transcript follows. C:\>iirb irb(main):001:0> require 'rubygems' => true irb(main):002:0> require 'rake' => true irb(main):003:0> RakeFileUtils.ruby 'do_not_exist.rb' C:/ironruby/lib/IronRuby/../..//bin/ir.exe do_not_exist.rb NoMethodError: undefined method `exitstatus' for 1:Fixnum from C:/ironruby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:995:in `sh' (snip) I reported this as CodePlex #1400. Please vote! http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=1400 -- Seo Sanghyeon From Shri.Borde at microsoft.com Sun May 24 16:59:37 2009 From: Shri.Borde at microsoft.com (Shri Borde) Date: Sun, 24 May 2009 13:59:37 -0700 Subject: [Ironruby-core] Rake 0.8.7 and IronRuby 0.5 In-Reply-To: <5b0248170905240308h33e0a04bvf9c7ec2ac6395e30@mail.gmail.com> References: <5b0248170905240308h33e0a04bvf9c7ec2ac6395e30@mail.gmail.com> Message-ID: <710DF26F214D2B4BB94287123FFE980A2E1C4C24E4@NA-EXMSG-C104.redmond.corp.microsoft.com> Thanks for the detailed bug report! I have a fix, and will push it out next week... -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Seo Sanghyeon Sent: Sunday, May 24, 2009 3:09 AM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] Rake 0.8.7 and IronRuby 0.5 I installed IronRuby 0.5, and ran igem install rake, which installed Rake 0.8.7. Now rake/testtask launches new Ruby process using RakeFileUtils.ruby, which ultimately calls Kernel.system. When tests fail, $? is examined, but it is Fixnum, not Process::Status, so Rake barfs. Transcript follows. C:\>iirb irb(main):001:0> require 'rubygems' => true irb(main):002:0> require 'rake' => true irb(main):003:0> RakeFileUtils.ruby 'do_not_exist.rb' C:/ironruby/lib/IronRuby/../..//bin/ir.exe do_not_exist.rb NoMethodError: undefined method `exitstatus' for 1:Fixnum from C:/ironruby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:995:in `sh' (snip) I reported this as CodePlex #1400. Please vote! http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=1400 -- Seo Sanghyeon _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From ivan at flanders.co.nz Tue May 26 04:18:23 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Tue, 26 May 2009 10:18:23 +0200 Subject: [Ironruby-core] mono builds Message-ID: Hi I'm going to kill off the mono-builds repo. When I build our mono branch or the ironruby master branch with mono ironruby gets broken for comparing Arrays the <=> throws a NullReferenceException When I use the binaries that are compiled on windows it works. That in combination with the fact that I haven't really succeeded in successfully debugging a mono app from the command line make it just waste space in my account and adds to the confusion of where to get the binaries. Is there somebody on this list who could get me started debugging a mono application? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero GSM: +32.486.787.582 Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) -------------- next part -------------- An HTML attachment was scrubbed... URL: From sanxiyn at gmail.com Tue May 26 05:40:31 2009 From: sanxiyn at gmail.com (Seo Sanghyeon) Date: Tue, 26 May 2009 18:40:31 +0900 Subject: [Ironruby-core] mono builds In-Reply-To: References: Message-ID: <5b0248170905260240q28fbc967w6a43d17dfc11721f@mail.gmail.com> 2009/5/26 Ivan Porto Carrero : > Is there somebody on this list who could get me started debugging a mono > application? Do you have trouble debugging Mono applications? mdb (Mono Debugger) worked fine for me debugging IronPython. Maybe I can help you. (You may contact me off-list or on Freenode IRC sanxiyn.) -- Seo Sanghyeon From ivan at flanders.co.nz Thu May 28 13:49:07 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Thu, 28 May 2009 19:49:07 +0200 Subject: [Ironruby-core] overriding indexers Message-ID: Hi How do I override an indexer on a C# class? public class IndexerContained{ private Dictionary _inner = new Dictionary{ { "key1", "value1" }, { "key2", "value2" }, { "key3", "value3" }, { "key4", "value4" } }; public virtual string this[string name]{ get { return _inner[name]; } set { _inner[name] = value; } } } I would like to override that indexer with something like class IndexerContainedMock def [](*args) 5 end def []=(*args) # nothing here end end Am I doing it wrong or is that not implemented yet? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero GSM: +32.486.787.582 Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jimmy.Schementi at microsoft.com Thu May 28 15:11:43 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Thu, 28 May 2009 19:11:43 +0000 Subject: [Ironruby-core] overriding indexers In-Reply-To: References: Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC0F936B10@tk5ex14mbxc106.redmond.corp.microsoft.com> Pretty sure this isn?t implemented yet, as you can accomplish the same type of effect with method_missing: _inner.key2 = ?value2? It definitely should be fixed, but not sure if anyone has it in their sights. So open a bug =) From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Thursday, May 28, 2009 10:49 AM To: ironruby-core Subject: [Ironruby-core] overriding indexers Hi How do I override an indexer on a C# class? public class IndexerContained{ private Dictionary _inner = new Dictionary{ { "key1", "value1" }, { "key2", "value2" }, { "key3", "value3" }, { "key4", "value4" } }; public virtual string this[string name]{ get { return _inner[name]; } set { _inner[name] = value; } } } I would like to override that indexer with something like class IndexerContainedMock def [](*args) 5 end def []=(*args) # nothing here end end Am I doing it wrong or is that not implemented yet? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero GSM: +32.486.787.582 Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan at flanders.co.nz Thu May 28 15:19:46 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Thu, 28 May 2009 21:19:46 +0200 Subject: [Ironruby-core] overriding indexers In-Reply-To: <0047ECBFA2E0DF4A834AA369282A5AFC0F936B10@tk5ex14mbxc106.redmond.corp.microsoft.com> References: <0047ECBFA2E0DF4A834AA369282A5AFC0F936B10@tk5ex14mbxc106.redmond.corp.microsoft.com> Message-ID: hehe it's for mocking .. more specifically HttpSessionStateBase ;) --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Thu, May 28, 2009 at 9:11 PM, Jimmy Schementi < Jimmy.Schementi at microsoft.com> wrote: > Pretty sure this isn?t implemented yet, as you can accomplish the same type > of effect with method_missing: > > > > _inner.key2 = ?value2? > > > > It definitely should be fixed, but not sure if anyone has it in their > sights. So open a bug =) > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Ivan Porto Carrero > *Sent:* Thursday, May 28, 2009 10:49 AM > *To:* ironruby-core > *Subject:* [Ironruby-core] overriding indexers > > > > Hi > > > > How do I override an indexer on a C# class? > > > > public class IndexerContained{ > > > > private Dictionary _inner = new Dictionary string>{ > > { "key1", "value1" }, > > { "key2", "value2" }, > > { "key3", "value3" }, > > { "key4", "value4" } > > }; > > > > public virtual string this[string name]{ > > get { return _inner[name]; } > > set { _inner[name] = value; } > > } > > } > > > > I would like to override that indexer with something like > > > > class IndexerContainedMock > > > > def [](*args) > > 5 > > end > > > > def []=(*args) > > # nothing here > > end > > end > > > > Am I doing it wrong or is that not implemented yet? > > > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > GSM: +32.486.787.582 > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jimmy.Schementi at microsoft.com Thu May 28 17:32:10 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Thu, 28 May 2009 21:32:10 +0000 Subject: [Ironruby-core] [ATTN] IronRuby CTP for .NET 4.0 Beta 1 In-Reply-To: <0047ECBFA2E0DF4A834AA369282A5AFC07C0CC05@tk5ex14mbxc106.redmond.corp.microsoft.com> References: <0047ECBFA2E0DF4A834AA369282A5AFC07C0CC05@tk5ex14mbxc106.redmond.corp.microsoft.com> Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC0F936DB7@tk5ex14mbxc106.redmond.corp.microsoft.com> FYI there was an issue with ir.exe.config which stopped ir.exe from running properly: the issue is now fixed, so if you experienced this please re-download this release: http://ironruby.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27606 ~js -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Jimmy Schementi Sent: Wednesday, May 20, 2009 8:24 PM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] [ATTN] IronRuby CTP for .NET 4.0 Beta 1 The IronRuby team is pleased to announce the release of the IronRuby CTP for .NET 4.0 Beta 1: http://ironruby.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27606 This release corresponds with the shipping of Visual Studio 2010 Beta 1, which includes .NET 4.0 Beta 1: http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx This is a preview of IronRuby running under the Dynamic Language Runtime, whichis is built directly into .NET 4.0! This release allows you to use IronRuby objects and types as .NET 4.0 dynamic objects from within C# and Visual Basic code. These binaries are roughly equivalent to the functionality found in IronRuby 0.3. Please also note that the IronRuby CTP for .NET 4.0 Beta 1 will run only under .NET 4.0 Beta 1. This release also includes the binaries for the IronPython 2.6 CTP for .NET 4.0 Beta 1: http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27320 - The IronRuby Team _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From lists at ruby-forum.com Fri May 29 15:21:51 2009 From: lists at ruby-forum.com (Shay Friedman) Date: Fri, 29 May 2009 21:21:51 +0200 Subject: [Ironruby-core] Standard Libraries Support Message-ID: Hi, I'm trying out the different standard libraries via IronRuby and some throw errors once I try to require or use them. The problematic ones are: RSS Finalize Open3 OpenSSL Shell WeakRef Also resolv and resolv-replace do not work but I guess it's because of their win32 requests. Should the above libraries work or is it a bug? Thanks, Shay. -- Posted via http://www.ruby-forum.com/. From jdeville at microsoft.com Fri May 29 16:08:22 2009 From: jdeville at microsoft.com (Jim Deville) Date: Fri, 29 May 2009 20:08:22 +0000 Subject: [Ironruby-core] Standard Libraries Support In-Reply-To: References: Message-ID: OpenSSL is being worked on by Jirapong. The other ones probably need to be rewritten in C#. Feel free to file bugs, or claim a library to work on ;) JD ...there is no try > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > bounces at rubyforge.org] On Behalf Of Shay Friedman > Sent: Friday, May 29, 2009 12:22 PM > To: ironruby-core at rubyforge.org > Subject: [Ironruby-core] Standard Libraries Support > > Hi, > > I'm trying out the different standard libraries via IronRuby and some throw > errors once I try to require or use them. > The problematic ones are: > RSS > Finalize > Open3 > OpenSSL > Shell > WeakRef > > Also resolv and resolv-replace do not work but I guess it's because of their > win32 requests. > > Should the above libraries work or is it a bug? > > Thanks, > Shay. > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core From lists at ruby-forum.com Fri May 29 17:10:31 2009 From: lists at ruby-forum.com (Shay Friedman) Date: Fri, 29 May 2009 23:10:31 +0200 Subject: [Ironruby-core] Standard Libraries Support In-Reply-To: References: Message-ID: So just to make sure - there are no plans of making those work for V1.0, right? Thanks Jim! -- Posted via http://www.ruby-forum.com/. From jdeville at microsoft.com Fri May 29 18:13:16 2009 From: jdeville at microsoft.com (Jim Deville) Date: Fri, 29 May 2009 22:13:16 +0000 Subject: [Ironruby-core] Standard Libraries Support In-Reply-To: References: Message-ID: Here's a quick rundown (~30mins worth of looking at these libraries) RSS: RSS should work, it appears there is a bug in there with Class.inherited Tracking with CodePlex 1483 Finalize: We need to figure out what the ObjectSpace finalizers really do, and if we can implement those methods. Tracking with CodePlex 1484 Open3: Uses fork, so it will not work unless we completely re-implement it. The workaround would be having someone port the win32-open3 gem to C# Tracking with CodePlex 1485 OpenSSL: Jirapong is working on this. Shell: Uses Thread.exclusive, which is defined in the thread standard library (as opposed to the Thread builtin class), which needs to be ported. Tracking with CodePlex 1485 WeakRef: Uses ObjectSpace#id2ref and it may be reliant on the CRuby GC internals Tracking with CodePlex 1487 Resolv and resolv-replace should be made to work, but they require us to figure out what portions of win32 they need. Tracking with CodePlex 1488 Ideally all of these should work for 1.0, but we may not have resources to do them. Anyone who wants to is welcome to help bang at them to narrow down the bugs, and port the needed libraries. JD ...there is no try > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > bounces at rubyforge.org] On Behalf Of Shay Friedman > Sent: Friday, May 29, 2009 2:11 PM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Standard Libraries Support > > So just to make sure - there are no plans of making those work for V1.0, > right? > > Thanks Jim! > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core From ivan at flanders.co.nz Sat May 30 13:56:16 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Sat, 30 May 2009 19:56:16 +0200 Subject: [Ironruby-core] new sdlsdk build? Message-ID: Hi is there going to be an updated sdlsdk build anytime soon? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero GSM: +32.486.787.582 Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jimmy.Schementi at microsoft.com Sat May 30 15:25:12 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Sat, 30 May 2009 19:25:12 +0000 Subject: [Ironruby-core] new sdlsdk build? In-Reply-To: References: Message-ID: <08C8D7E0-3F2C-4BAD-8916-FDE04A96D878@microsoft.com> No, but I'm merging sdlsdk back into our internal tfs repo, since there's no need for a separate project anymore. Then every binary release of the languages will have SL bits, and all three public repos (ir, ipy, dlr) will have the same SL bits. You'll see a code review for this integration shortly. ~Jimmy On May 30, 2009, at 10:57 AM, "Ivan Porto Carrero" > wrote: Hi is there going to be an updated sdlsdk build anytime soon? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero GSM: +32.486.787.582 Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jimmy.Schementi at microsoft.com Sat May 30 15:38:44 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Sat, 30 May 2009 19:38:44 +0000 Subject: [Ironruby-core] Standard Libraries Support In-Reply-To: References: Message-ID: <94E323A8-BFEF-4798-9503-7C6C3739D4DB@microsoft.com> If you know an existing Ruby application which depends on these libraries, then that'll make it more worthwile to get them working. ~Jimmy On May 29, 2009, at 2:13 PM, "Shay Friedman" wrote: > So just to make sure - there are no plans of making those work for > V1.0, > right? > > Thanks Jim! > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > From suppakilla at gmail.com Sun May 31 07:22:21 2009 From: suppakilla at gmail.com (Daniele Alessandri) Date: Sun, 31 May 2009 13:22:21 +0200 Subject: [Ironruby-core] Review: fixes for Array#rindex and Array#reverse_each In-Reply-To: References: <3bf20550904231258s6f19bb53u830b45696998f970@mail.gmail.com> Message-ID: <3bf20550905310422k445b18c7l27f1e6eb40e977db@mail.gmail.com> Hi Jim, I'm a bit late but daytime work got in the way and then I was out of the country for two weeks :-) I got rid of the duplicated logic in IListOps.ReverseIndex and ArrayOps.ReverseEach by implementing a new internal method (IListOps.ReverseEnumerateIndexes): http://github.com/nrk/ironruby/commit/76db817d1766b788f995afb02e12c5a72955c77f As for the specs, I just slightly modified an existing one in a way that does not affect the test but helped me to discover the bug (actually this change uses a different condition from the one I used one month ago as it exposed another bug which got fixed in the above mentioned commit): http://github.com/nrk/ironruby/commit/e5497cf87fc479b2bf2ca0b812d979354a86f44c See also the attached diff. Thanks, Daniele On Thu, Apr 23, 2009 at 22:08, Jim Deville wrote: > Can you add specs for rindex that expose the bug you fixed? Also, is there any shared place that you could put the following code: > ? ? ? ? if (self.Count < originalSize) { > ? ? ? ? ? ? i = originalSize - i - 1 + self.Count; > ? ? ? ? ? ? originalSize = self.Count; > ? ? ? ? } > > It would be nice to get rid of the duplicated logic, but I can't think of where it should go. > > Other than that, looks good. > JD > >> -----Original Message----- >> From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- >> bounces at rubyforge.org] On Behalf Of Daniele Alessandri >> Sent: Thursday, April 23, 2009 12:59 PM >> To: ironruby-core at rubyforge.org >> Subject: [Ironruby-core] Review: fixes for Array#rindex and >> Array#reverse_each >> >> Hi, >> I just pushed two fixes on my repository, the first one addresses a bug >> in Array#rindex (there was a bug in my last commit) and the second one >> makes Array#reverse_each compliant with the rubyspecs. >> >> http://github.com/nrk/ironruby/commit/d2b18f5d01a49cb62a2ea0c205e1cf123 >> 3ac94e0 >> >> >From the commit message: >> >> * Fixed a bug in IListOps.ReverseIndex (core/array/rindex specs were >> passing, this bug was triggered under certain conditions different from >> the ones defined in the specs) >> >> * Fixed ArrayOps.ReverseEach to make it not fail when elemens in the >> array are removed from inside a block. >> >> See also the attached diff. >> >> Thanks, >> Daniele >> >> -- >> Daniele Alessandri >> http://www.clorophilla.net/blog/ >> http://twitter.com/JoL1hAHN > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > -- Daniele Alessandri http://www.clorophilla.net/blog/ http://twitter.com/JoL1hAHN -------------- next part -------------- diff --git a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/core/array/rindex_spec.rb b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/core/array/rindex_spec.rb index 4971cf3..6e43c2b 100644 --- a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/core/array/rindex_spec.rb +++ b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/core/array/rindex_spec.rb @@ -17,31 +17,31 @@ describe "Array#rindex" do it "returns size-1 if last element == to object" do [2, 1, 3, 2, 5].rindex(5).should == 4 end it "returns 0 if only first element == to object" do [2, 1, 3, 1, 5].rindex(2).should == 0 end it "returns nil if no element == to object" do [1, 1, 3, 2, 1, 3].rindex(4).should == nil end it "does not fail when removing elements from block" do sentinel = mock('sentinel') - ary = [0, 0, 1, 1, 3, 2, 1, sentinel] + ary = [0, 0, 1, 1, 3, 2, 1, sentinel, 4] sentinel.instance_variable_set(:@ary, ary) def sentinel.==(o) @ary.slice!(1..-1); false; end ary.rindex(0).should == 0 end it "properly handles recursive arrays" do empty = ArraySpecs.empty_recursive_array empty.rindex(empty).should == 0 empty.rindex(1).should be_nil array = ArraySpecs.recursive_array array.rindex(1).should == 0 array.rindex([array]).should == 3 diff --git a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ArrayOps.cs b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ArrayOps.cs index f83c4c7..301007a 100644 --- a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ArrayOps.cs +++ b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ArrayOps.cs @@ -546,31 +546,27 @@ namespace IronRuby.Builtins { [RubyMethod("reverse!")] public static RubyArray/*!*/ InPlaceReverse(RubyContext/*!*/ context, RubyArray/*!*/ self) { RubyUtils.RequiresNotFrozen(context, self); self.Reverse(); return self; } [RubyMethod("reverse_each")] public static object ReverseEach(RubyContext/*!*/ context, BlockParam block, RubyArray/*!*/ self) { Assert.NotNull(context, self); if (self.Count > 0 && block == null) { throw RubyExceptions.NoBlockGiven(); } - for (int originalSize = self.Count, i = originalSize - 1; i >= 0; i--) { + foreach (int index in IListOps.ReverseEnumerateIndexes(self)) { object result; - if (block.Yield(self[i], out result)) { + if (block.Yield(self[index], out result)) { return result; } - if (self.Count < originalSize) { - i = originalSize - i - 1 + self.Count; - originalSize = self.Count; - } } return self; } #endregion } } diff --git a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IListOps.cs b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IListOps.cs index e1197ad..3224c55 100644 --- a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IListOps.cs +++ b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IListOps.cs @@ -138,30 +138,40 @@ namespace IronRuby.Builtins { if (array != null) { return array.CreateInstance(); } // interop - call a default ctor to get an instance: var allocate = allocateStorage.GetCallSite("allocate", 0); var cls = allocateStorage.Context.GetClassOf(list); var result = allocate.Target(allocate, cls) as IList; if (result != null) { return result; } throw RubyExceptions.CreateTypeError(String.Format("{0}#allocate should return IList", cls.Name)); } + internal static IEnumerable/*!*/ ReverseEnumerateIndexes(IList/*!*/ collection) { + for (int originalSize = collection.Count, i = originalSize - 1; i >= 0; i--) { + yield return i; + if (collection.Count < originalSize) { + i = originalSize - (originalSize - collection.Count); + originalSize = collection.Count; + } + } + } + #endregion #region initialize_copy, replace, clear, to_a, to_ary [RubyMethod("replace")] [RubyMethod("initialize_copy", RubyMethodAttributes.PrivateInstance)] public static IList/*!*/ Replace(RubyContext/*!*/ context, IList/*!*/ self, [NotNull, DefaultProtocol]IList/*!*/ other) { RubyUtils.RequiresNotFrozen(context, self); self.Clear(); AddRange(self, other); return self; } [RubyMethod("clear")] @@ -1022,37 +1032,33 @@ namespace IronRuby.Builtins { return Index(equals, self, item) != null; } [RubyMethod("index")] public static object Index(BinaryOpStorage/*!*/ equals, IList/*!*/ self, object item) { for (int i = 0; i < self.Count; ++i) { if (Protocols.IsEqual(equals, self[i], item)) { return i; } } return null; } [RubyMethod("rindex")] public static object ReverseIndex(BinaryOpStorage/*!*/ equals, IList/*!*/ self, object item) { - for (int originalSize = self.Count, i = originalSize - 1; i >= 0; i--) { - if (Protocols.IsEqual(equals, self[i], item)) { - return i; - } - if (self.Count < originalSize) { - i = originalSize - i - 1 + self.Count; - originalSize = self.Count; + foreach (int index in IListOps.ReverseEnumerateIndexes(self)) { + if (Protocols.IsEqual(equals, self[index], item)) { + return index; } } return null; } #endregion #region indexes, indices, values_at [RubyMethod("indexes")] [RubyMethod("indices")] public static object Indexes(ConversionStorage/*!*/ fixnumCast, CallSiteStorage>/*!*/ allocateStorage, IList/*!*/ self, [NotNull]params object[]/*!*/ values) { fixnumCast.Context.ReportWarning("Array#indexes and Array#indices are deprecated; use Array#values_at"); From ivan at flanders.co.nz Sun May 31 19:22:11 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Mon, 1 Jun 2009 01:22:11 +0200 Subject: [Ironruby-core] IronRuby MVC Message-ID: Hi I've just pushed IronRuby MVC and sent the pull request. AFAICT it should bind to Rails ORM/s now at least it creates the necessary objects (nested hashes to do so). I'm going to be sprinting to get my last chapter done this month and get a kick-ass introduction to ironruby slide deck together and after that I'm starting a project in Silverlight with IronRuby for a commercial product. That means I won't be able to spend much time on that framework for the next 2-3 months until we start building our back-end. I hope now that the project is fairly done somebody from the community will finish it off because: * I've only verifyfied that the viewresults are working, so some JsonResult, FileResult etc will probably still need some attention. * There are virtually no specs and/or working specs. I will extend caricature to have a good working mocking implementation for aspnet mvc (now I can't override indexers so I'll create mock classes in C# to override that indexer). * I haven't tested all the cases for snake, camel casing interoperability but on most places it works. * it could use some API documentation :) * More samples are needed those are just a few items from the top of my head that will still require some work. Some other things: * teach ironruby mvc about the gems on the server so you could use those if they were installed. * Provide a way to freeze gems and load them from within the ironruby mvc application --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) -------------- next part -------------- An HTML attachment was scrubbed... URL: