From charles.c.strahan at gmail.com Wed Sep 1 04:00:38 2010 From: charles.c.strahan at gmail.com (Charles Strahan) Date: Wed, 1 Sep 2010 03:00:38 -0500 Subject: [Ironruby-core] KCoding fix for Silverlight build (issue #5093) In-Reply-To: References: Message-ID: > > KCodings are obsolete and should be completely removed. So I don?t think > this needs to be fixed. > Sweet - that works for me :). Have you had a chance to take a look at my other commit (regarding issue #4946)? -Charles On Tue, Aug 31, 2010 at 8:28 PM, Tomas Matousek < Tomas.Matousek at microsoft.com> wrote: > KCodings are obsolete and should be completely removed. So I don?t think > this needs to be fixed. > > > > Besides Encoding.UTF8 is not a UTF8 singleton. You can create multiple > different UTF8Encoding instances. We should compare encoding CodePage but on > Silverlight that property is not availabl, so we need to compare encoding > name. > > > > Tomas > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Charles Strahan > *Sent:* Tuesday, August 31, 2010 6:19 PM > *To:* ironruby-core at rubyforge.org > *Subject:* [Ironruby-core] KCoding fix for Silverlight build (issue #5093) > > > > Here's my fix for a bug in the Silverlight build (issue #5093 > ): > 690730950522e4e65a0c > > -Charles > > _______________________________________________ > 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 Wed Sep 1 04:08:55 2010 From: lists at ruby-forum.com (Jack Hong) Date: Wed, 1 Sep 2010 10:08:55 +0200 Subject: [Ironruby-core] Multipart form posted failed in IIS 7 Message-ID: <281db218737622224104fbeb0a522848@ruby-forum.com> Hopefully I can explain it well: I am testing a rails app in IIS 7. (Windows 7, IIS 7, .NET 3.5, Rails 2.3.5, Rack 1.0, IronRuby 1.0, IronRack compiled from IronRuby 1.0 source from github) Now If I add enctype="multipart/form-data" to my rails form, and then post this form to a controller, all I got is a 500 error page, no error messages written to Rack or Rails logs. It works fine if I remove multipart option. Anyone got similar problems? Thanks. Jack -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Wed Sep 1 09:44:16 2010 From: lists at ruby-forum.com (Ameer Deen) Date: Wed, 1 Sep 2010 15:44:16 +0200 Subject: [Ironruby-core] Ironruby on Rails with SQL Azure In-Reply-To: References: Message-ID: <671f4e56f4733b477ed6429d7f50bcf3@ruby-forum.com> Hi there Orion, Firstly, thanks very much for the prompt reply! I tried using IronRuby to query against my local sql server and SQL Azure. I'm a Ruby noob but I've listed below what I used. I'm able to query against both SQL servers and obtain the time and servername using Transact-SQL. As mentioned earlier, however, I was unable to use rails to connect to SQL Azure. The SQL Azure credential I've listed below is real and can be used for testing. Any other ideas? test script: ----------- require 'mscorlib' require 'System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' include System::Data::SqlClient #connection = SqlConnection.new('Server=.;Database=dev;Uid=myuser;Pwd=MyP at ssw0rd') connection = SqlConnection.new('Server=nrvk7uv6tl.database.windows.net;Database=cloudoman;Uid=myuser;Pwd=MyP at ssw0rd') connection.open command = SqlCommand.new("SELECT getdate() as my_date, @@SERVERNAME AS my_name",connection) my_reader = command.execute_reader() my_reader.each do |x| puts "Server Name: #{x['my_name'].to_s}" puts "Time: #{x['my_date'].to_s}" end my_reader.close connection.close Orion Edwards wrote: > My guess is that SQL Azure doesn't follow quite the same protocol as > normal > SQL Server. As I don't have a SQL azure account, I can't play around > with it > myself, but I'd suggest trying to get a simple command line version of > IronRuby up and running and see if you can use the raw sqlserver adapter > to > connect to SQL azure at all? -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Wed Sep 1 11:09:15 2010 From: lists at ruby-forum.com (Ameer Deen) Date: Wed, 1 Sep 2010 17:09:15 +0200 Subject: [Ironruby-core] Ironruby on Rails with SQL Azure In-Reply-To: <671f4e56f4733b477ed6429d7f50bcf3@ruby-forum.com> References: <671f4e56f4733b477ed6429d7f50bcf3@ruby-forum.com> Message-ID: <5dbde009bae241c3bf044b0775b98c94@ruby-forum.com> I was using this tutorial to get ironruby on rails running: http://ironruby.net/documentation/rails which uses the activerecord-sqlserver-adapter. I'm running rails 2.3.8. Ameer. -- Posted via http://www.ruby-forum.com/. From Tomas.Matousek at microsoft.com Wed Sep 1 20:33:59 2010 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Thu, 2 Sep 2010 00:33:59 +0000 Subject: [Ironruby-core] Could not load file or assembly Mircrosoft.Scripting" In-Reply-To: References: Message-ID: What IronRuby binaries do you use? Did you install 1.0 using IronRuby.msi? The error means that Microsoft.Scripting assembly is delay-signed and you didn't suppress strong name validation via sn -Vr *,31bf3856ad364e35 (see http://msdn.microsoft.com/en-us/library/k5b5tt23(VS.80).aspx) Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of kavin navin Sent: Wednesday, August 25, 2010 5:03 AM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] Could not load file or assembly Mircrosoft.Scripting" Even after googling I could not solve the below problem when I try to run ruby script from C# .NET using VS2010. Please help Could not load file or assembly 'Microsoft.Scripting, Version=0.9.6.20, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A) -- 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 Wed Sep 1 21:58:40 2010 From: lists at ruby-forum.com (Jack Hong) Date: Thu, 2 Sep 2010 03:58:40 +0200 Subject: [Ironruby-core] Multipart form posted failed in IIS 7 In-Reply-To: <281db218737622224104fbeb0a522848@ruby-forum.com> References: <281db218737622224104fbeb0a522848@ruby-forum.com> Message-ID: Finally the error was written into the rails log: Status: 500 Internal Server Error bad content body C:/ironruby/lib/ironruby/gems/1.8/gems/rack-1.0.1/lib/rack/utils.rb:319:in `parse_multipart' C:/ironruby/lib/ironruby/gems/1.8/gems/rack-1.0.1/lib/rack/request.rb:132:in `POST' C:/ironruby/lib/ironruby/gems/1.8/gems/rack-1.0.1/lib/rack/methodoverride.rb:15:in `call' C:/ironruby/lib/ironruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/params_parser.rb:15:in `call' C:/ironruby/lib/ironruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/session/cookie_store.rb:93:in `call' C:/ironruby/lib/ironruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/failsafe.rb:26:in `call' C:/ironruby/lib/ironruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call' C:/ironruby/lib/ironruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `synchronize' C:/ironruby/lib/ironruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call' ... What puzzled me is why it is working when just use rackup, but not in IIS. Jack Hong wrote: > Hopefully I can explain it well: > > I am testing a rails app in IIS 7. > (Windows 7, IIS 7, .NET 3.5, Rails 2.3.5, Rack 1.0, IronRuby 1.0, > IronRack compiled from IronRuby 1.0 source from github) > > Now If I add enctype="multipart/form-data" to my rails form, and then > post this form to a controller, all I got is a 500 error page, no error > messages written to Rack or Rails logs. It works fine if I remove > multipart option. > > Anyone got similar problems? > > Thanks. > > Jack -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Sep 2 07:54:19 2010 From: lists at ruby-forum.com (Ameer Deen) Date: Thu, 2 Sep 2010 13:54:19 +0200 Subject: [Ironruby-core] Ironruby on Rails with SQL Azure In-Reply-To: <5dbde009bae241c3bf044b0775b98c94@ruby-forum.com> References: <671f4e56f4733b477ed6429d7f50bcf3@ruby-forum.com> <5dbde009bae241c3bf044b0775b98c94@ruby-forum.com> Message-ID: <1ff59e6df04a11d7b77f5be7eda9295f@ruby-forum.com> Got it. There's a small issue with sqlserver_adapter.rb and the way Micrsoft Azure advertises it's version. There is a database_year function that tries to determine the version of SQL Server from the output of the following query: "SELECT @@version" For Non Azure SQL Server databases, the output is similar to the following: "Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 (Intel X86) .." the database_year funtion grabs the SQL Server version from the 4 digits following the word "Microsoft SQL Server": DATABASE_VERSION_REGEXP = /Microsoft SQL Server\s+(\d{4})/ def database_year DATABASE_VERSION_REGEXP.match(database_version)[1].to_i end In Azure, however, the query returns a different string: "Microsoft SQL Azure (RTM) - 10.25.9386.0 .." That database_year function, as a result returns a nil string and breaks. As a test, I just changed the function to: def database_year 2008 end and I was able to connect my rails application to SQL Azure. There just needs to be a smarter way to ascertain the SQL Server version. Possible match up the 10.XX version number with the SQL Server 2005/2008 etc versions. Thanks very much for the help. Ameer -- Posted via http://www.ruby-forum.com/. From will at hotgazpacho.org Thu Sep 2 12:03:16 2010 From: will at hotgazpacho.org (Will Green) Date: Thu, 2 Sep 2010 12:03:16 -0400 Subject: [Ironruby-core] Ironruby on Rails with SQL Azure In-Reply-To: <1ff59e6df04a11d7b77f5be7eda9295f@ruby-forum.com> References: <671f4e56f4733b477ed6429d7f50bcf3@ruby-forum.com> <5dbde009bae241c3bf044b0775b98c94@ruby-forum.com> <1ff59e6df04a11d7b77f5be7eda9295f@ruby-forum.com> Message-ID: Should probably change the RegExp to match after the dash (10.x.x.x), and use that as the version, rather than, e.g., 2008, 2005, 2000, etc. -- Will Green http://hotgazpacho.org/ On Thu, Sep 2, 2010 at 7:54 AM, Ameer Deen wrote: > Got it. There's a small issue with sqlserver_adapter.rb and the way > Micrsoft Azure advertises it's version. > > There is a database_year function that tries to determine the version of > SQL Server from the output of the following query: > > "SELECT @@version" > > For Non Azure SQL Server databases, the output is similar to the > following: > > "Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 (Intel X86) .. blah>" > > the database_year funtion grabs the SQL Server version from the 4 digits > following the word "Microsoft SQL Server": > > > DATABASE_VERSION_REGEXP = /Microsoft SQL Server\s+(\d{4})/ > > def database_year > DATABASE_VERSION_REGEXP.match(database_version)[1].to_i > end > > In Azure, however, the query returns a different string: > > "Microsoft SQL Azure (RTM) - 10.25.9386.0 .." > > That database_year function, as a result returns a nil string and > breaks. As a test, I just changed the function to: > > def database_year > 2008 > end > > and I was able to connect my rails application to SQL Azure. There just > needs to be a smarter way to ascertain the SQL Server version. Possible > match up the 10.XX version number with the SQL Server 2005/2008 etc > versions. > > > Thanks very much for the help. > > Ameer > > > -- > 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 Tomas.Matousek at microsoft.com Thu Sep 2 13:56:22 2010 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Thu, 2 Sep 2010 17:56:22 +0000 Subject: [Ironruby-core] Review: miscellaneous fixes In-Reply-To: References: Message-ID: I've just merged your changes into the main repo. Sorry for the delay, we had some technical problems with our sync server. Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Daniele Alessandri Sent: Sunday, August 22, 2010 2:45 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Review: miscellaneous fixes On Sun, Aug 22, 2010 at 02:43, Tomas Matousek wrote: I have rebased my local branch on top of your latest changes and removed the unneeded commits, now everything is available on my remote repository in a separate topic branch (see http://github.com/nrk/ironruby/tree/corelib19). The three commits "survived" are: 793effd Implement Array#pop(n). 503002f Fix: Object#=~ returns nil matching any object. 7a6275b Update the unsigned version of App.config to pick the right library paths for 1.9. See http://github.com/nrk/ironruby/compare/014e640ed27c28ff97fb...793effd4d75f39f36ff3 There are also new changes in that branch, but I'm going to post a new message with a separate diff for those. > 304459b Implement various fixes to Kernel and Array related to the > trust status of Object instances. > > [Better fix would be: > return stream.String.TaintBy(format); Fix applied... and it actually lead me to notice a bug related to operations on the trust status of MutableString instances (see below): >>> "".untrust => "" >>> "".untrust.untrust (ir):1:in `untrust': can't modify frozen object (RuntimeError) from (ir):1 >>> "".untrust.trust (ir):1:in `trust': can't modify frozen object (RuntimeError) from (ir):1 >>> "".trust.untrust => "" > Note that context.TaintObjectBy should only be used on objects that > are not statically typed to a type that implements IRubyObjectState. > MutableString does. Ah, right! >> - If nothing has changed since the last time, I guess you can't still >> merge changes coming from the community that don't apply to parts of >> IronRuby outside Libraries.LCA_RESTRICTED, right? > [Nothing changed yet.] I think I still need to find a decent workflow when working on stuff that can't be merged back by you because of the current constraints, maybe I'll just limit myself to do some experiments in a further branch and report back just like I did in my previous mail. > [I'm not sure this is needed. Instead I modified TaintObjectBy to copy > trustiness as well - it seems that most of the time "trust" and > "taint" are both copied. > This makes the changes in KernelOps.cs unnecessary (Clone, Trust, > Untrust, Taint, Untaint). And also the change in IListOps.Repetition and Compact. > ] If trust and taint are both copied then yes, I agree that's the way to go. I just wasn't sure about this behaviour so I thought that keeping them separate (with maybe a new method in RubyContext such as CopyFlags or anything along this line) might have been safer. -- Daniele Alessandri http://clorophilla.net/ http://twitter.com/JoL1hAHN _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From lists at ruby-forum.com Sat Sep 4 01:08:28 2010 From: lists at ruby-forum.com (Eduardo Blumenfeld) Date: Sat, 4 Sep 2010 07:08:28 +0200 Subject: [Ironruby-core] mscorlib:0:in `ThrowArgumentException' error In-Reply-To: References: <4c71515acf490b733c4e7ce351044707@ruby-forum.com> <59e7eb345957a04a34e0f6ddae448e33@ruby-forum.com> Message-ID: <10e502ae5100189fa32b1a653473b8cd@ruby-forum.com> Hi all, Unfortunately it didn't work, I believe that there is some kind of problem in mscorlib when you try to do an eval inside a loop with active record objects. Eduardo Blumenfeld wrote: > Thank you Charles for the answer, > > config is an active record produced list, an array of rows brought from > a sql table that has one of its attributes (table column) => > :QuantityPer > > This is the portion of the code I'm using > -------------- > config = Term.find_by_sql("sp_someStoredProc @someparameter=#{param1}") > config.each { |xx| if xx[:QuantityPer].nil? then nil else > if xx[:QuantityPer].include? '#{' then > xxx = xx[:QuantityPer].to_s > xxx = xxx[2..(xxx.size-2)] > puts xxx # => "some_proc(argument,argument2)" I see in the console the xxx variable... if at this point I put this code: -------------------- puts "#{xxx}" -------------------- it just prints (again) the xxx variable without evaluating it at all if at this point I put this code instead: -------------------- aaa = eval(xxx) -------------------- then I get this error: mscorlib:0:in `ThrowArgumentException': An item with the same key has already been added. (ArgumentError) from mscorlib:0:in `Insert' Any pointers? Is that an mscorlib bug? -- Posted via http://www.ruby-forum.com/. From ralinx at davybrion.com Sat Sep 4 09:03:47 2010 From: ralinx at davybrion.com (Davy Brion) Date: Sat, 4 Sep 2010 15:03:47 +0200 Subject: [Ironruby-core] using Ruby types in .NET: anything to watch out for? Message-ID: Hi all, first of all: thanks for this great project and the effort you've put into it, it's very much appreciated :) I plan on making extensive use of ruby object instances in my .NET code. With that i mean that we have a certain object model written in Ruby, and we'd like to use that in our .NET code. We're going to use those instances quite a lot, so i just wanted to check if there are any known pitfalls to watch out for when doing this. The reason i'm asking is because most of the docs and the examples i've seen focus on the opposite approach: using .NET instances in Ruby. I've done some preliminary experiments and my ruby instances work just fine when i call them from .NET... but i'm hoping to get some feedback here from people who have more extensive experience with this. brs, Davy -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Sun Sep 5 18:59:54 2010 From: lists at ruby-forum.com (Eduardo Blumenfeld) Date: Mon, 6 Sep 2010 00:59:54 +0200 Subject: [Ironruby-core] mscorlib:0:in `ThrowArgumentException' error In-Reply-To: <10e502ae5100189fa32b1a653473b8cd@ruby-forum.com> References: <4c71515acf490b733c4e7ce351044707@ruby-forum.com> <59e7eb345957a04a34e0f6ddae448e33@ruby-forum.com> <10e502ae5100189fa32b1a653473b8cd@ruby-forum.com> Message-ID: <90c6a685a76b7878e0f4fe0758892d35@ruby-forum.com> Hi all, I finally solved the issue: By calling another procedure and within that procedure do the eval, it works perfectly. However, this seems to be a bug anyways... Regards, Eduardo -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Sep 6 05:45:20 2010 From: lists at ruby-forum.com (kavin navin) Date: Mon, 6 Sep 2010 11:45:20 +0200 Subject: [Ironruby-core] Could not load file or assembly Mircrosoft.Scripting" In-Reply-To: References: Message-ID: kavin navin wrote: > Even after googling I could not solve the below problem when I try to > run ruby script from C# .NET using VS2010. Please help > > Could not load file or assembly 'Microsoft.Scripting, Version=0.9.6.20, > Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its > dependencies. Strong name validation failed. (Exception from HRESULT: > 0x8013141A) I could successfully compile now, after I downloaded the dll's again from the website mentioned below http://www.ironshay.com/post/Starting-Using-IronRuby-in-25-Minutes.aspx -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Sep 6 05:47:20 2010 From: lists at ruby-forum.com (kavin navin) Date: Mon, 6 Sep 2010 11:47:20 +0200 Subject: [Ironruby-core] =?utf-8?q?Could_not_load_file_or_assembly=09Mircr?= =?utf-8?q?osoft=2EScripting=22?= In-Reply-To: References: Message-ID: <078aa9373ad5fda9c04ebfee30af2d78@ruby-forum.com> Tomas Matousek wrote: > What IronRuby binaries do you use? Did you install 1.0 using > IronRuby.msi? > > The error means that Microsoft.Scripting assembly is delay-signed and > you didn't suppress strong name validation via sn -Vr *,31bf3856ad364e35 > (see http://msdn.microsoft.com/en-us/library/k5b5tt23(VS.80).aspx) > > Tomas Thankyou Tomas. Yes I did install Iron Ruby 1.0 using IronRuby.msi. Thankyou the problem is solved now -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Sep 6 05:50:46 2010 From: lists at ruby-forum.com (kavin navin) Date: Mon, 6 Sep 2010 11:50:46 +0200 Subject: [Ironruby-core] IronRuby and Cucumber Message-ID: Hi, While I was trying to integrate Iron Ruby and Cucumber the installation succeeded without any problems. But when I wanted to execute some examples for CS folder I found the folder to be missing. Can anyone please let me know where the folder is available. I am using cucumber-0.6.4 and there is no folder for CS examples. -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Sep 6 23:00:46 2010 From: lists at ruby-forum.com (Eduardo Blumenfeld) Date: Tue, 7 Sep 2010 05:00:46 +0200 Subject: [Ironruby-core] ActiveRecord loading veeeery slow In-Reply-To: References: <8ddd6805a7fd481aba32ff6d1bf89592@ruby-forum.com> Message-ID: <2fc4359d4509c61901db3f15bd3e04ea@ruby-forum.com> Hi all, I finally figured out the problem (weird tough). It happens to be that I was using also (from the calling top-level program) the following call: load_assembly "Microsoft.Office.Interop.Excel" include Microsoft::Office::Interop::Excel I don't have the reason why this happened, but just by moving those calls to a place after the ----------------------- require 'db_lib.rb' ----------------------- that called the (previously) slow "connect" call, the time went from 14 seconds to 1 second (or less) My guess about the problem may be that by including the Microsoft::Office::Interop::Excel the ironruby adds a huge quantity of objects to inspect for a "method_missing" that works in the active_record gem, specially in the establish_connection method. Could my guess be correct? Regards to all!!! and keep working with IronRuby, IT ROCKS!!! Eduardo Blumenfeld -- Posted via http://www.ruby-forum.com/. From ralinx at davybrion.com Tue Sep 7 04:36:46 2010 From: ralinx at davybrion.com (Davy Brion) Date: Tue, 7 Sep 2010 10:36:46 +0200 Subject: [Ironruby-core] accessor methods and property syntax in .NET Message-ID: Hi all, IronRuby has a nice trick where attributes defined by attr_reader, attr_accessor and attr_writer are usable as properties from C#... i was just wondering: is it possible to use the same trick in our own ruby code? or can anyone just point me in the right direction as to where in the IronRuby source code i could find where this is being done? I have accessor methods that really need to do something specific and ideally, i'd like them be usable as properties in .NET since it leads to a much nicer syntax in C# brs, Davy -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan at flanders.co.nz Tue Sep 7 05:01:16 2010 From: ivan at flanders.co.nz (Ivan Porto Carerro) Date: Tue, 7 Sep 2010 11:01:16 +0200 Subject: [Ironruby-core] accessor methods and property syntax in .NET In-Reply-To: References: Message-ID: You can just define them as attr_accessors and then implement the methods class Foo attr_accessor :bar, :baz def bar=(val) # do more stuff here for example @bar = val end def bar @bar end end On Tue, Sep 7, 2010 at 10:36 AM, Davy Brion wrote: > Hi all, > > IronRuby has a nice trick where attributes defined by attr_reader, > attr_accessor and attr_writer are usable as properties from C#... i was just > wondering: is it possible to use the same trick in our own ruby code? > > or can anyone just point me in the right direction as to where in the > IronRuby source code i could find where this is being done? > > I have accessor methods that really need to do something specific and > ideally, i'd like them be usable as properties in .NET since it leads to a > much nicer syntax in C# > > brs, > Davy > > _______________________________________________ > 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 ralinx at davybrion.com Tue Sep 7 05:13:44 2010 From: ralinx at davybrion.com (Davy Brion) Date: Tue, 7 Sep 2010 11:13:44 +0200 Subject: [Ironruby-core] accessor methods and property syntax in .NET In-Reply-To: References: Message-ID: if i do that, calling bar as a property like this: var value = myObject.bar; leads to 'value' being an instance of IronRuby.BuiltIns.RubyMethod, and not the value that is in the @bar instance field which i'm using 1.1 btw, not sure how this would behave on 1.0 from looking at the IronRuby source code, it looks like i need to find a way to change the RubyMemberInfo for a given accessor method to RubyAttributeReaderInfo or RubyAttributeWriterInfo On Tue, Sep 7, 2010 at 11:01 AM, Ivan Porto Carerro wrote: > You can just define them as attr_accessors and then implement the methods > > class Foo > > attr_accessor :bar, :baz > > def bar=(val) > # do more stuff here for example > @bar = val > end > > def bar > @bar > end > > end > > On Tue, Sep 7, 2010 at 10:36 AM, Davy Brion wrote: > >> Hi all, >> >> IronRuby has a nice trick where attributes defined by attr_reader, >> attr_accessor and attr_writer are usable as properties from C#... i was just >> wondering: is it possible to use the same trick in our own ruby code? >> >> or can anyone just point me in the right direction as to where in the >> IronRuby source code i could find where this is being done? >> >> I have accessor methods that really need to do something specific and >> ideally, i'd like them be usable as properties in .NET since it leads to a >> much nicer syntax in C# >> >> brs, >> Davy >> >> _______________________________________________ >> 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 ralinx at davybrion.com Tue Sep 7 05:55:38 2010 From: ralinx at davybrion.com (Davy Brion) Date: Tue, 7 Sep 2010 11:55:38 +0200 Subject: [Ironruby-core] accessor methods and property syntax in .NET In-Reply-To: References: Message-ID: your solution does however work for the assignment accessor... in fact, you can do something like this: class Foo attr_reader :bar def bar=(val) # do more stuff here for example @bar = val end end and then you can do the following in C#: var value = myObject.bar; myObject.bar = someOtherValue; for my specific scenario, i think i can actually get by with just overriding the assignment accessor but the thing i'm wondering is: is the current behavior actually a bug? and will this behavior be preserved in future releases? On Tue, Sep 7, 2010 at 11:13 AM, Davy Brion wrote: > if i do that, calling bar as a property like this: > > var value = myObject.bar; > > leads to 'value' being an instance of IronRuby.BuiltIns.RubyMethod, and not > the value that is in the @bar instance field > > which > > i'm using 1.1 btw, not sure how this would behave on 1.0 > > from looking at the IronRuby source code, it looks like i need to find a > way to change the RubyMemberInfo for a given accessor method to > RubyAttributeReaderInfo or RubyAttributeWriterInfo > > > On Tue, Sep 7, 2010 at 11:01 AM, Ivan Porto Carerro wrote: > >> You can just define them as attr_accessors and then implement the methods >> >> class Foo >> >> attr_accessor :bar, :baz >> >> def bar=(val) >> # do more stuff here for example >> @bar = val >> end >> >> def bar >> @bar >> end >> >> end >> >> On Tue, Sep 7, 2010 at 10:36 AM, Davy Brion wrote: >> >>> Hi all, >>> >>> IronRuby has a nice trick where attributes defined by attr_reader, >>> attr_accessor and attr_writer are usable as properties from C#... i was just >>> wondering: is it possible to use the same trick in our own ruby code? >>> >>> or can anyone just point me in the right direction as to where in the >>> IronRuby source code i could find where this is being done? >>> >>> I have accessor methods that really need to do something specific and >>> ideally, i'd like them be usable as properties in .NET since it leads to a >>> much nicer syntax in C# >>> >>> brs, >>> Davy >>> >>> _______________________________________________ >>> 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 Tue Sep 7 07:14:57 2010 From: lists at ruby-forum.com (kavin guest) Date: Tue, 7 Sep 2010 13:14:57 +0200 Subject: [Ironruby-core] Help required in running icucumber for CS examples Message-ID: <5e9f6d1a12418ee3a7dfe37f76756682@ruby-forum.com> Hello All, After installing Iron ruby1.0 and cucumber-0.6.4 everything worked fine till compile.bat was executed. But when I executed icucumber features for cs examples I am getting the below error. I googled several times but could not solve the problem, Any Help would be highly Appreciated as I am stuck now C:\ironruby\lib\ironruby\gems\1.8\gems\cucumber-0.6.4\examples\cs>compile C:\ironruby\lib\ironruby\gems\1.8\gems\cucumber-0.6.4\examples\cs>csc /target:li brary /out:Calculator.dll src\demo\Calculator.cs Microsoft (R) Visual C# 2008 Compiler version 3.5.30729.1 for Microsoft (R) .NET Framework version 3.5 Copyright (C) Microsoft Corporation. All rights reserved. C:\ironruby\lib\ironruby\gems\1.8\gems\cucumber-0.6.4\examples\cs>icucumber feat ures *** WARNING: You must "igem install iron-term-ansicolor" to get coloured ouput i n on IronRuby no such file to load -- spec/expectations (LoadError) C:/IronRuby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:30:in `require' C:/IronRuby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:30:in `require' C:/IronRuby/lib/ironruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:63:in `req uire' C:/ironruby/lib/ironruby/gems/1.8/gems/cucumber-0.6.4/examples/cs/features/step_ definitons/calculator_steps.rb:1 C:/IronRuby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:30:in `require' C:/IronRuby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:30:in `require' C:/IronRuby/lib/ironruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:63:in `req uire' C:/IronRuby/lib/ironruby/gems/1.8/gems/cucumber-0.6.4/bin/../lib/cucumber/rb_sup port/rb_language.rb:124:in `load_code_file' C:/IronRuby/lib/ironruby/gems/1.8/gems/cucumber-0.6.4/bin/../lib/cucumber/step_m other.rb:85:in `load_code_file' C:/IronRuby/lib/ironruby/gems/1.8/gems/cucumber-0.6.4/bin/../lib/cucumber/step_m other.rb:77:in `load_code_files' C:/IronRuby/lib/ironruby/gems/1.8/gems/cucumber-0.6.4/bin/../lib/cucumber/step_m other.rb:76:in `each' C:/IronRuby/lib/ironruby/gems/1.8/gems/cucumber-0.6.4/bin/../lib/cucumber/step_m other.rb:76:in `load_code_files' C:/IronRuby/lib/ironruby/gems/1.8/gems/cucumber-0.6.4/bin/../lib/cucumber/cli/ma in.rb:51:in `execute!' C:/IronRuby/lib/ironruby/gems/1.8/gems/cucumber-0.6.4/bin/../lib/cucumber/cli/ma in.rb:20:in `execute' C:/IronRuby/lib/ironruby/gems/1.8/gems/cucumber-0.6.4/bin/cucumber:8 C:/Ruby19/bin/cucumber:19:in `load' C:/Ruby19/bin/cucumber:19 -- Posted via http://www.ruby-forum.com/. From shay.friedman at gmail.com Tue Sep 7 08:41:02 2010 From: shay.friedman at gmail.com (Shay Friedman) Date: Tue, 7 Sep 2010 15:41:02 +0300 Subject: [Ironruby-core] IronRuby and Cucumber In-Reply-To: References: Message-ID: Hi Kevin, I found the answer to your question here: http://blog.webintellix.com/2009/10/how-to-use-cucumber-with-net-and-c.html. This is what the guy there says: "As of version 0.4.3 of Cucumber, the examples\cs folder is no longer there in the code downloaded with the gem. If you like to run the above code in the post, you can download the zip file for the code at tag 0.4.2 from here. >From the top, you can download the zip by clicking on the "Download Source". Then you can copy the "cs" folder to your gem installation of your current cucumber version.". Shay. -------------------------------------------------------- Shay Friedman | Microsoft Visual C#/IronRuby MVP | Author of IronRuby Unleashed and ASP.NET 4 Programmer's Reference | Co-Founder of CodeValue Blog: http://IronShay.com | Twitter: http://twitter.com/ironshay On Mon, Sep 6, 2010 at 12:50 PM, kavin navin wrote: > Hi, > > While I was trying to integrate Iron Ruby and Cucumber the installation > succeeded without any problems. > > But when I wanted to execute some examples for CS folder I found the > folder to be missing. > > Can anyone please let me know where the folder is available. > > I am using cucumber-0.6.4 and there is no folder for CS examples. > -- > 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 briangenisio at gmail.com Tue Sep 7 08:47:00 2010 From: briangenisio at gmail.com (Brian Genisio) Date: Tue, 7 Sep 2010 08:47:00 -0400 Subject: [Ironruby-core] accessor methods and property syntax in .NET In-Reply-To: References: Message-ID: Actually, we discussed this about a month ago: http://rubyforge.org/pipermail/ironruby-core/2010-July/007154.html The outcome was that a feature request was added to allow for C# properties to be defined using getter/setter in ruby. I was going to look at implementing it... got into a bit, and had a baby... Haven't looked at it since. B On Tue, Sep 7, 2010 at 5:55 AM, Davy Brion wrote: > your solution does however work for the assignment accessor... in fact, you > can do something like this: > > class Foo > attr_reader :bar > > > def bar=(val) > # do more stuff here for example > @bar = val > end > > end > > and then you can do the following in C#: > > var value = myObject.bar; > myObject.bar = someOtherValue; > > for my specific scenario, i think i can actually get by with just > overriding the assignment accessor but the thing i'm wondering is: is the > current behavior actually a bug? and will this behavior be preserved in > future releases? > > > On Tue, Sep 7, 2010 at 11:13 AM, Davy Brion wrote: > >> if i do that, calling bar as a property like this: >> >> var value = myObject.bar; >> >> leads to 'value' being an instance of IronRuby.BuiltIns.RubyMethod, and >> not the value that is in the @bar instance field >> >> which >> >> i'm using 1.1 btw, not sure how this would behave on 1.0 >> >> from looking at the IronRuby source code, it looks like i need to find a >> way to change the RubyMemberInfo for a given accessor method to >> RubyAttributeReaderInfo or RubyAttributeWriterInfo >> >> >> On Tue, Sep 7, 2010 at 11:01 AM, Ivan Porto Carerro wrote: >> >>> You can just define them as attr_accessors and then implement the methods >>> >>> class Foo >>> >>> attr_accessor :bar, :baz >>> >>> def bar=(val) >>> # do more stuff here for example >>> @bar = val >>> end >>> >>> def bar >>> @bar >>> end >>> >>> end >>> >>> On Tue, Sep 7, 2010 at 10:36 AM, Davy Brion wrote: >>> >>>> Hi all, >>>> >>>> IronRuby has a nice trick where attributes defined by attr_reader, >>>> attr_accessor and attr_writer are usable as properties from C#... i was just >>>> wondering: is it possible to use the same trick in our own ruby code? >>>> >>>> or can anyone just point me in the right direction as to where in the >>>> IronRuby source code i could find where this is being done? >>>> >>>> I have accessor methods that really need to do something specific and >>>> ideally, i'd like them be usable as properties in .NET since it leads to a >>>> much nicer syntax in C# >>>> >>>> brs, >>>> Davy >>>> >>>> _______________________________________________ >>>> 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 ralinx at davybrion.com Tue Sep 7 08:50:55 2010 From: ralinx at davybrion.com (Davy Brion) Date: Tue, 7 Sep 2010 14:50:55 +0200 Subject: [Ironruby-core] accessor methods and property syntax in .NET In-Reply-To: References: Message-ID: Hey Brian, i saw that thread, but didn't really see a definitive answer as to how to work around it until it's implemented (though i might've missed it), which is why i thought i'd raise the question again :) On Tue, Sep 7, 2010 at 2:47 PM, Brian Genisio wrote: > Actually, we discussed this about a month ago: > http://rubyforge.org/pipermail/ironruby-core/2010-July/007154.html > > The > outcome was that a feature request was added to allow for C# properties to > be defined using getter/setter in ruby. I was going to look at implementing > it... got into a bit, and had a baby... Haven't looked at it since. > > B > > > On Tue, Sep 7, 2010 at 5:55 AM, Davy Brion wrote: > >> your solution does however work for the assignment accessor... in fact, >> you can do something like this: >> >> class Foo >> attr_reader :bar >> >> >> def bar=(val) >> # do more stuff here for example >> @bar = val >> end >> >> end >> >> and then you can do the following in C#: >> >> var value = myObject.bar; >> myObject.bar = someOtherValue; >> >> for my specific scenario, i think i can actually get by with just >> overriding the assignment accessor but the thing i'm wondering is: is the >> current behavior actually a bug? and will this behavior be preserved in >> future releases? >> >> >> On Tue, Sep 7, 2010 at 11:13 AM, Davy Brion wrote: >> >>> if i do that, calling bar as a property like this: >>> >>> var value = myObject.bar; >>> >>> leads to 'value' being an instance of IronRuby.BuiltIns.RubyMethod, and >>> not the value that is in the @bar instance field >>> >>> which >>> >>> i'm using 1.1 btw, not sure how this would behave on 1.0 >>> >>> from looking at the IronRuby source code, it looks like i need to find a >>> way to change the RubyMemberInfo for a given accessor method to >>> RubyAttributeReaderInfo or RubyAttributeWriterInfo >>> >>> >>> On Tue, Sep 7, 2010 at 11:01 AM, Ivan Porto Carerro >> > wrote: >>> >>>> You can just define them as attr_accessors and then implement the >>>> methods >>>> >>>> class Foo >>>> >>>> attr_accessor :bar, :baz >>>> >>>> def bar=(val) >>>> # do more stuff here for example >>>> @bar = val >>>> end >>>> >>>> def bar >>>> @bar >>>> end >>>> >>>> end >>>> >>>> On Tue, Sep 7, 2010 at 10:36 AM, Davy Brion wrote: >>>> >>>>> Hi all, >>>>> >>>>> IronRuby has a nice trick where attributes defined by attr_reader, >>>>> attr_accessor and attr_writer are usable as properties from C#... i was just >>>>> wondering: is it possible to use the same trick in our own ruby code? >>>>> >>>>> or can anyone just point me in the right direction as to where in the >>>>> IronRuby source code i could find where this is being done? >>>>> >>>>> I have accessor methods that really need to do something specific and >>>>> ideally, i'd like them be usable as properties in .NET since it leads to a >>>>> much nicer syntax in C# >>>>> >>>>> brs, >>>>> Davy >>>>> >>>>> _______________________________________________ >>>>> 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 shay.friedman at gmail.com Tue Sep 7 08:56:52 2010 From: shay.friedman at gmail.com (Shay Friedman) Date: Tue, 7 Sep 2010 15:56:52 +0300 Subject: [Ironruby-core] accessor methods and property syntax in .NET In-Reply-To: References: Message-ID: Beware! Contributing to the IronRuby source code might result in having babies!!! :-) Congratulations Brian! On Tue, Sep 7, 2010 at 3:47 PM, Brian Genisio wrote: > Actually, we discussed this about a month ago: > http://rubyforge.org/pipermail/ironruby-core/2010-July/007154.html > > The > outcome was that a feature request was added to allow for C# properties to > be defined using getter/setter in ruby. I was going to look at implementing > it... got into a bit, and had a baby... Haven't looked at it since. > > B > > > On Tue, Sep 7, 2010 at 5:55 AM, Davy Brion wrote: > >> your solution does however work for the assignment accessor... in fact, >> you can do something like this: >> >> class Foo >> attr_reader :bar >> >> >> def bar=(val) >> # do more stuff here for example >> @bar = val >> end >> >> end >> >> and then you can do the following in C#: >> >> var value = myObject.bar; >> myObject.bar = someOtherValue; >> >> for my specific scenario, i think i can actually get by with just >> overriding the assignment accessor but the thing i'm wondering is: is the >> current behavior actually a bug? and will this behavior be preserved in >> future releases? >> >> >> On Tue, Sep 7, 2010 at 11:13 AM, Davy Brion wrote: >> >>> if i do that, calling bar as a property like this: >>> >>> var value = myObject.bar; >>> >>> leads to 'value' being an instance of IronRuby.BuiltIns.RubyMethod, and >>> not the value that is in the @bar instance field >>> >>> which >>> >>> i'm using 1.1 btw, not sure how this would behave on 1.0 >>> >>> from looking at the IronRuby source code, it looks like i need to find a >>> way to change the RubyMemberInfo for a given accessor method to >>> RubyAttributeReaderInfo or RubyAttributeWriterInfo >>> >>> >>> On Tue, Sep 7, 2010 at 11:01 AM, Ivan Porto Carerro >> > wrote: >>> >>>> You can just define them as attr_accessors and then implement the >>>> methods >>>> >>>> class Foo >>>> >>>> attr_accessor :bar, :baz >>>> >>>> def bar=(val) >>>> # do more stuff here for example >>>> @bar = val >>>> end >>>> >>>> def bar >>>> @bar >>>> end >>>> >>>> end >>>> >>>> On Tue, Sep 7, 2010 at 10:36 AM, Davy Brion wrote: >>>> >>>>> Hi all, >>>>> >>>>> IronRuby has a nice trick where attributes defined by attr_reader, >>>>> attr_accessor and attr_writer are usable as properties from C#... i was just >>>>> wondering: is it possible to use the same trick in our own ruby code? >>>>> >>>>> or can anyone just point me in the right direction as to where in the >>>>> IronRuby source code i could find where this is being done? >>>>> >>>>> I have accessor methods that really need to do something specific and >>>>> ideally, i'd like them be usable as properties in .NET since it leads to a >>>>> much nicer syntax in C# >>>>> >>>>> brs, >>>>> Davy >>>>> >>>>> _______________________________________________ >>>>> 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 lists at ruby-forum.com Tue Sep 7 10:52:22 2010 From: lists at ruby-forum.com (kavin_2010 IronRubyuser) Date: Tue, 7 Sep 2010 16:52:22 +0200 Subject: [Ironruby-core] IronRuby and Cucumber In-Reply-To: References: Message-ID: <928639680cc1a6f6bec6fbae0b50cbe1@ruby-forum.com> Hi Shay, Thankyou for the answer. Yes the problem got solved. I got the examples for the cs folder from the below site and compiled. The instruction states that we need to do compile.bat. This worked fine and the dll got generated for me. After this I am stuck and cucumber feature files are not getting generated. Any help from your side is highly appreciated. I am getting the below error. C:\ironruby\lib\ironruby\gems\1.8\gems\cucumber-0.6.4\examples\cs>compile C:\ironruby\lib\ironruby\gems\1.8\gems\cucumber-0.6.4\examples\cs>csc /target:li brary /out:Calculator.dll src\demo\Calculator.cs Microsoft (R) Visual C# 2008 Compiler version 3.5.30729.1 for Microsoft (R) .NET Framework version 3.5 Copyright (C) Microsoft Corporation. All rights reserved. C:\ironruby\lib\ironruby\gems\1.8\gems\cucumber-0.6.4\examples\cs>icucumber feat ures *** WARNING: You must "igem install iron-term-ansicolor" to get coloured ouput i n on IronRuby no such file to load -- spec/expectations (LoadError) C:/IronRuby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:30:in `require' C:/IronRuby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:30:in `require' C:/IronRuby/lib/ironruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:63:in `req uire' C:/ironruby/lib/ironruby/gems/1.8/gems/cucumber-0.6.4/examples/cs/features/step_ definitons/calculator_steps.rb:1 C:/IronRuby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:30:in `require' C:/IronRuby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:30:in `require' C:/IronRuby/lib/ironruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:63:in `req uire' C:/IronRuby/lib/ironruby/gems/1.8/gems/cucumber-0.6.4/bin/../lib/cucumber/rb_sup port/rb_language.rb:124:in `load_code_file' C:/IronRuby/lib/ironruby/gems/1.8/gems/cucumber-0.6.4/bin/../lib/cucumber/step_m other.rb:85:in `load_code_file' C:/IronRuby/lib/ironruby/gems/1.8/gems/cucumber-0.6.4/bin/../lib/cucumber/step_m other.rb:77:in `load_code_files' C:/IronRuby/lib/ironruby/gems/1.8/gems/cucumber-0.6.4/bin/../lib/cucumber/step_m other.rb:76:in `each' C:/IronRuby/lib/ironruby/gems/1.8/gems/cucumber-0.6.4/bin/../lib/cucumber/step_m other.rb:76:in `load_code_files' C:/IronRuby/lib/ironruby/gems/1.8/gems/cucumber-0.6.4/bin/../lib/cucumber/cli/ma in.rb:51:in `execute!' C:/IronRuby/lib/ironruby/gems/1.8/gems/cucumber-0.6.4/bin/../lib/cucumber/cli/ma in.rb:20:in `execute' C:/IronRuby/lib/ironruby/gems/1.8/gems/cucumber-0.6.4/bin/cucumber:8 C:/Ruby19/bin/cucumber:19:in `load' C:/Ruby19/bin/cucumber:19 Shay Friedman wrote: > Hi Kevin, > > I found the answer to your question here: > http://blog.webintellix.com/2009/10/how-to-use-cucumber-with-net-and-c.html. > This is what the guy there says: > "As of version 0.4.3 of Cucumber, the examples\cs folder is no longer > there > in the code downloaded with the gem. If you like to run the above code > in > the post, you can download the zip file for the code at tag 0.4.2 from > here. >>From the top, you can download the zip by clicking on the "Download Source". > Then you can copy the "cs" folder to your gem installation of your > current > cucumber version.". > > Shay. > -------------------------------------------------------- > Shay Friedman | Microsoft Visual C#/IronRuby MVP | Author of IronRuby > Unleashed and ASP.NET 4 Programmer's Reference | Co-Founder of CodeValue > Blog: http://IronShay.com | Twitter: http://twitter.com/ironshay -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Tue Sep 7 10:59:54 2010 From: lists at ruby-forum.com (kavin_2010 IronRubyuser) Date: Tue, 7 Sep 2010 16:59:54 +0200 Subject: [Ironruby-core] IronRuby and Cucumber In-Reply-To: <928639680cc1a6f6bec6fbae0b50cbe1@ruby-forum.com> References: <928639680cc1a6f6bec6fbae0b50cbe1@ruby-forum.com> Message-ID: <8becec9f4fc55d8e16232e4a149a94ff@ruby-forum.com> Hi Shay, I have been closely following the details mentioned in your website for the past two weeks. The example solution file for running IronRuby using .NET and VS2008 was very helpful for me. I succeeded in running IronRuby scripts using the sample provided by you. Thankyou for the same. kavin >> Hi Kevin, > >> >> I found the answer to your question here: >> http://blog.webintellix.com/2009/10/how-to-use-cucumber-with-net-and-c.html. >> This is what the guy there says: >> "As of version 0.4.3 of Cucumber, the examples\cs folder is no longer >> there >> in the code downloaded with the gem. If you like to run the above code >> in >> the post, you can download the zip file for the code at tag 0.4.2 from >> here. >>>From the top, you can download the zip by clicking on the "Download Source". >> Then you can copy the "cs" folder to your gem installation of your >> current >> cucumber version.". >> >> Shay. >> -------------------------------------------------------- >> Shay Friedman | Microsoft Visual C#/IronRuby MVP | Author of IronRuby >> Unleashed and ASP.NET 4 Programmer's Reference | Co-Founder of CodeValue >> Blog: http://IronShay.com | Twitter: http://twitter.com/ironshay -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Wed Sep 8 10:17:12 2010 From: lists at ruby-forum.com (Ameer Deen) Date: Wed, 8 Sep 2010 16:17:12 +0200 Subject: [Ironruby-core] Ironruby on Rails with SQL Azure In-Reply-To: References: <671f4e56f4733b477ed6429d7f50bcf3@ruby-forum.com> <5dbde009bae241c3bf044b0775b98c94@ruby-forum.com> <1ff59e6df04a11d7b77f5be7eda9295f@ruby-forum.com> Message-ID: Summarized my learnings here: http://www.cloudartisan.com/2010/09/ironruby-on-rails-on-azure-part-2-of-3-%E2%80%93-connecting-your-rails-app-to-sqlazure/ Ameer Deen twitter.com/writeameer Will Green wrote: > Should probably change the RegExp to match after the dash (10.x.x.x), > and > use that as the version, rather than, e.g., 2008, 2005, 2000, etc. > > -- > Will Green > http://hotgazpacho.org/ -- Posted via http://www.ruby-forum.com/. From Tomas.Matousek at microsoft.com Wed Sep 8 20:15:43 2010 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Thu, 9 Sep 2010 00:15:43 +0000 Subject: [Ironruby-core] Code Review: BasicObject Message-ID: tfpt review "/shelveset:BasicObject;REDMOND\tomat" Comment : Implements BasicObject. BasicObject is injected into Ruby inheritance hierarchy as a superclass of Object. Ruby Object class still corresponds to System::Object class so that .NET objects have methods like hash, to_s, eql?, class etc. Tomas -------------- next part -------------- A non-text attachment was scrubbed... Name: BasicObject.diff Type: application/octet-stream Size: 75951 bytes Desc: BasicObject.diff URL: From ralinx at davybrion.com Thu Sep 9 04:33:23 2010 From: ralinx at davybrion.com (Davy Brion) Date: Thu, 9 Sep 2010 10:33:23 +0200 Subject: [Ironruby-core] object equality Message-ID: If i have the following class in ruby: class TestClass def initialize(value) @value = value end def ==(other) return false if other.nil? self.value == other.value end protected def value @value end end test1 = TestClass.new(5) test2 = TestClass.new(5) p test1 == test2 p test1 != test2 the output is: true false if i do this in .NET: dynamic test1 = ruby.TestClass. at new(5); dynamic test2 = ruby.TestClass. at new(5); var equals = test1 == test2; var differs = test1 != test2; both equals and differs are true i'm going to create an issue about this, but i do need to get this working... is there a temporary workaround that i can use for now? -------------- next part -------------- An HTML attachment was scrubbed... URL: From ted at tedneward.com Thu Sep 9 01:35:13 2010 From: ted at tedneward.com (Ted Neward) Date: Wed, 8 Sep 2010 22:35:13 -0700 Subject: [Ironruby-core] accessor methods and property syntax in .NET In-Reply-To: References: Message-ID: <045f01cb4fe0$cd36cb60$67a46220$@tedneward.com> I love how he just tossed that off like it happens to everybody. "Yeah, I know, I was committing this source patch, but all of a sudden there was this crying squalling thing in my lap that needed a diaper changed. WTF is up with that? . I know! Seriously! I thought good code wasn't supposed to have side effects?!? I kept looking to ROLLBACK, but sonuvagun, wouldn't you know it..." Congrats, Brian. Ted Neward Java, .NET, XML Services Consulting, Teaching, Speaking, Writing http://www.tedneward.com From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shay Friedman Sent: Tuesday, September 07, 2010 5:57 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] accessor methods and property syntax in .NET Beware! Contributing to the IronRuby source code might result in having babies!!! :-) Congratulations Brian! On Tue, Sep 7, 2010 at 3:47 PM, Brian Genisio wrote: Actually, we discussed this about a month ago: http://rubyforge.org/pipermail/ironruby-core/2010-July/007154.html The outcome was that a feature request was added to allow for C# properties to be defined using getter/setter in ruby. I was going to look at implementing it... got into a bit, and had a baby... Haven't looked at it since. B On Tue, Sep 7, 2010 at 5:55 AM, Davy Brion wrote: your solution does however work for the assignment accessor... in fact, you can do something like this: class Foo attr_reader :bar def bar=(val) # do more stuff here for example @bar = val end end and then you can do the following in C#: var value = myObject.bar; myObject.bar = someOtherValue; for my specific scenario, i think i can actually get by with just overriding the assignment accessor but the thing i'm wondering is: is the current behavior actually a bug? and will this behavior be preserved in future releases? On Tue, Sep 7, 2010 at 11:13 AM, Davy Brion wrote: if i do that, calling bar as a property like this: var value = myObject.bar; leads to 'value' being an instance of IronRuby.BuiltIns.RubyMethod, and not the value that is in the @bar instance field which i'm using 1.1 btw, not sure how this would behave on 1.0 from looking at the IronRuby source code, it looks like i need to find a way to change the RubyMemberInfo for a given accessor method to RubyAttributeReaderInfo or RubyAttributeWriterInfo On Tue, Sep 7, 2010 at 11:01 AM, Ivan Porto Carerro wrote: You can just define them as attr_accessors and then implement the methods class Foo attr_accessor :bar, :baz def bar=(val) # do more stuff here for example @bar = val end def bar @bar end end On Tue, Sep 7, 2010 at 10:36 AM, Davy Brion wrote: Hi all, IronRuby has a nice trick where attributes defined by attr_reader, attr_accessor and attr_writer are usable as properties from C#... i was just wondering: is it possible to use the same trick in our own ruby code? or can anyone just point me in the right direction as to where in the IronRuby source code i could find where this is being done? I have accessor methods that really need to do something specific and ideally, i'd like them be usable as properties in .NET since it leads to a much nicer syntax in C# brs, Davy _______________________________________________ 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 will at hotgazpacho.org Thu Sep 9 06:20:15 2010 From: will at hotgazpacho.org (William Green) Date: Thu, 9 Sep 2010 06:20:15 -0400 Subject: [Ironruby-core] object equality In-Reply-To: References: Message-ID: <1831864817714072802@unknownmsgid> Testing for object equality in C# is different than it is in Ruby. In C#, you need to override both Object.Equals and Object.GetHashCode (I forget which is used when, but I do recall that the compiler complains if you override one and not the other). So, when you bring your Ruby object into C# and compare them, C# doesn't see an override for Equals on your object, and thus uses Object.Equals (which is often what you don't want). Try defining an equals method on your Ruby object, or alias it to ==. I suspect that the == method on your Ruby object does not map to Equals when you bring into C#. And I'm not sure that it should. Thoughts? -- Will Green http://hotgazpacho.org/ On Sep 9, 2010, at 4:33 AM, Davy Brion wrote: > If i have the following class in ruby: > > class TestClass > def initialize(value) > @value = value > end > > def ==(other) > return false if other.nil? > self.value == other.value > end > > protected > > def value > @value > end > end > > test1 = TestClass.new(5) > test2 = TestClass.new(5) > p test1 == test2 > p test1 != test2 > > the output is: > true > false > > if i do this in .NET: > > dynamic test1 = ruby.TestClass. at new(5); > dynamic test2 = ruby.TestClass. at new(5); > > var equals = test1 == test2; > var differs = test1 != test2; > > both equals and differs are true > > i'm going to create an issue about this, but i do need to get this working... is there a temporary workaround that i can use for now? > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core From ralinx at davybrion.com Thu Sep 9 06:52:29 2010 From: ralinx at davybrion.com (Davy Brion) Date: Thu, 9 Sep 2010 12:52:29 +0200 Subject: [Ironruby-core] object equality In-Reply-To: <1831864817714072802@unknownmsgid> References: <1831864817714072802@unknownmsgid> Message-ID: the problem isn't with checking wether 2 objects are equal (though you indeed need to define an Equals method on your ruby object if you want the comparison to work with a direct call to .Equals... doing == in C# definitely uses the == method of your ruby object) but it is with the != check. In ruby, using != calls == and inverts the result of that. Doing != in C# on a ruby object doesn't seem to do the same thing. I'm also not entirely sure how it _should_ be... but as far as i can tell, right now, i can't get equality checks working properly with ruby objects. if a == b is true, then a != b should always be false if a.Equals(b) is true, then !a.Equals(b) should always be false if there's another way to get this behavior working in C# for ruby objects, i'd love to hear about it since it's pretty important for something i'm trying to do :) On Thu, Sep 9, 2010 at 12:20 PM, William Green wrote: > Testing for object equality in C# is different than it is in Ruby. In > C#, you need to override both Object.Equals and Object.GetHashCode (I > forget which is used when, but I do recall that the compiler complains > if you override one and not the other). So, when you bring your Ruby > object into C# and compare them, C# doesn't see an override for Equals > on your object, and thus uses Object.Equals (which is often what you > don't want). Try defining an equals method on your Ruby object, or > alias it to ==. > > I suspect that the == method on your Ruby object does not map to > Equals when you bring into C#. And I'm not sure that it should. > > Thoughts? > > -- > Will Green > http://hotgazpacho.org/ > > > > On Sep 9, 2010, at 4:33 AM, Davy Brion wrote: > > > If i have the following class in ruby: > > > > class TestClass > > def initialize(value) > > @value = value > > end > > > > def ==(other) > > return false if other.nil? > > self.value == other.value > > end > > > > protected > > > > def value > > @value > > end > > end > > > > test1 = TestClass.new(5) > > test2 = TestClass.new(5) > > p test1 == test2 > > p test1 != test2 > > > > the output is: > > true > > false > > > > if i do this in .NET: > > > > dynamic test1 = ruby.TestClass. at new(5); > > dynamic test2 = ruby.TestClass. at new(5); > > > > var equals = test1 == test2; > > var differs = test1 != test2; > > > > both equals and differs are true > > > > i'm going to create an issue about this, but i do need to get this > working... is there a temporary workaround that i can use for now? > > _______________________________________________ > > 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 will at hotgazpacho.org Thu Sep 9 07:10:25 2010 From: will at hotgazpacho.org (William Green) Date: Thu, 9 Sep 2010 07:10:25 -0400 Subject: [Ironruby-core] object equality In-Reply-To: References: <1831864817714072802@unknownmsgid> Message-ID: <3726797951964556247@unknownmsgid> Then it would appear that in C#, using the != operator on two instances of Ruby objects does not call the == method on the first Ruby object and invert the result. Can you switch to using equals as a work-around? Not sure of the semantics around == vs .Equals in C#, but I know there is a semantic difference between == and eql? in Ruby. -- Will Green http://hotgazpacho.org/ On Sep 9, 2010, at 6:52 AM, Davy Brion wrote: the problem isn't with checking wether 2 objects are equal (though you indeed need to define an Equals method on your ruby object if you want the comparison to work with a direct call to .Equals... doing == in C# definitely uses the == method of your ruby object) but it is with the != check. In ruby, using != calls == and inverts the result of that. Doing != in C# on a ruby object doesn't seem to do the same thing. I'm also not entirely sure how it _should_ be... but as far as i can tell, right now, i can't get equality checks working properly with ruby objects. if a == b is true, then a != b should always be false if a.Equals(b) is true, then !a.Equals(b) should always be false if there's another way to get this behavior working in C# for ruby objects, i'd love to hear about it since it's pretty important for something i'm trying to do :) On Thu, Sep 9, 2010 at 12:20 PM, William Green wrote: > Testing for object equality in C# is different than it is in Ruby. In > C#, you need to override both Object.Equals and Object.GetHashCode (I > forget which is used when, but I do recall that the compiler complains > if you override one and not the other). So, when you bring your Ruby > object into C# and compare them, C# doesn't see an override for Equals > on your object, and thus uses Object.Equals (which is often what you > don't want). Try defining an equals method on your Ruby object, or > alias it to ==. > > I suspect that the == method on your Ruby object does not map to > Equals when you bring into C#. And I'm not sure that it should. > > Thoughts? > > -- > Will Green > http://hotgazpacho.org/ > > > > On Sep 9, 2010, at 4:33 AM, Davy Brion wrote: > > > If i have the following class in ruby: > > > > class TestClass > > def initialize(value) > > @value = value > > end > > > > def ==(other) > > return false if other.nil? > > self.value == other.value > > end > > > > protected > > > > def value > > @value > > end > > end > > > > test1 = TestClass.new(5) > > test2 = TestClass.new(5) > > p test1 == test2 > > p test1 != test2 > > > > the output is: > > true > > false > > > > if i do this in .NET: > > > > dynamic test1 = ruby.TestClass. at new(5); > > dynamic test2 = ruby.TestClass. at new(5); > > > > var equals = test1 == test2; > > var differs = test1 != test2; > > > > both equals and differs are true > > > > i'm going to create an issue about this, but i do need to get this > working... is there a temporary workaround that i can use for now? > > _______________________________________________ > > 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 ralinx at davybrion.com Thu Sep 9 07:44:39 2010 From: ralinx at davybrion.com (Davy Brion) Date: Thu, 9 Sep 2010 13:44:39 +0200 Subject: [Ironruby-core] object equality In-Reply-To: <3726797951964556247@unknownmsgid> References: <1831864817714072802@unknownmsgid> <3726797951964556247@unknownmsgid> Message-ID: by default, == does a reference check in C#, unless you override it to do a value based check (which you typically implement in Equals) in C#, if you want == and != to work properly you need to implement them both. In ruby, you obviously can't implement !=, but i had (naievely perhaps) expected that IronRuby would preserve the Ruby behavior when calling == on an object which implements it. I _think_ that would be the best way to handle this, though there might be very valid reasons as to why this isn't the case at the moment. defining an Equals method on the ruby class which delegates to == works, but it is somewhat weird since most people use the == and != operators to check for equality. perhaps i'm better off getting rid of the == implementation and solely providing an Equals implementation On Thu, Sep 9, 2010 at 1:10 PM, William Green wrote: > Then it would appear that in C#, using the != operator on two instances of > Ruby objects does not call the == method on the first Ruby object and invert > the result. > > Can you switch to using equals as a work-around? > > Not sure of the semantics around == vs .Equals in C#, but I know there is a > semantic difference between == and eql? in Ruby. > > -- > Will Green > http://hotgazpacho.org/ > > > > On Sep 9, 2010, at 6:52 AM, Davy Brion wrote: > > the problem isn't with checking wether 2 objects are equal (though you > indeed need to define an Equals method on your ruby object if you want the > comparison to work with a direct call to .Equals... doing == in C# > definitely uses the == method of your ruby object) but it is with the != > check. In ruby, using != calls == and inverts the result of that. Doing != > in C# on a ruby object doesn't seem to do the same thing. > > I'm also not entirely sure how it _should_ be... but as far as i can tell, > right now, i can't get equality checks working properly with ruby objects. > > if a == b is true, then a != b should always be false > if a.Equals(b) is true, then !a.Equals(b) should always be false > > if there's another way to get this behavior working in C# for ruby objects, > i'd love to hear about it since it's pretty important for something i'm > trying to do :) > > On Thu, Sep 9, 2010 at 12:20 PM, William Green < > will at hotgazpacho.org> wrote: > >> Testing for object equality in C# is different than it is in Ruby. In >> C#, you need to override both Object.Equals and Object.GetHashCode (I >> forget which is used when, but I do recall that the compiler complains >> if you override one and not the other). So, when you bring your Ruby >> object into C# and compare them, C# doesn't see an override for Equals >> on your object, and thus uses Object.Equals (which is often what you >> don't want). Try defining an equals method on your Ruby object, or >> alias it to ==. >> >> I suspect that the == method on your Ruby object does not map to >> Equals when you bring into C#. And I'm not sure that it should. >> >> Thoughts? >> >> -- >> Will Green >> http://hotgazpacho.org/ >> >> >> >> On Sep 9, 2010, at 4:33 AM, Davy Brion < >> ralinx at davybrion.com> wrote: >> >> > If i have the following class in ruby: >> > >> > class TestClass >> > def initialize(value) >> > @value = value >> > end >> > >> > def ==(other) >> > return false if other.nil? >> > self.value == other.value >> > end >> > >> > protected >> > >> > def value >> > @value >> > end >> > end >> > >> > test1 = TestClass.new(5) >> > test2 = TestClass.new(5) >> > p test1 == test2 >> > p test1 != test2 >> > >> > the output is: >> > true >> > false >> > >> > if i do this in .NET: >> > >> > dynamic test1 = ruby.TestClass. at new(5); >> > dynamic test2 = ruby.TestClass. at new(5); >> > >> > var equals = test1 == test2; >> > var differs = test1 != test2; >> > >> > both equals and differs are true >> > >> > i'm going to create an issue about this, but i do need to get this >> working... is there a temporary workaround that i can use for now? >> > _______________________________________________ >> > 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 ralinx at davybrion.com Thu Sep 9 07:45:45 2010 From: ralinx at davybrion.com (Davy Brion) Date: Thu, 9 Sep 2010 13:45:45 +0200 Subject: [Ironruby-core] object equality In-Reply-To: References: <1831864817714072802@unknownmsgid> <3726797951964556247@unknownmsgid> Message-ID: On Thu, Sep 9, 2010 at 1:44 PM, Davy Brion wrote: > by default, == does a reference check in C#, unless you override it to do a > value based check (which you typically implement in Equals) > > in C#, if you want == and != to work properly you need to implement them > both. In ruby, you obviously can't implement !=, but i had (naievely > perhaps) expected that IronRuby would preserve the Ruby behavior when > calling == on an object which implements it. I _think_ that would be the > best way to handle this, though there might be very valid reasons as to why > this isn't the case at the moment. > > defining an Equals method on the ruby class which delegates to == works, > but it is somewhat weird since most people use the == and != operators to > check for equality. > > perhaps i'm better off getting rid of the == implementation and solely > providing an Equals implementation > > though the downside of that is that the ruby class doesn't stick to ruby's idioms when it comes to equality checks, which hurts its usage from other ruby code :s > > On Thu, Sep 9, 2010 at 1:10 PM, William Green wrote: > >> Then it would appear that in C#, using the != operator on two instances of >> Ruby objects does not call the == method on the first Ruby object and invert >> the result. >> >> Can you switch to using equals as a work-around? >> >> Not sure of the semantics around == vs .Equals in C#, but I know there is >> a semantic difference between == and eql? in Ruby. >> >> -- >> Will Green >> http://hotgazpacho.org/ >> >> >> >> On Sep 9, 2010, at 6:52 AM, Davy Brion wrote: >> >> the problem isn't with checking wether 2 objects are equal (though you >> indeed need to define an Equals method on your ruby object if you want the >> comparison to work with a direct call to .Equals... doing == in C# >> definitely uses the == method of your ruby object) but it is with the != >> check. In ruby, using != calls == and inverts the result of that. Doing != >> in C# on a ruby object doesn't seem to do the same thing. >> >> I'm also not entirely sure how it _should_ be... but as far as i can tell, >> right now, i can't get equality checks working properly with ruby objects. >> >> if a == b is true, then a != b should always be false >> if a.Equals(b) is true, then !a.Equals(b) should always be false >> >> if there's another way to get this behavior working in C# for ruby >> objects, i'd love to hear about it since it's pretty important for something >> i'm trying to do :) >> >> On Thu, Sep 9, 2010 at 12:20 PM, William Green < >> will at hotgazpacho.org> wrote: >> >>> Testing for object equality in C# is different than it is in Ruby. In >>> C#, you need to override both Object.Equals and Object.GetHashCode (I >>> forget which is used when, but I do recall that the compiler complains >>> if you override one and not the other). So, when you bring your Ruby >>> object into C# and compare them, C# doesn't see an override for Equals >>> on your object, and thus uses Object.Equals (which is often what you >>> don't want). Try defining an equals method on your Ruby object, or >>> alias it to ==. >>> >>> I suspect that the == method on your Ruby object does not map to >>> Equals when you bring into C#. And I'm not sure that it should. >>> >>> Thoughts? >>> >>> -- >>> Will Green >>> http://hotgazpacho.org/ >>> >>> >>> >>> On Sep 9, 2010, at 4:33 AM, Davy Brion < >>> ralinx at davybrion.com> wrote: >>> >>> > If i have the following class in ruby: >>> > >>> > class TestClass >>> > def initialize(value) >>> > @value = value >>> > end >>> > >>> > def ==(other) >>> > return false if other.nil? >>> > self.value == other.value >>> > end >>> > >>> > protected >>> > >>> > def value >>> > @value >>> > end >>> > end >>> > >>> > test1 = TestClass.new(5) >>> > test2 = TestClass.new(5) >>> > p test1 == test2 >>> > p test1 != test2 >>> > >>> > the output is: >>> > true >>> > false >>> > >>> > if i do this in .NET: >>> > >>> > dynamic test1 = ruby.TestClass. at new(5); >>> > dynamic test2 = ruby.TestClass. at new(5); >>> > >>> > var equals = test1 == test2; >>> > var differs = test1 != test2; >>> > >>> > both equals and differs are true >>> > >>> > i'm going to create an issue about this, but i do need to get this >>> working... is there a temporary workaround that i can use for now? >>> > _______________________________________________ >>> > 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 charles.c.strahan at gmail.com Thu Sep 9 16:01:36 2010 From: charles.c.strahan at gmail.com (Charles Strahan) Date: Thu, 9 Sep 2010 15:01:36 -0500 Subject: [Ironruby-core] mscorlib:0:in `ThrowArgumentException' error In-Reply-To: <90c6a685a76b7878e0f4fe0758892d35@ruby-forum.com> References: <4c71515acf490b733c4e7ce351044707@ruby-forum.com> <59e7eb345957a04a34e0f6ddae448e33@ruby-forum.com> <10e502ae5100189fa32b1a653473b8cd@ruby-forum.com> <90c6a685a76b7878e0f4fe0758892d35@ruby-forum.com> Message-ID: Hi Eduardo, This looks like it could be a bug in IronRuby... or possibly the ActiveRecord adapter. That exception that is being thrown is from a Hashtable or Dictionary; a value is being inserted with an existing key. Typical Ruby code won't ever use a .NET specific type such as Hashtable or Dictionary (of course), which makes me think that this might be a bug in IronRuby... or possibly your ActiveRecord adapter (assuming it's tailor made for IronRuby). I'd hate to make you jump through hoops, but it would be great if you could lend me a hand in figuring this one out. If you could send me a small repro, that would be great; baring that, I have some questions for you: What sort of AR adapter are you using? Could you give me the "actual" stack trace for this exception? This should do the trick: begin # ... the line of code that throws ... rescue Exception => e # use the following to get the actual .NET/System.Exception stack trace: puts e.StackTrace end Thanks, Charles On Sun, Sep 5, 2010 at 5:59 PM, Eduardo Blumenfeld wrote: > Hi all, > > I finally solved the issue: > By calling another procedure and within that procedure do the eval, it > works perfectly. > > However, this seems to be a bug anyways... > > Regards, > > Eduardo > -- > 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 Tomas.Matousek at microsoft.com Thu Sep 9 17:18:12 2010 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Thu, 9 Sep 2010 21:18:12 +0000 Subject: [Ironruby-core] Code Review: 19compat Message-ID: tfpt review "/shelveset:19compat;REDMOND\tomat" Comment : 1.9 compat fixes. Tomas -------------- next part -------------- A non-text attachment was scrubbed... Name: 19compat.diff Type: application/octet-stream Size: 84326 bytes Desc: 19compat.diff URL: From Tomas.Matousek at microsoft.com Fri Sep 10 01:09:50 2010 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Fri, 10 Sep 2010 05:09:50 +0000 Subject: [Ironruby-core] object equality In-Reply-To: References: <1831864817714072802@unknownmsgid> <3726797951964556247@unknownmsgid> Message-ID: If any of the operands of == or != are typed to dynamic C# emits a call to dynamic site with the corresponding operation. If the left hand side is a Ruby object then this dynamic operation is translated to a Ruby method call ?==? or ?!=?, respectively. The latest version of IronRuby (built from github sources) is compatible with MRI 1.9.2 in the way ?!=? method is implemented: BasicObject#!= calls == and negates the result. You can also provide your own implementation of != method if its behavior should be different. This semantics is compatible with DLR dynamic operations and everything works as expected: dynamic equatable = Engine.Execute(@" class RubyEquatable def initialize val @val = val end def ==(other) @val == other end end RubyEquatable.new(100) "); Assert((bool)( equatable == 100)); Assert(!(bool)( equatable == 101)); Assert(!(bool)( equatable != 100)); Assert((bool)( equatable != 100)); Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Davy Brion Sent: Thursday, September 09, 2010 4:46 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] object equality On Thu, Sep 9, 2010 at 1:44 PM, Davy Brion > wrote: by default, == does a reference check in C#, unless you override it to do a value based check (which you typically implement in Equals) in C#, if you want == and != to work properly you need to implement them both. In ruby, you obviously can't implement !=, but i had (naievely perhaps) expected that IronRuby would preserve the Ruby behavior when calling == on an object which implements it. I _think_ that would be the best way to handle this, though there might be very valid reasons as to why this isn't the case at the moment. defining an Equals method on the ruby class which delegates to == works, but it is somewhat weird since most people use the == and != operators to check for equality. perhaps i'm better off getting rid of the == implementation and solely providing an Equals implementation though the downside of that is that the ruby class doesn't stick to ruby's idioms when it comes to equality checks, which hurts its usage from other ruby code :s On Thu, Sep 9, 2010 at 1:10 PM, William Green > wrote: Then it would appear that in C#, using the != operator on two instances of Ruby objects does not call the == method on the first Ruby object and invert the result. Can you switch to using equals as a work-around? Not sure of the semantics around == vs .Equals in C#, but I know there is a semantic difference between == and eql? in Ruby. -- Will Green http://hotgazpacho.org/ On Sep 9, 2010, at 6:52 AM, Davy Brion > wrote: the problem isn't with checking wether 2 objects are equal (though you indeed need to define an Equals method on your ruby object if you want the comparison to work with a direct call to .Equals... doing == in C# definitely uses the == method of your ruby object) but it is with the != check. In ruby, using != calls == and inverts the result of that. Doing != in C# on a ruby object doesn't seem to do the same thing. I'm also not entirely sure how it _should_ be... but as far as i can tell, right now, i can't get equality checks working properly with ruby objects. if a == b is true, then a != b should always be false if a.Equals(b) is true, then !a.Equals(b) should always be false if there's another way to get this behavior working in C# for ruby objects, i'd love to hear about it since it's pretty important for something i'm trying to do :) On Thu, Sep 9, 2010 at 12:20 PM, William Green > wrote: Testing for object equality in C# is different than it is in Ruby. In C#, you need to override both Object.Equals and Object.GetHashCode (I forget which is used when, but I do recall that the compiler complains if you override one and not the other). So, when you bring your Ruby object into C# and compare them, C# doesn't see an override for Equals on your object, and thus uses Object.Equals (which is often what you don't want). Try defining an equals method on your Ruby object, or alias it to ==. I suspect that the == method on your Ruby object does not map to Equals when you bring into C#. And I'm not sure that it should. Thoughts? -- Will Green http://hotgazpacho.org/ On Sep 9, 2010, at 4:33 AM, Davy Brion > wrote: > If i have the following class in ruby: > > class TestClass > def initialize(value) > @value = value > end > > def ==(other) > return false if other.nil? > self.value == other.value > end > > protected > > def value > @value > end > end > > test1 = TestClass.new(5) > test2 = TestClass.new(5) > p test1 == test2 > p test1 != test2 > > the output is: > true > false > > if i do this in .NET: > > dynamic test1 = ruby.TestClass. at new(5); > dynamic test2 = ruby.TestClass. at new(5); > > var equals = test1 == test2; > var differs = test1 != test2; > > both equals and differs are true > > i'm going to create an issue about this, but i do need to get this working... is there a temporary workaround that i can use for now? > _______________________________________________ > 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 Tomas.Matousek at microsoft.com Fri Sep 10 01:11:27 2010 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Fri, 10 Sep 2010 05:11:27 +0000 Subject: [Ironruby-core] object equality References: <1831864817714072802@unknownmsgid> <3726797951964556247@unknownmsgid> Message-ID: There is indeed a typo? the last line should read: Assert((bool)( equatable != 101)); Tomas From: Tomas Matousek Sent: Thursday, September 09, 2010 10:10 PM To: ironruby-core at rubyforge.org Subject: RE: [Ironruby-core] object equality If any of the operands of == or != are typed to dynamic C# emits a call to dynamic site with the corresponding operation. If the left hand side is a Ruby object then this dynamic operation is translated to a Ruby method call ?==? or ?!=?, respectively. The latest version of IronRuby (built from github sources) is compatible with MRI 1.9.2 in the way ?!=? method is implemented: BasicObject#!= calls == and negates the result. You can also provide your own implementation of != method if its behavior should be different. This semantics is compatible with DLR dynamic operations and everything works as expected: dynamic equatable = Engine.Execute(@" class RubyEquatable def initialize val @val = val end def ==(other) @val == other end end RubyEquatable.new(100) "); Assert((bool)( equatable == 100)); Assert(!(bool)( equatable == 101)); Assert(!(bool)( equatable != 100)); Assert((bool)( equatable != 100)); Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Davy Brion Sent: Thursday, September 09, 2010 4:46 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] object equality On Thu, Sep 9, 2010 at 1:44 PM, Davy Brion > wrote: by default, == does a reference check in C#, unless you override it to do a value based check (which you typically implement in Equals) in C#, if you want == and != to work properly you need to implement them both. In ruby, you obviously can't implement !=, but i had (naievely perhaps) expected that IronRuby would preserve the Ruby behavior when calling == on an object which implements it. I _think_ that would be the best way to handle this, though there might be very valid reasons as to why this isn't the case at the moment. defining an Equals method on the ruby class which delegates to == works, but it is somewhat weird since most people use the == and != operators to check for equality. perhaps i'm better off getting rid of the == implementation and solely providing an Equals implementation though the downside of that is that the ruby class doesn't stick to ruby's idioms when it comes to equality checks, which hurts its usage from other ruby code :s On Thu, Sep 9, 2010 at 1:10 PM, William Green > wrote: Then it would appear that in C#, using the != operator on two instances of Ruby objects does not call the == method on the first Ruby object and invert the result. Can you switch to using equals as a work-around? Not sure of the semantics around == vs .Equals in C#, but I know there is a semantic difference between == and eql? in Ruby. -- Will Green http://hotgazpacho.org/ On Sep 9, 2010, at 6:52 AM, Davy Brion > wrote: the problem isn't with checking wether 2 objects are equal (though you indeed need to define an Equals method on your ruby object if you want the comparison to work with a direct call to .Equals... doing == in C# definitely uses the == method of your ruby object) but it is with the != check. In ruby, using != calls == and inverts the result of that. Doing != in C# on a ruby object doesn't seem to do the same thing. I'm also not entirely sure how it _should_ be... but as far as i can tell, right now, i can't get equality checks working properly with ruby objects. if a == b is true, then a != b should always be false if a.Equals(b) is true, then !a.Equals(b) should always be false if there's another way to get this behavior working in C# for ruby objects, i'd love to hear about it since it's pretty important for something i'm trying to do :) On Thu, Sep 9, 2010 at 12:20 PM, William Green > wrote: Testing for object equality in C# is different than it is in Ruby. In C#, you need to override both Object.Equals and Object.GetHashCode (I forget which is used when, but I do recall that the compiler complains if you override one and not the other). So, when you bring your Ruby object into C# and compare them, C# doesn't see an override for Equals on your object, and thus uses Object.Equals (which is often what you don't want). Try defining an equals method on your Ruby object, or alias it to ==. I suspect that the == method on your Ruby object does not map to Equals when you bring into C#. And I'm not sure that it should. Thoughts? -- Will Green http://hotgazpacho.org/ On Sep 9, 2010, at 4:33 AM, Davy Brion > wrote: > If i have the following class in ruby: > > class TestClass > def initialize(value) > @value = value > end > > def ==(other) > return false if other.nil? > self.value == other.value > end > > protected > > def value > @value > end > end > > test1 = TestClass.new(5) > test2 = TestClass.new(5) > p test1 == test2 > p test1 != test2 > > the output is: > true > false > > if i do this in .NET: > > dynamic test1 = ruby.TestClass. at new(5); > dynamic test2 = ruby.TestClass. at new(5); > > var equals = test1 == test2; > var differs = test1 != test2; > > both equals and differs are true > > i'm going to create an issue about this, but i do need to get this working... is there a temporary workaround that i can use for now? > _______________________________________________ > 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 ralinx at davybrion.com Fri Sep 10 03:45:41 2010 From: ralinx at davybrion.com (Davy Brion) Date: Fri, 10 Sep 2010 09:45:41 +0200 Subject: [Ironruby-core] object equality In-Reply-To: References: <1831864817714072802@unknownmsgid> <3726797951964556247@unknownmsgid> Message-ID: great to hear, and already looking forward to the next release :) just wondering though, you mentioned that it's possible to provide your own implementation of !=. how would one do that? if i try to define a != method, i get an 'unexpected !=' error On Fri, Sep 10, 2010 at 7:09 AM, Tomas Matousek < Tomas.Matousek at microsoft.com> wrote: > If any of the operands of == or != are typed to dynamic C# emits a call > to dynamic site with the corresponding operation. If the left hand side is a > Ruby object then this dynamic operation is translated to a Ruby method call > ?==? or ?!=?, respectively. > > The latest version of IronRuby (built from github sources) is compatible > with MRI 1.9.2 in the way ?!=? method is implemented: BasicObject#!= calls > == and negates the result. You can also provide your own implementation of > != method if its behavior should be different. This semantics is compatible > with DLR dynamic operations and everything works as expected: > > > > dynamic equatable = Engine.Execute(@" > > class RubyEquatable > > def initialize val > > @val = val > > end > > > > def ==(other) > > @val == other > > end > > end > > > > RubyEquatable.new(100) > > "); > > > > Assert((bool)( equatable == 100)); > > Assert(!(bool)( equatable == 101)); > > Assert(!(bool)( equatable != 100)); > > Assert((bool)( equatable != 100)); > > > > Tomas > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Davy Brion > *Sent:* Thursday, September 09, 2010 4:46 AM > *To:* ironruby-core at rubyforge.org > *Subject:* Re: [Ironruby-core] object equality > > > > > > On Thu, Sep 9, 2010 at 1:44 PM, Davy Brion wrote: > > by default, == does a reference check in C#, unless you override it to do a > value based check (which you typically implement in Equals) > > in C#, if you want == and != to work properly you need to implement them > both. In ruby, you obviously can't implement !=, but i had (naievely > perhaps) expected that IronRuby would preserve the Ruby behavior when > calling == on an object which implements it. I _think_ that would be the > best way to handle this, though there might be very valid reasons as to why > this isn't the case at the moment. > > defining an Equals method on the ruby class which delegates to == works, > but it is somewhat weird since most people use the == and != operators to > check for equality. > > perhaps i'm better off getting rid of the == implementation and solely > providing an Equals implementation > > > > > though the downside of that is that the ruby class doesn't stick to ruby's > idioms when it comes to equality checks, which hurts its usage from other > ruby code :s > > > > > On Thu, Sep 9, 2010 at 1:10 PM, William Green > wrote: > > Then it would appear that in C#, using the != operator on two instances of > Ruby objects does not call the == method on the first Ruby object and invert > the result. > > > > Can you switch to using equals as a work-around? > > > > Not sure of the semantics around == vs .Equals in C#, but I know there is a > semantic difference between == and eql? in Ruby. > > > -- > > Will Green > > http://hotgazpacho.org/ > > > > > > > On Sep 9, 2010, at 6:52 AM, Davy Brion wrote: > > the problem isn't with checking wether 2 objects are equal (though you > indeed need to define an Equals method on your ruby object if you want the > comparison to work with a direct call to .Equals... doing == in C# > definitely uses the == method of your ruby object) but it is with the != > check. In ruby, using != calls == and inverts the result of that. Doing != > in C# on a ruby object doesn't seem to do the same thing. > > I'm also not entirely sure how it _should_ be... but as far as i can tell, > right now, i can't get equality checks working properly with ruby objects. > > if a == b is true, then a != b should always be false > if a.Equals(b) is true, then !a.Equals(b) should always be false > > if there's another way to get this behavior working in C# for ruby objects, > i'd love to hear about it since it's pretty important for something i'm > trying to do :) > > On Thu, Sep 9, 2010 at 12:20 PM, William Green > wrote: > > Testing for object equality in C# is different than it is in Ruby. In > C#, you need to override both Object.Equals and Object.GetHashCode (I > forget which is used when, but I do recall that the compiler complains > if you override one and not the other). So, when you bring your Ruby > object into C# and compare them, C# doesn't see an override for Equals > on your object, and thus uses Object.Equals (which is often what you > don't want). Try defining an equals method on your Ruby object, or > alias it to ==. > > I suspect that the == method on your Ruby object does not map to > Equals when you bring into C#. And I'm not sure that it should. > > Thoughts? > > -- > Will Green > http://hotgazpacho.org/ > > > > > On Sep 9, 2010, at 4:33 AM, Davy Brion wrote: > > > If i have the following class in ruby: > > > > class TestClass > > def initialize(value) > > @value = value > > end > > > > def ==(other) > > return false if other.nil? > > self.value == other.value > > end > > > > protected > > > > def value > > @value > > end > > end > > > > test1 = TestClass.new(5) > > test2 = TestClass.new(5) > > p test1 == test2 > > p test1 != test2 > > > > the output is: > > true > > false > > > > if i do this in .NET: > > > > dynamic test1 = ruby.TestClass. at new(5) ; > > dynamic test2 = ruby.TestClass. at new(5) ; > > > > var equals = test1 == test2; > > var differs = test1 != test2; > > > > both equals and differs are true > > > > i'm going to create an issue about this, but i do need to get this > working... is there a temporary workaround that i can use for now? > > > _______________________________________________ > > 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 Tomas.Matousek at microsoft.com Fri Sep 10 12:42:55 2010 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Fri, 10 Sep 2010 16:42:55 +0000 Subject: [Ironruby-core] object equality In-Reply-To: References: <1831864817714072802@unknownmsgid> <3726797951964556247@unknownmsgid> Message-ID: You need MRI 1.9.* or IronRuby built from github sources. Then this just works def !=(other) end Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Davy Brion Sent: Friday, September 10, 2010 12:46 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] object equality great to hear, and already looking forward to the next release :) just wondering though, you mentioned that it's possible to provide your own implementation of !=. how would one do that? if i try to define a != method, i get an 'unexpected !=' error On Fri, Sep 10, 2010 at 7:09 AM, Tomas Matousek > wrote: If any of the operands of == or != are typed to dynamic C# emits a call to dynamic site with the corresponding operation. If the left hand side is a Ruby object then this dynamic operation is translated to a Ruby method call ?==? or ?!=?, respectively. The latest version of IronRuby (built from github sources) is compatible with MRI 1.9.2 in the way ?!=? method is implemented: BasicObject#!= calls == and negates the result. You can also provide your own implementation of != method if its behavior should be different. This semantics is compatible with DLR dynamic operations and everything works as expected: dynamic equatable = Engine.Execute(@" class RubyEquatable def initialize val @val = val end def ==(other) @val == other end end RubyEquatable.new(100) "); Assert((bool)( equatable == 100)); Assert(!(bool)( equatable == 101)); Assert(!(bool)( equatable != 100)); Assert((bool)( equatable != 100)); Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Davy Brion Sent: Thursday, September 09, 2010 4:46 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] object equality On Thu, Sep 9, 2010 at 1:44 PM, Davy Brion > wrote: by default, == does a reference check in C#, unless you override it to do a value based check (which you typically implement in Equals) in C#, if you want == and != to work properly you need to implement them both. In ruby, you obviously can't implement !=, but i had (naievely perhaps) expected that IronRuby would preserve the Ruby behavior when calling == on an object which implements it. I _think_ that would be the best way to handle this, though there might be very valid reasons as to why this isn't the case at the moment. defining an Equals method on the ruby class which delegates to == works, but it is somewhat weird since most people use the == and != operators to check for equality. perhaps i'm better off getting rid of the == implementation and solely providing an Equals implementation though the downside of that is that the ruby class doesn't stick to ruby's idioms when it comes to equality checks, which hurts its usage from other ruby code :s On Thu, Sep 9, 2010 at 1:10 PM, William Green > wrote: Then it would appear that in C#, using the != operator on two instances of Ruby objects does not call the == method on the first Ruby object and invert the result. Can you switch to using equals as a work-around? Not sure of the semantics around == vs .Equals in C#, but I know there is a semantic difference between == and eql? in Ruby. -- Will Green http://hotgazpacho.org/ On Sep 9, 2010, at 6:52 AM, Davy Brion > wrote: the problem isn't with checking wether 2 objects are equal (though you indeed need to define an Equals method on your ruby object if you want the comparison to work with a direct call to .Equals... doing == in C# definitely uses the == method of your ruby object) but it is with the != check. In ruby, using != calls == and inverts the result of that. Doing != in C# on a ruby object doesn't seem to do the same thing. I'm also not entirely sure how it _should_ be... but as far as i can tell, right now, i can't get equality checks working properly with ruby objects. if a == b is true, then a != b should always be false if a.Equals(b) is true, then !a.Equals(b) should always be false if there's another way to get this behavior working in C# for ruby objects, i'd love to hear about it since it's pretty important for something i'm trying to do :) On Thu, Sep 9, 2010 at 12:20 PM, William Green > wrote: Testing for object equality in C# is different than it is in Ruby. In C#, you need to override both Object.Equals and Object.GetHashCode (I forget which is used when, but I do recall that the compiler complains if you override one and not the other). So, when you bring your Ruby object into C# and compare them, C# doesn't see an override for Equals on your object, and thus uses Object.Equals (which is often what you don't want). Try defining an equals method on your Ruby object, or alias it to ==. I suspect that the == method on your Ruby object does not map to Equals when you bring into C#. And I'm not sure that it should. Thoughts? -- Will Green http://hotgazpacho.org/ On Sep 9, 2010, at 4:33 AM, Davy Brion > wrote: > If i have the following class in ruby: > > class TestClass > def initialize(value) > @value = value > end > > def ==(other) > return false if other.nil? > self.value == other.value > end > > protected > > def value > @value > end > end > > test1 = TestClass.new(5) > test2 = TestClass.new(5) > p test1 == test2 > p test1 != test2 > > the output is: > true > false > > if i do this in .NET: > > dynamic test1 = ruby.TestClass. at new(5); > dynamic test2 = ruby.TestClass. at new(5); > > var equals = test1 == test2; > var differs = test1 != test2; > > both equals and differs are true > > i'm going to create an issue about this, but i do need to get this working... is there a temporary workaround that i can use for now? > _______________________________________________ > 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 antonfir at gmail.com Sun Sep 12 19:18:24 2010 From: antonfir at gmail.com (Anton Firsov) Date: Mon, 13 Sep 2010 01:18:24 +0200 Subject: [Ironruby-core] running ruby script from my own .NET code is slow Message-ID: Hi all! Why it is ~5 times slower to run the same .rb script from my .NET application (using ScriptEngine and ScriptRuntime) classes, than doing the same with ir.exe? When I downloaded IronRuby source, and compiled ir.exe (Ruby.Console), it was 2 times slower, than ir.exe in released binaries. (But still 3 times faster than running scripts from my own application) Any ideas, what is behind these differences? -------------- next part -------------- An HTML attachment was scrubbed... URL: From Tomas.Matousek at microsoft.com Sun Sep 12 19:24:20 2010 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Sun, 12 Sep 2010 23:24:20 +0000 Subject: [Ironruby-core] running ruby script from my own .NET code is slow In-Reply-To: References: Message-ID: Can you give an example of what script it is and how you exactly run it from the .NET app? Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Anton Firsov Sent: Sunday, September 12, 2010 4:18 PM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] running ruby script from my own .NET code is slow Hi all! Why it is ~5 times slower to run the same .rb script from my .NET application (using ScriptEngine and ScriptRuntime) classes, than doing the same with ir.exe? When I downloaded IronRuby source, and compiled ir.exe (Ruby.Console), it was 2 times slower, than ir.exe in released binaries. (But still 3 times faster than running scripts from my own application) Any ideas, what is behind these differences? -------------- next part -------------- An HTML attachment was scrubbed... URL: From antonfir at gmail.com Sun Sep 12 19:37:03 2010 From: antonfir at gmail.com (Anton Firsov) Date: Mon, 13 Sep 2010 01:37:03 +0200 Subject: [Ironruby-core] running ruby script from my own .NET code is slow In-Reply-To: References: Message-ID: Here is the code: http://paste.dprogramming.com/dpk25ghd (It's just a dummy speed test) I tried several ways to call it: runtime = Ruby.CreateRuntime(); engine = Ruby.GetEngine(runtime); #than engine.ExecuteFile("test.rb"); #or engine.CreateScriptSourceFromFile("lib.rb").Execute() #or CompiledCode code = engine.CreateScriptSourceFromFile("test.rb").Compile(); code.Execute(); Actually they all give the same results... 2010/9/13 Tomas Matousek > Can you give an example of what script it is and how you exactly run it > from the .NET app? > > > > Tomas > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Anton Firsov > *Sent:* Sunday, September 12, 2010 4:18 PM > *To:* ironruby-core at rubyforge.org > *Subject:* [Ironruby-core] running ruby script from my own .NET code is > slow > > > > Hi all! > > Why it is ~5 times slower to run the same .rb script from my .NET > application (using ScriptEngine and ScriptRuntime) classes, than doing the > same with ir.exe? > When I downloaded IronRuby source, and compiled ir.exe (Ruby.Console), it > was 2 times slower, than ir.exe in released binaries. (But still 3 times > faster than running scripts from my own application) > > Any ideas, what is behind these differences? > > _______________________________________________ > 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 Thu Sep 23 12:09:27 2010 From: ivan at flanders.co.nz (Ivan Porto Carerro) Date: Thu, 23 Sep 2010 17:09:27 +0100 Subject: [Ironruby-core] OpenSSL support for IronRuby Message-ID: I don't know if openssl is still a problem for IronRuby on mono But the JRuby guys are using bouncy castle to get that support. As it so happens there is also a .Net provider for bouncy castle. http://www.bouncycastle.org/csharp/ Cheers -------------- next part -------------- An HTML attachment was scrubbed... URL: From will at hotgazpacho.org Thu Sep 23 15:35:25 2010 From: will at hotgazpacho.org (Will Green) Date: Thu, 23 Sep 2010 15:35:25 -0400 Subject: [Ironruby-core] OpenSSL support for IronRuby In-Reply-To: References: Message-ID: Yeah, I saw that a couple months ago when I stated some work on trying to use the native .NET crypto APIs. You know, before I realized I was in over my head :-) I haven't had time to look into wrapping the Bouncy Castle assembly for IronRuby, but I would think it would be orders of magnitude easier to create a pure Ruby wrapper over that assembly. -- Will Green http://hotgazpacho.org/ On Thu, Sep 23, 2010 at 12:09 PM, Ivan Porto Carerro wrote: > I don't know if openssl is still a problem for IronRuby on mono > > But the JRuby guys are using bouncy castle to get that support. As it so > happens there is also a .Net provider for bouncy castle. > > http://www.bouncycastle.org/csharp/ > > Cheers > > _______________________________________________ > 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 charles.c.strahan at gmail.com Fri Sep 24 01:32:18 2010 From: charles.c.strahan at gmail.com (Charles Strahan) Date: Fri, 24 Sep 2010 00:32:18 -0500 Subject: [Ironruby-core] OpenSSL support for IronRuby In-Reply-To: References: Message-ID: Nice find, Ivan. I'll have to look into it when I get the chance. - Charles On Thu, Sep 23, 2010 at 11:09 AM, Ivan Porto Carerro wrote: > I don't know if openssl is still a problem for IronRuby on mono > > But the JRuby guys are using bouncy castle to get that support. As it so > happens there is also a .Net provider for bouncy castle. > > http://www.bouncycastle.org/csharp/ > > Cheers > > _______________________________________________ > 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 charles.c.strahan at gmail.com Fri Sep 24 02:40:07 2010 From: charles.c.strahan at gmail.com (Charles Strahan) Date: Fri, 24 Sep 2010 01:40:07 -0500 Subject: [Ironruby-core] Inheritance in IronRuby - possibly a bug or two? Message-ID: I have a couple questions about deriving from C# class from IronRuby. For context, here's a code example that I will refer to here in a bit: ======================================== using System; using System.Reflection; using IronRuby; using IronRuby.Runtime; using Microsoft.Scripting.Hosting.Providers; namespace Example1 { public class Person { public string FirstName { get; set; } public string LastName { get; set; } public Person(string firstName, string lastName) { FirstName = firstName; LastName = lastName; } } class Program { private static readonly string _rubyScript = @" class Person2 < Example1::Person def initialize(first, last) super(first, last) end end Person2.new(""Foo"", ""Bar"") "; static void Main(string[] args) { var runtime = Ruby.CreateRuntime(); var engine = runtime.GetEngine("rb"); var context = (RubyContext)HostingHelpers.GetLanguageContext(engine); var scope = engine.CreateScope(); runtime.LoadAssembly(typeof(Program).Assembly); engine.Execute(_rubyScript, scope); Console.WriteLine(". . ."); Console.ReadKey(true); } } } ======================================== If you run that code, you'll get the following: InvalidOperationException: can't allocate class `Person2' that derives from type `Example1::Person' with no default constructor; define Person2#new singleton method instead of Person2#initialize Is this a bug, or is this intended behavior? If this is intentional, then I think there's still a different problem: try adding this default constructor and then run the code: public Person() { Console.WriteLine("Uhmmm... what did IronRuby do with `super(first, last)`?"); } So, the `super(first, last)` still get's executed... but what did it do? It obviously didn't forward those arguments to the non-default constructor... So, I think that means we have one, or possibly two, bugs. Back to the first question: Wouldn't it be possible to determine the correct constructor to invoke based on the arguments, thus avoiding the exception? I would imagine that the generated/emitted subclass could contain all of the same constructors that the base type has, just passing the arguments on to the base class's corresponding constructor (I hope that made sense - sorta tricky to word that correctly). By the way, how should I specify that I _don't_ want the Ruby code to be interpreted? I noticed that the debugger broke in Microsoft.Scripting.Interpreter.Interpreter... maybe that could be part of the problem. Cheers, -Charles -------------- next part -------------- An HTML attachment was scrubbed... URL: From Tomas.Matousek at microsoft.com Fri Sep 24 03:38:40 2010 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Fri, 24 Sep 2010 07:38:40 +0000 Subject: [Ironruby-core] Inheritance in IronRuby - possibly a bug or two? In-Reply-To: References: Message-ID: This behavior is actually by design. The error message says: "... define Person2#new singleton method instead of Person2#initialize" like so: class Person2 < Example1::Person def self.new(first, last) super(first, last) end end person = Person2.new("Foo", "Bar") p person.first_name, person.last_name We do pick up the superclass's constructors if you don't specify no initialize method, so this works too: class Person2 < Person end person = Person2.new("Foo", "Bar") p person.first_name, person.last_name The reason why this doesn't work when you define initialize is to make you aware of the fact that your initialize method doesn't do what you might expect, that is it doesn't call the constructor of the superclass. If you define a default ctor in the superclass and you have initialize method in the subclass, the constructor gets invoked to create the object and initialize is called to initialize it. This patter is kind of close to Ruby semantics. So you basically have 3 options: - Do not define new nor initialize => the ctors from base class are available for construction of the subclass - Define singleton new => you can choose which base ctor is called. - The base class has a default ctor and the subclass defines initialize method => the default ctor is always used for object construction and the initialize is called with the arguments given to "new". The reason why we chose this design is due to difference between Ruby and CLR initialization semantics. CLR classes don't separate allocation ("allocate") from initialization ("initialize") like Ruby does. CLR has just constructors (which kind of corresponds to Ruby factory method "new"). Constructors combine allocation and initialization. The problem with mapping initialize to CLR constructors is that it operates on "self" that is already allocated before you can do anything (like call super): def initialize(first, last) p self.first_name # self is already an instance of Person2 here, so we must have called some constructor already (the default one if available) super(first, last) # what should this do? We can't call the constructor again... it's too late. end As for what super(first, last) does in your code ... it calls "Object#initialize", which in Ruby 1.9.2 has *args parameters and does nothing: >>> class X; end => nil >>> init = X.instance_method(:initialize) => # >>> init.parameters => [[:rest]] >>> X.new.send(:initialize, 1,2,3,4,5) => # Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Charles Strahan Sent: Thursday, September 23, 2010 11:40 PM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] Inheritance in IronRuby - possibly a bug or two? I have a couple questions about deriving from C# class from IronRuby. For context, here's a code example that I will refer to here in a bit: ======================================== using System; using System.Reflection; using IronRuby; using IronRuby.Runtime; using Microsoft.Scripting.Hosting.Providers; namespace Example1 { public class Person { public string FirstName { get; set; } public string LastName { get; set; } public Person(string firstName, string lastName) { FirstName = firstName; LastName = lastName; } } class Program { private static readonly string _rubyScript = @" class Person2 < Example1::Person def initialize(first, last) super(first, last) end end Person2.new(""Foo"", ""Bar"") "; static void Main(string[] args) { var runtime = Ruby.CreateRuntime(); var engine = runtime.GetEngine("rb"); var context = (RubyContext)HostingHelpers.GetLanguageContext(engine); var scope = engine.CreateScope(); runtime.LoadAssembly(typeof(Program).Assembly); engine.Execute(_rubyScript, scope); Console.WriteLine(". . ."); Console.ReadKey(true); } } } ======================================== If you run that code, you'll get the following: InvalidOperationException: can't allocate class `Person2' that derives from type `Example1::Person' with no default constructor; define Person2#new singleton method instead of Person2#initialize Is this a bug, or is this intended behavior? If this is intentional, then I think there's still a different problem: try adding this default constructor and then run the code: public Person() { Console.WriteLine("Uhmmm... what did IronRuby do with `super(first, last)`?"); } So, the `super(first, last)` still get's executed... but what did it do? It obviously didn't forward those arguments to the non-default constructor... So, I think that means we have one, or possibly two, bugs. Back to the first question: Wouldn't it be possible to determine the correct constructor to invoke based on the arguments, thus avoiding the exception? I would imagine that the generated/emitted subclass could contain all of the same constructors that the base type has, just passing the arguments on to the base class's corresponding constructor (I hope that made sense - sorta tricky to word that correctly). By the way, how should I specify that I _don't_ want the Ruby code to be interpreted? I noticed that the debugger broke in Microsoft.Scripting.Interpreter.Interpreter... maybe that could be part of the problem. Cheers, -Charles -------------- next part -------------- An HTML attachment was scrubbed... URL: From charles.c.strahan at gmail.com Fri Sep 24 05:04:38 2010 From: charles.c.strahan at gmail.com (Charles Strahan) Date: Fri, 24 Sep 2010 04:04:38 -0500 Subject: [Ironruby-core] Inheritance in IronRuby - possibly a bug or two? In-Reply-To: References: Message-ID: Ah, the semantics do make sense now. In that case, perhaps there's one more solution: class PersonShim < Example1::Person def self.new(first, last) Example1::Person.new(first, last) end end class Person2 < PersonShim def initialize(first, last) super(first, last) end end Person2.new(""Foo"", ""Bar"") In my case, I need to make sure that the C# types that I expose to IronRuby behave almost identically to what you would expect with a pure Ruby implementation. If you remember back when I was talking about my game engine clone, I need to make sure that I don't break user's scripts - so I need to preserve the "expected" semantics of `initialize`. What I could do is end my C# classes with "Impl", and write a corresponding Ruby class that invokes the correct constructor in `new` (ex: SpriteSubclass -> Sprite -> SpriteImpl). Mind giving me a sanity check on this, Tomas? I think this should fix the problem I was having with subclassing my Sprite class - which get's me one step closer to releasing this beast! Thank you, Tomas, that was a very thorough explanation. -Charles On Fri, Sep 24, 2010 at 2:38 AM, Tomas Matousek < Tomas.Matousek at microsoft.com> wrote: > This behavior is actually by design. > > > > The error message says: ?? define Person2#new singleton method instead of > Person2#initialize? like so: > > > > class Person2 < Example1::Person > > def self.new(first, last) > > super(first, last) > > end > > end > > > > person = Person2.new("Foo", "Bar") > > p person.first_name, person.last_name > > > > We do pick up the superclass?s constructors if you don?t specify no > initialize method, so this works too: > > > > class Person2 < Person > > end > > > > person = Person2.new("Foo", "Bar") > > p person.first_name, person.last_name > > > > The reason why this doesn?t work when you define initialize is to make you > aware of the fact that your initialize method doesn?t do what you might > expect, that is it doesn?t call the constructor of the superclass. > > > > If you define a default ctor in the superclass and you have initialize > method in the subclass, the constructor gets invoked to create the object > and initialize is called to initialize it. This patter is kind of close to > Ruby semantics. > > > > So you basically have 3 options: > > - Do not define new nor initialize => the ctors from base class > are available for construction of the subclass > > - Define singleton new => you can choose which base ctor is > called. > > - The base class has a default ctor and the subclass defines > initialize method => the default ctor is always used for object construction > and the initialize is called with the arguments given to ?new?. > > > > The reason why we chose this design is due to difference between Ruby and > CLR initialization semantics. CLR classes don?t separate allocation > (?allocate?) from initialization (?initialize?) like Ruby does. CLR has just > constructors (which kind of corresponds to Ruby factory method ?new?). > Constructors combine allocation and initialization. The problem with mapping > initialize to CLR constructors is that it operates on ?self? that is already > allocated before you can do anything (like call super): > > > > def initialize(first, last) > > p self.first_name # self is already an instance of > Person2 here, so we must have called some constructor already (the default > one if available) > > super(first, last) # what should this do? We can?t > call the constructor again? it?s too late. > > end > > > > > > As for what super(first, last) does in your code ? it calls > ?Object#initialize?, which in Ruby 1.9.2 has *args parameters and does > nothing: > > > > >>> class X; end > > => nil > > >>> init = X.instance_method(:initialize) > > => # > > >>> init.parameters > > => [[:rest]] > > >>> X.new.send(:initialize, 1,2,3,4,5) > > => # > > > > Tomas > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Charles Strahan > *Sent:* Thursday, September 23, 2010 11:40 PM > *To:* ironruby-core at rubyforge.org > *Subject:* [Ironruby-core] Inheritance in IronRuby - possibly a bug or > two? > > > > I have a couple questions about deriving from C# class from IronRuby. For > context, here's a code example that I will refer to here in a bit: > > > > ======================================== > > > > using System; > > using System.Reflection; > > using IronRuby; > > using IronRuby.Runtime; > > using Microsoft.Scripting.Hosting.Providers; > > > > namespace Example1 > > { > > public class Person > > { > > public string FirstName { get; set; } > > public string LastName { get; set; } > > > > public Person(string firstName, string lastName) > > { > > FirstName = firstName; > > LastName = lastName; > > } > > } > > > > class Program > > { > > private static readonly string _rubyScript = @" > > > > class Person2 < Example1::Person > > def initialize(first, last) > > super(first, last) > > end > > end > > > > Person2.new(""Foo"", ""Bar"") > > > > "; > > > > static void Main(string[] args) > > { > > var runtime = Ruby.CreateRuntime(); > > var engine = runtime.GetEngine("rb"); > > var context = > (RubyContext)HostingHelpers.GetLanguageContext(engine); > > var scope = engine.CreateScope(); > > runtime.LoadAssembly(typeof(Program).Assembly); > > > > engine.Execute(_rubyScript, scope); > > > > Console.WriteLine(". . ."); > > Console.ReadKey(true); > > } > > } > > } > > > > > > ======================================== > > > > > > If you run that code, you'll get the following: > > > > InvalidOperationException: can't allocate class `Person2' that derives from > type `Example1::Person' with no default constructor; define Person2#new > singleton method instead of Person2#initialize > > > > Is this a bug, or is this intended behavior? If this is intentional, then > I think there's still a different problem: try adding this default > constructor and then run the code: > > > > public Person() > > { > > Console.WriteLine("Uhmmm... what did IronRuby do with > `super(first, last)`?"); > > } > > > > So, the `super(first, last)` still get's executed... but what did it do? It > obviously didn't forward those arguments to the non-default constructor... > > > > So, I think that means we have one, or possibly two, bugs. > > > > Back to the first question: Wouldn't it be possible to determine the > correct constructor to invoke based on the arguments, thus avoiding the > exception? I would imagine that the generated/emitted subclass could contain > all of the same constructors that the base type has, just passing the > arguments on to the base class's corresponding constructor (I hope that made > sense - sorta tricky to word that correctly). > > > > > > By the way, how should I specify that I _don't_ want the Ruby code to be > interpreted? I noticed that the debugger broke > in Microsoft.Scripting.Interpreter.Interpreter... maybe that could be part > of the problem. > > > > Cheers, > > -Charles > > _______________________________________________ > 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 ralinx at davybrion.com Fri Sep 24 08:33:58 2010 From: ralinx at davybrion.com (Davy Brion) Date: Fri, 24 Sep 2010 14:33:58 +0200 Subject: [Ironruby-core] problem with igem/gem in latest ironruby from github? Message-ID: Hi, i'm using the latest ironruby from github, and when i try to run igem install it just fails with the following message: D:\Projects\ironruby\bin\Debug>igem install rspec ERROR: http://rubygems.org/ does not appear to be a repository ERROR: Could not find a valid gem 'rspec' (>= 0) in any repository any ideas? it works with the 1.1 alpha 1 release, but i had to upgrade to ironruby from github for some 1.9.x fixes brs, Davy -------------- next part -------------- An HTML attachment was scrubbed... URL: From antonfir at gmail.com Fri Sep 24 11:57:33 2010 From: antonfir at gmail.com (Anton Firsov) Date: Fri, 24 Sep 2010 17:57:33 +0200 Subject: [Ironruby-core] running ruby script from my own .NET code is slow In-Reply-To: References: Message-ID: Hi, I still have this performance problem. I think there must be a reason, and it could be solved somehow. Really no ideas? Anton 2010/9/13 Anton Firsov > Here is the code: > http://paste.dprogramming.com/dpk25ghd > (It's just a dummy speed test) > > I tried several ways to call it: > runtime = Ruby.CreateRuntime(); > engine = Ruby.GetEngine(runtime); > > #than > engine.ExecuteFile("test.rb"); > #or > engine.CreateScriptSourceFromFile("lib.rb").Execute() > #or > CompiledCode code = engine.CreateScriptSourceFromFile("test.rb").Compile(); > code.Execute(); > > Actually they all give the same results... > > > 2010/9/13 Tomas Matousek > >> Can you give an example of what script it is and how you exactly run it >> from the .NET app? >> >> >> >> Tomas >> >> >> >> *From:* ironruby-core-bounces at rubyforge.org [mailto: >> ironruby-core-bounces at rubyforge.org] *On Behalf Of *Anton Firsov >> *Sent:* Sunday, September 12, 2010 4:18 PM >> *To:* ironruby-core at rubyforge.org >> *Subject:* [Ironruby-core] running ruby script from my own .NET code is >> slow >> >> >> >> Hi all! >> >> Why it is ~5 times slower to run the same .rb script from my .NET >> application (using ScriptEngine and ScriptRuntime) classes, than doing the >> same with ir.exe? >> When I downloaded IronRuby source, and compiled ir.exe (Ruby.Console), it >> was 2 times slower, than ir.exe in released binaries. (But still 3 times >> faster than running scripts from my own application) >> >> Any ideas, what is behind these differences? >> >> _______________________________________________ >> 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 Mon Sep 27 14:26:21 2010 From: lists at ruby-forum.com (Christopher Bennage) Date: Mon, 27 Sep 2010 20:26:21 +0200 Subject: [Ironruby-core] data binding in Silverlight 4 Message-ID: <492c770778106623b4d992cdbc3671fe@ruby-forum.com> I'm beginning to research this, but I don't want to reinvent the wheel if there is already a solution out there. My understanding of the problem is this: Data binding in Silverlight does not work because the system doesn't know how to handle dynamic objects. This is not the case in WPF because the binding system there uses type descriptors, but type descriptors aren't available in Silverlight. Is this your understanding as well? Has there been any creative solutions to this problem? Does anyone have details on what the binding system is really doing in Silverlight? -- Posted via http://www.ruby-forum.com/. From charles.c.strahan at gmail.com Mon Sep 27 15:58:43 2010 From: charles.c.strahan at gmail.com (Charles Strahan) Date: Mon, 27 Sep 2010 14:58:43 -0500 Subject: [Ironruby-core] data binding in Silverlight 4 In-Reply-To: <492c770778106623b4d992cdbc3671fe@ruby-forum.com> References: <492c770778106623b4d992cdbc3671fe@ruby-forum.com> Message-ID: That's my understanding. Silverlight will only reflect over properties, as it does not use type descriptors - nor does it know how to determine a dynamic object's attributes. If you use attr_accessor, I believe that'll result in corresponding properties being added to the generated class. If all else fails, you could use the Silveright DataSet ( http://silverlightdataset.net/silverlightdataset/Default.aspx) project to create bindable objects. Behind the scenes, it will create a class with properties that match the column names you pass in. I used it in a recent project where I needed to display a DataGrid bound to the results of an IDataReader, where the columns weren't known until runtime. Just throwin' it out there. -Charles On Mon, Sep 27, 2010 at 1:26 PM, Christopher Bennage wrote: > I'm beginning to research this, but I don't want to reinvent the wheel > if there is already a solution out there. > > My understanding of the problem is this: > Data binding in Silverlight does not work because the system doesn't > know how to handle dynamic objects. This is not the case in WPF because > the binding system there uses type descriptors, but type descriptors > aren't available in Silverlight. > > Is this your understanding as well? > Has there been any creative solutions to this problem? > Does anyone have details on what the binding system is really doing in > Silverlight? > -- > 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 briangenisio at gmail.com Mon Sep 27 21:48:48 2010 From: briangenisio at gmail.com (Brian Genisio) Date: Mon, 27 Sep 2010 21:48:48 -0400 Subject: [Ironruby-core] data binding in Silverlight 4 In-Reply-To: References: <492c770778106623b4d992cdbc3671fe@ruby-forum.com> Message-ID: SIlverlight, unlike WPF, is incapable of binding to dynamic properties. Static properties, on the other hand are no problem. One way around this is to create a string indexer on your class (this[string index]) that returns the property by name. Then, in the XAML, you can bind using array (square-bracket) syntax: . I do this in C# a lot, and I am pretty sure it translates the same in IronRuby: http://houseofbilz.com/archives/2010/05/14/adventures-in-mvvm-my-viewmodel-base-silverlight-support/ Good luck, Brian On Mon, Sep 27, 2010 at 3:58 PM, Charles Strahan < charles.c.strahan at gmail.com> wrote: > That's my understanding. Silverlight will only reflect over properties, as > it does not use type descriptors - nor does it know how to determine a > dynamic object's attributes. > > If you use attr_accessor, I believe that'll result in corresponding > properties being added to the generated class. > > If all else fails, you could use the Silveright DataSet ( > http://silverlightdataset.net/silverlightdataset/Default.aspx) project to > create bindable objects. Behind the scenes, it will create a class with > properties that match the column names you pass in. I used it in a recent > project where I needed to display a DataGrid bound to the results of an > IDataReader, where the columns weren't known until runtime. Just throwin' it > out there. > > -Charles > > > On Mon, Sep 27, 2010 at 1:26 PM, Christopher Bennage > wrote: > >> I'm beginning to research this, but I don't want to reinvent the wheel >> if there is already a solution out there. >> >> My understanding of the problem is this: >> Data binding in Silverlight does not work because the system doesn't >> know how to handle dynamic objects. This is not the case in WPF because >> the binding system there uses type descriptors, but type descriptors >> aren't available in Silverlight. >> >> Is this your understanding as well? >> Has there been any creative solutions to this problem? >> Does anyone have details on what the binding system is really doing in >> Silverlight? >> -- >> 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From christopher at bluespireconsulting.com Tue Sep 28 17:23:39 2010 From: christopher at bluespireconsulting.com (Christopher Bennage) Date: Tue, 28 Sep 2010 17:23:39 -0400 Subject: [Ironruby-core] data binding in Silverlight 4 In-Reply-To: References: <492c770778106623b4d992cdbc3671fe@ruby-forum.com> Message-ID: Here's some interesting background about what's happened with IronPython: http://devhawk.net/CategoryView,category,__clrtype__.aspx I'm still reading through it all, but note in particular the post from April 24, 2009: http://devhawk.net/2009/04/20/Introducing+Clrtype+Metaclasses.aspx My guess is that concept of __clrtype__ never made it over into IronRuby.. Brian, regarding your string indexer idea. I assume that you mean to implement the indexer on a C# class and then inherit from that in ruby? That idea has some merit, I'll look into it. -------------- next part -------------- An HTML attachment was scrubbed... URL: From briangenisio at gmail.com Tue Sep 28 17:46:29 2010 From: briangenisio at gmail.com (Brian Genisio) Date: Tue, 28 Sep 2010 17:46:29 -0400 Subject: [Ironruby-core] data binding in Silverlight 4 In-Reply-To: References: <492c770778106623b4d992cdbc3671fe@ruby-forum.com> Message-ID: Christopher, My example is in C# using dynamic, but there must be a way to write an Indexer in Ruby that can interop properly. If all else failed, you could write a C# decorator that exposes the Ruby properties dynamically through a string Indexer. Good luck! Let us know what you figure out :) B On Sep 28, 2010 5:31 PM, "Christopher Bennage" < christopher at bluespireconsulting.com> wrote: > Here's some interesting background about what's happened with IronPython: > http://devhawk.net/CategoryView,category,__clrtype__.aspx > I'm still reading through it all, but note in particular the post from April > 24, 2009: > http://devhawk.net/2009/04/20/Introducing+Clrtype+Metaclasses.aspx > > My guess is that concept of __clrtype__ never made it over into IronRuby.. > > Brian, regarding your string indexer idea. I assume that you mean to > implement the indexer on a C# class and then inherit from that in ruby? That > idea has some merit, I'll look into it. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Wed Sep 29 01:10:54 2010 From: lists at ruby-forum.com (Christopher Bennage) Date: Wed, 29 Sep 2010 07:10:54 +0200 Subject: [Ironruby-core] showing the REPL console in a Silverlight app Message-ID: I'm playing with the Chiron examples (\silverlight\samples\Clock\ruby) and I want to bring up the REPL console. If I throw an exception by adding raising an exception, then I can see the console when the error is displayed. However, when I add "console=true" to the InitParams and I can only see the minimize button andnothing else. When I examine the html DOM, I don't see the expected div containing the console (silverlightDlrRepl1). Am I missing something? I'm testing in both Chrome and IE, same results. -- Posted via http://www.ruby-forum.com/. From ivan at flanders.co.nz Wed Sep 29 02:44:49 2010 From: ivan at flanders.co.nz (Ivan Porto Carerro) Date: Wed, 29 Sep 2010 07:44:49 +0100 Subject: [Ironruby-core] data binding in Silverlight 4 In-Reply-To: References: <492c770778106623b4d992cdbc3671fe@ruby-forum.com> Message-ID: you can always check out my ironnails project that does it for wpf and uses dictionaries. http://github.com/casualjim/ironnails The databinding approach I used should work in silverlight too On Tue, Sep 28, 2010 at 10:23 PM, Christopher Bennage < christopher at bluespireconsulting.com> wrote: > Here's some interesting background about what's happened with IronPython: > http://devhawk.net/CategoryView,category,__clrtype__.aspx > I'm still reading through it all, but note in particular the post from > April 24, 2009: > http://devhawk.net/2009/04/20/Introducing+Clrtype+Metaclasses.aspx > > My guess is that concept of __clrtype__ never made it over into IronRuby.. > > Brian, regarding your string indexer idea. I assume that you mean to > implement the indexer on a C# class and then inherit from that in ruby? That > idea has some merit, I'll look into it. > > > _______________________________________________ > 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 thibaut.barrere at gmail.com Thu Sep 30 15:41:48 2010 From: thibaut.barrere at gmail.com (=?ISO-8859-1?Q?Thibaut_Barr=E8re?=) Date: Thu, 30 Sep 2010 21:41:48 +0200 Subject: [Ironruby-core] Insight on the future of IronRuby ? Message-ID: Hi guys (and girls, if any), I'd really, really like to have any hint of where IronRuby and the DLR are going, roughly. We're considering using IR as a scripting engine for a fairly important desktop app, so I thought I would ask, now that the dust has settled. Any idea ? thanks! -- Thibaut -------------- next part -------------- An HTML attachment was scrubbed... URL: