From Jimmy.Schementi at microsoft.com Wed Jul 1 03:08:34 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Wed, 1 Jul 2009 07:08:34 +0000 Subject: [Ironruby-core] Code Review: HashFixes In-Reply-To: <0047ECBFA2E0DF4A834AA369282A5AFC18AF3DC5@tk5ex14mbxc106.redmond.corp.microsoft.com> References: <0047ECBFA2E0DF4A834AA369282A5AFC18AF3DC5@tk5ex14mbxc106.redmond.corp.microsoft.com> Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC18AFDB9D@tk5ex14mbxc106.redmond.corp.microsoft.com> No takers? I've documented this at http://ironruby.net/Documentation/Ruby_Standard_Library/Modifications so if anyone wants to bite the info is there. ~js > -----Original Message----- > From: Jimmy Schementi > Sent: Tuesday, June 23, 2009 2:45 PM > To: Tomas Matousek; IronRuby External Code Reviewers > Cc: ironruby-core at rubyforge.org > Subject: RE: Code Review: HashFixes > > How are we going to make sure this gets back into REXML and RubyGems? > We shouldn't ship significantly different versions of the Ruby stdlib, as > people will expect to switch to any version of the stdlib without issues. > > My first thought is to have someone in the community step up to propose > these changes to RubyGems and REXML for us, and get them checked in. > Anyone interested? > > ~js > > > -----Original Message----- > > From: Tomas Matousek > > Sent: Tuesday, June 23, 2009 1:37 PM > > To: IronRuby External Code Reviewers > > Cc: ironruby-core at rubyforge.org > > Subject: Code Review: HashFixes > > > > tfpt review "/shelveset:HashFixes;REDMOND\tomat" > > > > Fixes implementation of hash methods in REXML and RubyGems. The > > current implementation is incorrect since it sums hash codes of > > subcomponents potentially overflowing to Bignum. This issue is mainly > > exposed when calculating hash of an array. Array#hash calculates its > > hash code by calling hash on each item and converting the result of > > the hash method into Fixnum. So if the result if the hash method is a > > Bignum an error is reported: > > > > class C > > def hash > > 100000000000000000000 > > end > > end > > > > [C.new].hash # => in `hash': bignum too big to convert into `long' > > (RangeError) > > > > Tomas From Jimmy.Schementi at microsoft.com Wed Jul 1 04:08:08 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Wed, 1 Jul 2009 08:08:08 +0000 Subject: [Ironruby-core] Basic interoperability question In-Reply-To: References: Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC18AFDDDA@tk5ex14mbxc106.redmond.corp.microsoft.com> Should require 'mscorlib' not be needed though? Does the first reference to "System" do this automatically? JRuby requires that you do "require 'java'" to get at any Java classes, and I'm not what the benefit to doing it implicitly is. IronPython also has the "import clr" requirement, so what to people thing about the lack of a signal as to whether a IronRuby script uses .NET types or not? Tomas, can you elaborate on why this is technically not needed anymore? > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > bounces at rubyforge.org] On Behalf Of Tomas Matousek > Sent: Sunday, June 07, 2009 4:04 PM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Basic interoperability question > > As for #2: it doesn't work yet. instance_methods currently only includes Ruby > methods and methods that were already called (are cached) but it should > indeed include names of all instance CLR members. > > Tomas > > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > bounces at rubyforge.org] On Behalf Of Jim Deville > Sent: Sunday, June 07, 2009 11:49 AM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Basic interoperability question > > Require 'mscorlib' is not as essential anymore. If you run ir -e "puts > System::String.class" it will wolrk just fine. I still use require 'mscorlib' in my > scripts tlo signal to other programmers that this scrpt will use .NET interop, > but I don't think it is needed. > > I'll let Tomas answer the second part, and clarify my answer if needed. > > JD > > ....there is no try > Sent from my phone. Please excuse typos and txtspk. > > -----Original Message----- > From: Shay Friedman > Sent: June 07, 2009 9:45 AM > To: ironruby-core at rubyforge.org > Subject: [Ironruby-core] Basic interoperability question > > > Hi, > > I would like to know why interoperability is such a long word? > > just kidding! > > I'm playing with the CLR interoperability and I have some questions: > 1. Is "require 'mscorlib'" really essential? > 2. Should investigating Clr objects work? > For example, this is what happens now: > >>> System::Data::DataSet.instance_methods - Class.methods > => [] > > Only after I create a dataset object and access, for instance, the tables > property, the "tables" method is added to the instance_methods list. > > Many thanks! > Shay. > > ---------------------------- > http://www.ironshay.com > Follow me: http://twitter.com/ironshay > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core From Johan.Danforth at irm.se Thu Jul 2 06:49:14 2009 From: Johan.Danforth at irm.se (Johan Danforth) Date: Thu, 2 Jul 2009 12:49:14 +0200 Subject: [Ironruby-core] srand implemented? In-Reply-To: References: Message-ID: <12D498AE0ADB20479A22F41E113B67D321C19D8453@sun.irm.se> I started to implement it, but ran into a halt with rand and srand for big integers. Then my son got very ill and we've been fighting that war since then I'm afraid :( I thought someone had picked up the ball by now? I could perhaps dig up what I did back then and send someone? If anyone has a good idea for doing random big integers, shout. I had a few ideas, but wanted to do it properly and I never went to school, so... ;) /Johan -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Jim Deville Sent: den 13 maj 2009 20:46 To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] srand implemented? Has anyone replied to this? JD ...there is no try > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > bounces at rubyforge.org] On Behalf Of Justin Bailey > Sent: Tuesday, April 21, 2009 9:37 AM > To: ironruby-core at rubyforge.org > Subject: [Ironruby-core] srand implemented? > > Is srand implemented? How can I seed the random number generator if not? > A quick search showed some discussion about it last May but I didn't see any > activity since then ... > > Justin > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From Jimmy.Schementi at microsoft.com Thu Jul 2 15:23:22 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Thu, 2 Jul 2009 19:23:22 +0000 Subject: [Ironruby-core] [ANN] IronRuby 0.6 Released Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC18B07102@tk5ex14mbxc106.redmond.corp.microsoft.com> The IronRuby team is pleased to announce a new release of IronRuby: IronRuby 0.6! == Download IronRuby 0.6 http://ironruby.net/Download You can also check out the source code for this release http://github.com/ironruby/ironruby/tree/v0.6.0 For a nicely formatted version of these release notes: http://blog.jimmy.schementi.com/2009/07/ironruby-06-released.html A copy of these release notes and changes are also here: http://rubyforge.org/frs/shownotes.php?group_id=4359&release_id=36423 Staying true to our "Conference-driven development schedule," this release is in conjunction with ... wait, there is no conference this time! Just a good ol' monthly release of IronRuby, chock full of awesomeness. And just so happens to be the 4th of July weekend, so hopefully you have some downtime this weekend and can give the new release a spin. == What's in the Release? Performance has been a major focus to this release, getting startup time quicker and optimizing built-in types. And there's been more progress with Ruby compatibility (Cucumber works!) and .NET interop. Silverlight binaries are back in the release, and there are a couple of samples to help you learn IronRuby. Most of these descriptions are from Tomas's very detailed code review emails, so thanks Tomas! For more detailed information, please see the CHANGELOG (which includes all commit messages for the release ... not just "syncing to head of tfs") -- Lazy method compilation Last release adaptive compilation was enabled for IronRuby, which uses a fast-to-start-up interpreter to start up the program, while code which gets run a lot is compiling on a background thread. This gave IronRuby significant performance improvements for large apps like Rails, which has improved startup by 2.5 times. This release we've added "lazy method transformation" to the bag of startup performance tricks. In IronRuby 0.5, a method was transformed to the DLR AST as soon as it was defined. IronRuby 0.6 postpones the transformation until the first time the method is called. This significantly improves startup time. For example (not NGEN'd): require 'benchmark' Benchmark.bm { |x| x.report { require 'rubygems' } } user system total real eager transformation 1.622410 0.031200 1.653611 ( 1.581316) lazy transformation 1.170008 0.031200 1.201208 ( 1.099220) This has made Rails startup time 30% faster, coming in approximately 20 seconds on my dual-core laptop running Windows 7. -- CLR member enumeration Now methods like Module#instance_methods, etc, include CLR member names. Though it's a lot cooler than that. The array of methods returns contains strings for Ruby methods, and objects of type IronRuby::Clr::Name to represent CLR methods that can be called by either the actual CLR name or a mangled (Ruby-esk) name. ClrName has methods to_s, to_sym, to_str, <=>, inspect, dump so that it can be used wherever a string can be used. The display string for the name uses single quotes so that you can easily distinguish CLR (dual) names from regular names (plain mutable strings). CLR strings display themselves as single quoted strings, so this fits nicely. >>> System::Byte.instance_methods(false) => ["-", "%", "&", "*", "**", "/", "-@", "[]", "^", "|", "~", "+", "<", "<<", "<=", "<=>", "==", ">", ">=", ">>", "abs", "div", "divmod", "modulo", "quo", "to_f", "to_s", "zero?", "size", 'compare_to', 'equals', 'get_hash_code', 'to_string', 'get_type_code'] >>> l = System::Byte.instance_methods(false).last => 'get_type_code' >>> l.ruby_name => "get_type_code" >>> l.clr_name => "GetTypeCode" Even cooler, this works well for meta-programming: class System::Decimal instance_methods(false).each do |name| mangled = '__' + name alias_method(mangled, name) private mangled define_method(name) do |*args| puts "method called: #{name}" send mangled, *args end end end x, y = System::Decimal.new(1), System::Decimal.new(2) p x + y # => "method called: +" p x.CompareTo(y) # => "method called: compare_to" A new set of define_method overloads, strongly typed to ClrName, have been added to enable this. They define the real method using the ruby_name and alias it using the clr_name. So both CompareTo and compare_to calls are intercepted. -- Generic-Method Parameters-Inference Thanks to some work by the IronPython team, IronRuby now has parameter inference for generic methods. // c.dll public class C { public void Foo(T x) { Console.WriteLine(typeof(T)); } } require 'c' C.new.foo(1) # System.Int32 C.new.foo("x") # IronRuby.Builtins.MutableString C.new.foo(1.0) # System.Double This needs some more TLC before it works perfectly, but this lets you use simple LINQ methods from IronRuby. load_assembly "System.Core" #=> true System::Linq::Enumerable.First([1,2,3]) #=> 1 System::Linq::Enumerable.ElementAt([1,2,3,4,5], 2) #=> 3 -- Testing C# with Cucumber This release of IronRuby runs the Cucumber testing framework rather well. Try out Cucumber against some C# code here: http://wiki.github.com/aslakhellesoy/cucumber/ironruby-and-net Given a feature file (this being the addition.feature): Feature: Addition In order to avoid silly mistakes As a math idiot I want to be told the sum of two numbers Scenario Outline: Add two numbers Given I have entered into the calculator And I have entered into the calculator When I press add Then the result should be on the screen Examples: | input_1 | input_2 | output | | 20 | 30 | 50 | | 2 | 5 | 7 | | 0 | 40 | 40 | A step_definition file (calculator_steps.rb): require 'spec/expectations' require 'Calculator' # Calculator.dll Before do @calc = Demo::Calculator.new # A .NET class in Calculator.dll end Given "I have entered $n into the calculator" do |n| @calc.push n.to_i end When /I press add/ do @result = @calc.Add end Then /the result should be (.*) on the screen/ do |result| @result.should == result.to_i end And a DLL: using System; using System.Collections.Generic; namespace Demo { public class Calculator { private Listargs = new List(); public void Push(int n) { args.Add(n); } public int Add() { int result = 0; foreach(int n in args) { result += n; } return result; } } } Cucumber will test the addition feature: 3 scenarios (3 passed) 12 steps (12 passed) 0m0.753s -- Silverlight building and updated binaries This release re-adds Silverlight binaries to IronRuby, contained in the "silverlight" directory of the release. These bits have been integrated from the AgDLR project (http://github.com/jschementi/agdlr), and will be maintained in the IronRuby and IronPython source code repositories from now on. The AgDLR GitHub project will redirect to one of those for binaries for both languages in Silverlight. In addition, the SDLSDK (http://sdlsdk.codeplex.com) site will be redirecting to the IronRuby and IronPython CodePlex sites, for downloads, discussion, and issue tracking. AgDLR was a little side project to add new features to DLR Silverlight applications, and play around with Git. I'm very happy to see it merged back in with the languages. See the integration commit for more information: http://github.com/ironruby/ironruby/commit/33211840f7482ffaa4970a6e630725fad2a70f5d Another notable change is that you can now build Silverlight binaries out of IronRuby's GitHub repository very easily. Given that you have Silverlight installed at "C:\Program Files\Microsoft Silverlight\2.0.40115.0", this will build IronRuby for Silverlight: msbuild Merlin/Main/Languages/Ruby/Ruby.sln /p:Configuration="Silverlight Release" /p:SilverlightPath="C:\Program Files\Microsoft Silverlight\2.0.40115.0" You can also build IronPython for Silverlight in a similar manner. Aliases for this will be added soon, but if you need a custom build of the DLR languages for Silverlight, this is the way to do it. -- Samples Six samples are included in this release. The first three are desktop samples in the "/samples" directory. The last three are Silverlight samples in the "/silverlight/samples" directory: 1. Tutorial - An interactive IronRuby tutorial. Read more about it here: http://blog.jimmy.schementi.com/2009/06/ironruby-tutorial.html 2. DiskUse - A small WPF application which visualizes the disk usage for a particular directory. 3. IRPowerShell - a small library and sample applications showing how to interact with PowerShell from IronRuby. 4. Clock - a simple Silverlight sample 5. Photoviewer - do AJAX programming with IronRuby (ARAX =P) 6. REPL - Interactive console in the browser -- Some more interesting changes: - Improved DLR Interop: adds support for GetMember/SetMember with method_missing, Binary/Unary operators, and indexers. - Handling of CLR protected and private methods and properties - Reimplemented File.expand_path such that it does not use System.IO.Path. This allows us to get better compatibility with MRI. The motivating reason was that RSpec does File.expand_path("filename:linenumber") - Improves the implementation of singleton method dispatch. These changes improve running time of specs significantly (2x) - Renames Method, UnboundMethod#overloads (plural) to Method, UnboundMethod#overload (singular). The old name is still available for now and throws an exception. - Implements adaptively compiled rules - Improves performance of Array#- from quadratic algorithm to linear. - Improves implementation of RubyArray == Bugs closed Here are all 37 bugs closed since the last release (2009-05-19). You can see more information about each one here: http://ironruby.codeplex.com/WorkItem/List.aspx 1521 Access is allowed to internal fields 1502 alias_method fails for :do 821 File.expand_path does not support a line number after filename 1509 Proc.to_s should include line number where the block was declared 1501 WinForms broken 1400 $? is not always Process::Status 1345 load_assembly() should work 1344 System.Action.new does not work 1306 Cannot call CLR constructor of builtin type 1184 public(:foo) does not work correctly for mixed-in methods 1085 Cannot call new on subtypes of builtin classes whose "new" method has optional arguments 1060 visibility of send :define_method 917 Passing a Ruby array to a .NET method that expects an IEnumerable derivative fails with GetEnumerator call 783 Assert in SetMethodBasesNoLock when calling #== on Ruby class inheriting from CLR class which overrides Equals 761 Wrong behavior when calling redefined methods on object instances 1470 Can't call the BigIntegerOverload of a method with a DefaultProtocol Attribute on the BigInteger attribute 1426 The located assembly's manifest definition does not match the assembly reference. (ctp dev10 beta1) 1441 Error with cyrillyc text in Sharepoint 1352 Test Defects 814 Allocator underfined for (TypeError) 572 Error when running Cucumber examples with IronRuby 718 IronRuby ignores RUBYLIB environment variable 727 to_proc not working 1351 redist-libs should have rubygems-1.3.1 466 ''.split(//, -1) returns [""] instead of [] 940 Can't inherit from abstract classes 1028 Missing conversion from Duration to Fixnum (ActiveSupport)? 374 irails Foo: undefined method for OpenSLL::Random.random_bytes 459 throw FileNotFoundException => rescue Errno.NoEntryError 499 Pathname#cleanpath messes up the pathname 467 "igem install rails" fails 375 "ir script\server" causes a YAML parser error 461 Generic type conversion from Fixnum to Integer 674 autoload does not use File::SEPARATOR 1021 Time class instance 578 yield fails in eval'd code 605 Array#hash should properly handle recursive arrays == Enjoy! Please test out IronRuby 0.6 and let us know if you have any issues. We hope you enjoy this release! -- The IronRuby team From lists at ruby-forum.com Mon Jul 6 12:28:19 2009 From: lists at ruby-forum.com (Mohammad Azam) Date: Mon, 6 Jul 2009 18:28:19 +0200 Subject: [Ironruby-core] How to Refer to the Classes in my Custom DLL Message-ID: <7257a0bb0c20c3edeadd50d6c610adef@ruby-forum.com> Hi, I have a class library in C# called "BusinessObjects" and I want to refer to that DLL using IronRuby. I typed: require 'BusinessObjects' true include BusinessObjects >>> include BusinessObjects C:\ironruby\ironruby\Merlin\Main\Languages\Ruby\Libraries.LCA_RESTRICTED\Builtin s\ModuleOps.cs:793:in `const_missing': uninitialized constant Object::BusinessOb jects (NameError) from :0 I want to refer to a Customer class inside the BusinessObjects library. -- Posted via http://www.ruby-forum.com/. From Jimmy.Schementi at microsoft.com Mon Jul 6 12:32:09 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Mon, 6 Jul 2009 16:32:09 +0000 Subject: [Ironruby-core] How to Refer to the Classes in my Custom DLL In-Reply-To: <7257a0bb0c20c3edeadd50d6c610adef@ruby-forum.com> References: <7257a0bb0c20c3edeadd50d6c610adef@ruby-forum.com> Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC18B0C5E7@tk5ex14mbxc106.redmond.corp.microsoft.com> "include" only works for .NET namespaces, as they map to Ruby modules, not Ruby classes. You can't "include" a Ruby class. Does this class library have a namespace? If so, you can either use the fullname or include the namespace. require 'BusinessObjects' NameOfNamespace::BusinessObjects # => NameOfNamespace::BusinessObjects # or include NameOfNamespace BusinessObjects # => BusinessObjects > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > bounces at rubyforge.org] On Behalf Of Mohammad Azam > Sent: Monday, July 06, 2009 9:28 AM > To: ironruby-core at rubyforge.org > Subject: [Ironruby-core] How to Refer to the Classes in my Custom DLL > > Hi, > > I have a class library in C# called "BusinessObjects" and I want to refer to that > DLL using IronRuby. > > I typed: > > require 'BusinessObjects' > true > > include BusinessObjects > > > >>> include BusinessObjects > C:\ironruby\ironruby\Merlin\Main\Languages\Ruby\Libraries.LCA_RESTRICT > ED\Builtin > s\ModuleOps.cs:793:in `const_missing': uninitialized constant > Object::BusinessOb jects (NameError) > from :0 > > I want to refer to a Customer class inside the BusinessObjects library. > -- > 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 Mon Jul 6 12:33:58 2009 From: lists at ruby-forum.com (Kevin Radcliffe) Date: Mon, 6 Jul 2009 18:33:58 +0200 Subject: [Ironruby-core] How to Refer to the Classes in my Custom DLL In-Reply-To: <7257a0bb0c20c3edeadd50d6c610adef@ruby-forum.com> References: <7257a0bb0c20c3edeadd50d6c610adef@ruby-forum.com> Message-ID: Mohammad Azam wrote: > Hi, > > I have a class library in C# called "BusinessObjects" and I want to > refer to that DLL using IronRuby. > > I typed: > > require 'BusinessObjects' > true > > include BusinessObjects > > >>>> include BusinessObjects > C:\ironruby\ironruby\Merlin\Main\Languages\Ruby\Libraries.LCA_RESTRICTED\Builtin > s\ModuleOps.cs:793:in `const_missing': uninitialized constant > Object::BusinessOb > jects (NameError) > from :0 > > I want to refer to a Customer class inside the BusinessObjects library. Is BusinessObjects the top-level namespace here? Usually, you might have some namespace a level above that, like Azam::BusinessObjects Could you attach a zip with the compiled BusinessObjects.dll? Thanks -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Jul 6 12:47:14 2009 From: lists at ruby-forum.com (Mohammad Azam) Date: Mon, 6 Jul 2009 18:47:14 +0200 Subject: [Ironruby-core] No tests were specified Message-ID: <5256ee6209abcfa02a9d196e8ca0887b@ruby-forum.com> not sure why I am getting the following error when running the tests: C:\Projects\FirstLookAtIronRuby\FirstLookAtIronRuby\TestSuite>ir test_customer.r b Loaded suite test_customer Started F Finished in 0.3125 seconds. 1) Failure: default_test(Test_Customer) [c:/ironruby/ironruby/Merlin/Main/Languages/Ruby/libs/test/unit/testcase.rb: 110:in `default_test' c:/ironruby/ironruby/Merlin/Main/Languages/Ruby/libs/test/unit/testcase.rb: 79:in `run' C:\ironruby\ironruby\Merlin\Main\Languages\Ruby\Libraries.LCA_RESTRICTED\Bu iltins\KernelOps.cs:1313:in `send' C:\ironruby\ironruby\Merlin\Main\Languages\Ruby\Libraries.LCA_RESTRICTED\Ex tensions\IListOps.cs:757:in `each' C:\ironruby\ironruby\Merlin\Main\Languages\Ruby\Libraries.LCA_RESTRICTED\Ex tensions\IListOps.cs:757:in `each' testrunner.rb:66:in `start_mediator']: No tests were specified. 1 tests, 1 assertions, 1 failures, 0 errors Here is my test file: require 'test/unit' class Test_Customer < Test::Unit::TestCase def foo assert_equal(1,1) end end -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Jul 6 12:56:49 2009 From: lists at ruby-forum.com (Kevin Radcliffe) Date: Mon, 6 Jul 2009 18:56:49 +0200 Subject: [Ironruby-core] No tests were specified In-Reply-To: <5256ee6209abcfa02a9d196e8ca0887b@ruby-forum.com> References: <5256ee6209abcfa02a9d196e8ca0887b@ruby-forum.com> Message-ID: Mohammad Azam wrote: > not sure why I am getting the following error when running the tests: ..error.. > No tests were specified. > > 1 tests, 1 assertions, 1 failures, 0 errors > > > Here is my test file: > > require 'test/unit' > > class Test_Customer < Test::Unit::TestCase > > def foo > > assert_equal(1,1) > > end > > end I believe test methods need to start with test_ Try renaming "foo" to "test_foo" -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Jul 6 12:58:51 2009 From: lists at ruby-forum.com (Mohammad Azam) Date: Mon, 6 Jul 2009 18:58:51 +0200 Subject: [Ironruby-core] No tests were specified In-Reply-To: References: <5256ee6209abcfa02a9d196e8ca0887b@ruby-forum.com> Message-ID: <9b54ba195c32dddbbf7e2bd30bd79deb@ruby-forum.com> Thanks that did the trick! -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Jul 6 13:41:58 2009 From: lists at ruby-forum.com (Mohammad Azam) Date: Mon, 6 Jul 2009 19:41:58 +0200 Subject: [Ironruby-core] Spec and Cucumber Message-ID: <148ff00de3c8c88f895228e6bd1365c0@ruby-forum.com> Hi, How can I download and use spec and cucumber? -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Jul 6 14:00:01 2009 From: lists at ruby-forum.com (Kevin Radcliffe) Date: Mon, 6 Jul 2009 20:00:01 +0200 Subject: [Ironruby-core] Spec and Cucumber In-Reply-To: <148ff00de3c8c88f895228e6bd1365c0@ruby-forum.com> References: <148ff00de3c8c88f895228e6bd1365c0@ruby-forum.com> Message-ID: Mohammad Azam wrote: > Hi, > > How can I download and use spec and cucumber? Not sure if this is up to date, but probably something like this: http://wiki.github.com/aslakhellesoy/cucumber/ironruby-and-net It suggests using gem install cucumber rspec But that might be old info, maybe igem install cucumber rspec would be better... Some more info on Jimmy's blog here (usage here vs. install though I think): http://blog.jimmy.schementi.com/2009/07/ironruby-06-released.html#ir06cucumber -- Posted via http://www.ruby-forum.com/. From justin.hartman at gmail.com Mon Jul 6 14:16:20 2009 From: justin.hartman at gmail.com (Justin Hartman) Date: Mon, 6 Jul 2009 14:16:20 -0400 Subject: [Ironruby-core] Spec and Cucumber In-Reply-To: References: <148ff00de3c8c88f895228e6bd1365c0@ruby-forum.com> Message-ID: I just tried this with the 0.6 release, and I still saw the issue reported here: http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=1095 I was able to work about it by copying the implementation of the 'bin_path' method from: PATH_TO_MRI\lib\ruby\site_ruby\1.8\rubygems.rb to: PATH_TO_IRONRUBY\lib\ruby\site_ruby\1.8\rubygems.rb That let me run the examples plus my own test feature file. Did I do something wrong, or is the above still an issue? Thanks, -Justin -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Mon Jul 6 14:26:19 2009 From: lists at ruby-forum.com (Mohammad Azam) Date: Mon, 6 Jul 2009 20:26:19 +0200 Subject: [Ironruby-core] Spec and Cucumber In-Reply-To: References: <148ff00de3c8c88f895228e6bd1365c0@ruby-forum.com> Message-ID: <83083a2b1bfb89b4a4589b18e37b6a8d@ruby-forum.com> Thanks I am currently using 0.5 version and the latest is 0.6. Is there any command line option to upgrade 0.5 to 0.6? -- Posted via http://www.ruby-forum.com/. From Jimmy.Schementi at microsoft.com Mon Jul 6 15:12:48 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Mon, 6 Jul 2009 19:12:48 +0000 Subject: [Ironruby-core] Spec and Cucumber In-Reply-To: <83083a2b1bfb89b4a4589b18e37b6a8d@ruby-forum.com> References: <148ff00de3c8c88f895228e6bd1365c0@ruby-forum.com> , <83083a2b1bfb89b4a4589b18e37b6a8d@ruby-forum.com> Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC18B0C96C@tk5ex14mbxc106.redmond.corp.microsoft.com> Mohammad, You must download the new IronRuby assemblies and run your applications/tests with the new version: http://ironruby.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=29640#DownloadId=73806 There is no way to auto-update major version of IronRuby; an artifact of the unfortunate state of package management on Windows (ie. there is none). Wish we had something like apt-get or port for Windows. Anyone know of one? My suggestion would be to check out the source code from Git and build it yourself. Then you can just pull each version, rebuild, and you've been auto-updated =P ~Jimmy ________________________________________ From: ironruby-core-bounces at rubyforge.org [ironruby-core-bounces at rubyforge.org] on behalf of Mohammad Azam [lists at ruby-forum.com] Sent: Monday, July 06, 2009 11:26 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Spec and Cucumber Thanks I am currently using 0.5 version and the latest is 0.6. Is there any command line option to upgrade 0.5 to 0.6? -- 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 Mon Jul 6 15:30:05 2009 From: lists at ruby-forum.com (Mohammad Azam) Date: Mon, 6 Jul 2009 21:30:05 +0200 Subject: [Ironruby-core] IronRuby 0.6 and Downloading RSpec Through Gem Message-ID: <6154826a51a8fae5514d40a78c677b87@ruby-forum.com> I am trying to download RSpec but I keep getting the following error: >>> gem install rspec unknown: parenthesize argument(s) for future version (Microsoft::Scripting::Synt axErrorException) >>> igem install rspec unknown: parenthesize argument(s) for future version (Microsoft::Scripting::Synt axErrorException) I am using IronRuby 0.6 Thanks, -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Jul 6 15:36:10 2009 From: lists at ruby-forum.com (Kevin Radcliffe) Date: Mon, 6 Jul 2009 21:36:10 +0200 Subject: [Ironruby-core] IronRuby 0.6 and Downloading RSpec Through Gem In-Reply-To: <6154826a51a8fae5514d40a78c677b87@ruby-forum.com> References: <6154826a51a8fae5514d40a78c677b87@ruby-forum.com> Message-ID: <220cbb3aae8121013618ee2c9cd71558@ruby-forum.com> Mohammad Azam wrote: > I am trying to download RSpec but I keep getting the following error: > > >>>> gem install rspec > unknown: parenthesize argument(s) for future version > (Microsoft::Scripting::Synt > axErrorException) > >>>> igem install rspec > unknown: parenthesize argument(s) for future version > (Microsoft::Scripting::Synt > axErrorException) > > I am using IronRuby 0.6 > > Thanks, Are you doing this from within ir.exe? gem/igem should be run directly from the command line and not from within ir.exe. Just want to see where you're coming from executing this -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Jul 6 15:38:26 2009 From: lists at ruby-forum.com (Mohammad Azam) Date: Mon, 6 Jul 2009 21:38:26 +0200 Subject: [Ironruby-core] IronRuby 0.6 and Downloading RSpec Through Gem In-Reply-To: <220cbb3aae8121013618ee2c9cd71558@ruby-forum.com> References: <6154826a51a8fae5514d40a78c677b87@ruby-forum.com> <220cbb3aae8121013618ee2c9cd71558@ruby-forum.com> Message-ID: <772f7657432e704c2f3d7a475e679f79@ruby-forum.com> Thanks! I got it working! Currently downloading rspec! -- Posted via http://www.ruby-forum.com/. From Jimmy.Schementi at microsoft.com Mon Jul 6 15:38:34 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Mon, 6 Jul 2009 19:38:34 +0000 Subject: [Ironruby-core] IronRuby 0.6 and Downloading RSpec Through Gem In-Reply-To: <6154826a51a8fae5514d40a78c677b87@ruby-forum.com> References: <6154826a51a8fae5514d40a78c677b87@ruby-forum.com> Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC18B0CA54@tk5ex14mbxc106.redmond.corp.microsoft.com> Installing works (pass --no-rdoc --no-ri if you want it to skip those and go much faster). Also make sure GEM_PATH and GEM_HOME aren't set so gems are used/installed from lib\IronRuby\gems. Here's my session: C:\Users\jimmysch\dev\releases\ironruby-0.6.0\bin>igem install rspec ************************************************** Thank you for installing rspec-1.2.7 Please be sure to read History.rdoc and Upgrade.rdoc for useful information about this release. ************************************************** Successfully installed rspec-1.2.7 1 gem installed Installing ri documentation for rspec-1.2.7... Installing RDoc documentation for rspec-1.2.7... Could not find main page README.rdoc Could not find main page README.rdoc Could not find main page README.rdoc Could not find main page README.rdoc C:\Users\jimmysch\Documents\Downloads\ironruby-0.6.0\bin>echo %GEM_PATH% %GEM_PATH% C:\Users\jimmysch\Documents\Downloads\ironruby-0.6.0\bin>echo %GEM_HOME% %GEM_HOME% C:\Users\jimmysch\Documents\Downloads\ironruby-0.6.0\bin>cd ..\lib\IronRuby\gems\1.8\gems C:\Users\jimmysch\Documents\Downloads\ironruby-0.6.0\lib\IronRuby\gems\1.8\gems>dir Volume in drive C has no label. Volume Serial Number is EC3A-62D3 Directory of C:\Users\jimmysch\Documents\Downloads\ironruby-0.6.0\lib\IronRuby\gems\1.8\gems 07/06/2009 12:33 PM . 07/06/2009 12:33 PM .. 07/06/2009 12:33 PM rspec-1.2.7 0 File(s) 0 bytes 3 Dir(s) 72,197,648,384 bytes free C:\Users\jimmysch\Documents\Downloads\ironruby-0.6.0\lib\IronRuby\gems\1.8\gems> ________________________________________ From: ironruby-core-bounces at rubyforge.org [ironruby-core-bounces at rubyforge.org] on behalf of Mohammad Azam [lists at ruby-forum.com] Sent: Monday, July 06, 2009 12:30 PM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] IronRuby 0.6 and Downloading RSpec Through Gem I am trying to download RSpec but I keep getting the following error: >>> gem install rspec unknown: parenthesize argument(s) for future version (Microsoft::Scripting::Synt axErrorException) >>> igem install rspec unknown: parenthesize argument(s) for future version (Microsoft::Scripting::Synt axErrorException) I am using IronRuby 0.6 Thanks, -- 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 Mon Jul 6 15:45:52 2009 From: lists at ruby-forum.com (Kevin Radcliffe) Date: Mon, 6 Jul 2009 21:45:52 +0200 Subject: [Ironruby-core] IronRuby 0.6 and Downloading RSpec Through Gem In-Reply-To: <772f7657432e704c2f3d7a475e679f79@ruby-forum.com> References: <6154826a51a8fae5514d40a78c677b87@ruby-forum.com> <220cbb3aae8121013618ee2c9cd71558@ruby-forum.com> <772f7657432e704c2f3d7a475e679f79@ruby-forum.com> Message-ID: <5ef728ba47faabc16dd30d72874614db@ruby-forum.com> Mohammad Azam wrote: > Thanks! I got it working! Currently downloading rspec! Great! By the way, if rspec ends up being too heavyweight for what you are doing, you could also try bacon: (Installs through igem the same way rspec did) http://github.com/chneukirchen/bacon/tree/master I found it through Jimmy's blog here: http://blog.jimmy.schementi.com/2009/03/testing-c-silverlight-apps-with.html -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Jul 6 16:23:43 2009 From: lists at ruby-forum.com (Mohammad Azam) Date: Mon, 6 Jul 2009 22:23:43 +0200 Subject: [Ironruby-core] Formatting the test result in Spec Message-ID: <0323d44e418448e74af63a063c3dee4d@ruby-forum.com> I got the Spec working in IronRuby! Thanks everyone. How can I get a detailed report (command line) when running the test? Currently, I only get the following: C:\Projects\FirstLookAtIronRuby\FirstLookAtIronRuby\TestSuite>ir test_prime.rb Loaded suite test_prime Started Finished in 0.015625 seconds. 0 tests, 0 assertions, 0 failures, 0 errors Also, for some reason it says "0 tests" here is my test_prime.rb file: require 'test/unit' require 'rubygems' require 'spec' require File.dirname(__FILE__) + '/bin/Debug/BusinessObjects.dll' include BusinessObjects include Test::Unit describe PrimeService,"when 1 is passed to the prime service" do it "should return true" do primeService = PrimeService.new primeService.IsPrime(1) end end -- Posted via http://www.ruby-forum.com/. From Jimmy.Schementi at microsoft.com Mon Jul 6 16:25:32 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Mon, 6 Jul 2009 20:25:32 +0000 Subject: [Ironruby-core] Formatting the test result in Spec In-Reply-To: <0323d44e418448e74af63a063c3dee4d@ruby-forum.com> References: <0323d44e418448e74af63a063c3dee4d@ruby-forum.com> Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC18B0CB7D@tk5ex14mbxc106.redmond.corp.microsoft.com> See the test-spec documentation: http://test-spec.rubyforge.org/test-spec Reading about test-unit would be useful too: http://www.ruby-doc.org/stdlib/libdoc/test/unit/rdoc/ ________________________________________ From: ironruby-core-bounces at rubyforge.org [ironruby-core-bounces at rubyforge.org] on behalf of Mohammad Azam [lists at ruby-forum.com] Sent: Monday, July 06, 2009 1:23 PM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] Formatting the test result in Spec I got the Spec working in IronRuby! Thanks everyone. How can I get a detailed report (command line) when running the test? Currently, I only get the following: C:\Projects\FirstLookAtIronRuby\FirstLookAtIronRuby\TestSuite>ir test_prime.rb Loaded suite test_prime Started Finished in 0.015625 seconds. 0 tests, 0 assertions, 0 failures, 0 errors Also, for some reason it says "0 tests" here is my test_prime.rb file: require 'test/unit' require 'rubygems' require 'spec' require File.dirname(__FILE__) + '/bin/Debug/BusinessObjects.dll' include BusinessObjects include Test::Unit describe PrimeService,"when 1 is passed to the prime service" do it "should return true" do primeService = PrimeService.new primeService.IsPrime(1) end end -- 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 Mon Jul 6 16:32:14 2009 From: lists at ruby-forum.com (Mohammad Azam) Date: Mon, 6 Jul 2009 22:32:14 +0200 Subject: [Ironruby-core] Formatting the test result in Spec In-Reply-To: <0323d44e418448e74af63a063c3dee4d@ruby-forum.com> References: <0323d44e418448e74af63a063c3dee4d@ruby-forum.com> Message-ID: <09adee7ba6c813ede397a0558f172440@ruby-forum.com> I changed the code to this but still not picking up the test: describe PrimeService,"when 1 is passed to the prime service" do it "should return true" do primeService = PrimeService.new primeService.IsPrime(1).should == true end Mohammad Azam wrote: > I got the Spec working in IronRuby! Thanks everyone. > > How can I get a detailed report (command line) when running the test? > > Currently, I only get the following: > > > C:\Projects\FirstLookAtIronRuby\FirstLookAtIronRuby\TestSuite>ir > test_prime.rb > Loaded suite test_prime > Started > > Finished in 0.015625 seconds. > > 0 tests, 0 assertions, 0 failures, 0 errors > > Also, for some reason it says "0 tests" here is my test_prime.rb file: > > require 'test/unit' > require 'rubygems' > require 'spec' > > require File.dirname(__FILE__) + '/bin/Debug/BusinessObjects.dll' > > include BusinessObjects > include Test::Unit > > describe PrimeService,"when 1 is passed to the prime service" do > > it "should return true" do > > primeService = PrimeService.new > primeService.IsPrime(1) > > end > > end -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Jul 6 16:52:23 2009 From: lists at ruby-forum.com (Mohammad Azam) Date: Mon, 6 Jul 2009 22:52:23 +0200 Subject: [Ironruby-core] Formatting the test result in Spec In-Reply-To: <09adee7ba6c813ede397a0558f172440@ruby-forum.com> References: <0323d44e418448e74af63a063c3dee4d@ruby-forum.com> <09adee7ba6c813ede397a0558f172440@ruby-forum.com> Message-ID: <4c889879f350dcf6ae9f12ed3ad8b00f@ruby-forum.com> I had to configure the path for spec.bat using environment variables. Now, I can run the specifications using the following: spec test_prime.rb but I still need to format is nicely. --format nested does not work it complains that invalid --format parameter! -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Jul 6 17:01:18 2009 From: lists at ruby-forum.com (Kevin Radcliffe) Date: Mon, 6 Jul 2009 23:01:18 +0200 Subject: [Ironruby-core] Formatting the test result in Spec In-Reply-To: <4c889879f350dcf6ae9f12ed3ad8b00f@ruby-forum.com> References: <0323d44e418448e74af63a063c3dee4d@ruby-forum.com> <09adee7ba6c813ede397a0558f172440@ruby-forum.com> <4c889879f350dcf6ae9f12ed3ad8b00f@ruby-forum.com> Message-ID: Mohammad Azam wrote: > I had to configure the path for spec.bat using environment variables. > > Now, I can run the specifications using the following: > > spec test_prime.rb > > but I still need to format is nicely. --format nested does not work it > complains that invalid --format parameter! Have you removed the test/unit require so that the test/unit runner data isn't coming back? I think that was a red herring earlier in your post. Here's the command I ran (full path to make sure I was running the right spec.bat): C:\OSS\ironruby\Merlin\Main\Bin\debug\spec.bat test.rb --format specdoc I got back the following output (from a script similar to yours): Some Simple assert - should show that 1 is equal to 1 Finished in 0.2343855 seconds 1 example, 0 failures -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Jul 6 17:03:16 2009 From: lists at ruby-forum.com (Mohammad Azam) Date: Mon, 6 Jul 2009 23:03:16 +0200 Subject: [Ironruby-core] Formatting the test result in Spec In-Reply-To: References: <0323d44e418448e74af63a063c3dee4d@ruby-forum.com> <09adee7ba6c813ede397a0558f172440@ruby-forum.com> <4c889879f350dcf6ae9f12ed3ad8b00f@ruby-forum.com> Message-ID: You are right! require test/unit was the problem. I removed it and it worked smoothly! Thanks, Azam -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Jul 6 17:10:49 2009 From: lists at ruby-forum.com (Mohammad Azam) Date: Mon, 6 Jul 2009 23:10:49 +0200 Subject: [Ironruby-core] Formatting the test result in Spec In-Reply-To: References: <0323d44e418448e74af63a063c3dee4d@ruby-forum.com> <09adee7ba6c813ede397a0558f172440@ruby-forum.com> <4c889879f350dcf6ae9f12ed3ad8b00f@ruby-forum.com> Message-ID: <1301da704fc7e0be9b708757b760ed87@ruby-forum.com> One other thing I noticed is that I have already installed win32console gem on my machine but for some reason whenever I use the color option it gives me the following output: C:\Projects\FirstLookAtIronRuby\FirstLookAtIronRuby\TestSuite>spec test_prime.rb --format specdoc --colour You must 'gem install win32console' to use colour on Windows BusinessObjects::PrimeService when foo method is called - should return true Finished in 0.265625 seconds 1 example, 0 failures Thanks, Azam -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Jul 6 22:11:06 2009 From: lists at ruby-forum.com (Mohammad Azam) Date: Tue, 7 Jul 2009 04:11:06 +0200 Subject: [Ironruby-core] RSpec Test Format Message-ID: <9752a502e8b92eed2fdecd9383e99316@ruby-forum.com> I have done BDD in C# and my question is that how Spec in IronRuby makes it easier. Here is what my test looks like: require 'rubygems' require 'spec' require File.dirname(__FILE__) + '/bin/Debug/BusinessObjects.dll' include BusinessObjects primeService = PrimeService.new describe PrimeService,"when 1 is passed" do it "should return true" do primeService.IsPrime(1).should == true end end describe PrimeService, "when 2 is passed" do it "should return true" do primeService.IsPrime(2).should == true end end describe PrimeService, "when a number less then zero is passed" do it "should throw an error for invalid input exception" do lambda {primeService.IsPrime(-1)}.should raise_error end end describe PrimeService, "when a prime number is passed" do it "should return a true value" do prime_numbers = [3,23,5,7,11,13,19,17,29] prime_numbers.each{|x| primeService.IsPrime(x).should == true} end end Is this the normal way of writing unit test BDD style using Spec and IronRuby or am I missing something? -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Jul 6 22:38:07 2009 From: lists at ruby-forum.com (Andrea o. k. Wright) Date: Tue, 7 Jul 2009 04:38:07 +0200 Subject: [Ironruby-core] Viewing Abstract Syntax Trees Message-ID: <2df800ce5d7474ec13ea13760d11e261@ruby-forum.com> How can I view the AST that corresponds with a ruby file? I have read about -X:ShowASTs and -X:DumpASTs, but they don't seem to be valid command line switches for IronRuby 0.6. Thank you very much, AOK -- Posted via http://www.ruby-forum.com/. From Tomas.Matousek at microsoft.com Tue Jul 7 00:38:52 2009 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Mon, 6 Jul 2009 21:38:52 -0700 Subject: [Ironruby-core] Viewing Abstract Syntax Trees In-Reply-To: <2df800ce5d7474ec13ea13760d11e261@ruby-forum.com> References: <2df800ce5d7474ec13ea13760d11e261@ruby-forum.com> Message-ID: There is currently no support for displaying ASTs. You can add some code that dumps them in RubyScriptCode::CompileLambda if you need it. Note that DLR ASTs are created lazily as methods execute. Ruby ASTs are built as files are parsed. Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Andrea o. k. Wright Sent: Monday, July 06, 2009 7:38 PM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] Viewing Abstract Syntax Trees How can I view the AST that corresponds with a ruby file? I have read about -X:ShowASTs and -X:DumpASTs, but they don't seem to be valid command line switches for IronRuby 0.6. Thank you very much, AOK -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From jdeville at microsoft.com Tue Jul 7 02:52:42 2009 From: jdeville at microsoft.com (Jim Deville) Date: Tue, 7 Jul 2009 06:52:42 +0000 Subject: [Ironruby-core] RSpec Test Format In-Reply-To: <9752a502e8b92eed2fdecd9383e99316@ruby-forum.com> References: <9752a502e8b92eed2fdecd9383e99316@ruby-forum.com> Message-ID: I would write it as follows: ###FILE spec_helper.rb#### require 'rubygems' require 'spec' def be_prime_for(expected) simple_matcher("a prime number") {|given| given.is_prime(expected)} end ####spec file### require 'path/to/spec_helper' require File.dirname(__FILE__) + '/bin/Debug/BusinessObjects.dll' include BusinessObjects describe PrimeService do before(:each) do @prime_service = PrimeService.new end it "should be prime for 1" do @prime_service.should be_prime_for 1 end it "should be prime for 2" do @prime_service.should be_prime_for 2 end it "should raise an error for invalid input" do lambda {@prime_service.is_prime(-1)}.should raise_error end it "should be 'true' for prime numbers" do [3,23,5,7,11,13,19].each {|x| @prime_service.should be_prime_for x} end it "should be 'false' for non-prime numbers" do [4,6,9,12,21].each {|x| @prime_service.should_not be_prime_for x} end end Notable points: a) 2 files, you can add more matchers and other common setup to spec_helper.rb and require it in other spec files. b) use before(:each) for test setup. It ensures isolation c) no need for multiple contexts in this case. d) custom matchers increase the readability Hope that helps. JD ...there is no try > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > bounces at rubyforge.org] On Behalf Of Mohammad Azam > Sent: Monday, July 06, 2009 7:11 PM > To: ironruby-core at rubyforge.org > Subject: [Ironruby-core] RSpec Test Format > > I have done BDD in C# and my question is that how Spec in IronRuby makes it > easier. Here is what my test looks like: > > require 'rubygems' > require 'spec' > > require File.dirname(__FILE__) + '/bin/Debug/BusinessObjects.dll' > > include BusinessObjects > > primeService = PrimeService.new > > describe PrimeService,"when 1 is passed" do > > it "should return true" do > > primeService.IsPrime(1).should == true > > end > > end > > describe PrimeService, "when 2 is passed" do > > it "should return true" do > > primeService.IsPrime(2).should == true > > end > > end > > describe PrimeService, "when a number less then zero is passed" do > > it "should throw an error for invalid input exception" do > > lambda {primeService.IsPrime(-1)}.should raise_error > > end > > end > > describe PrimeService, "when a prime number is passed" do > > it "should return a true value" do > > prime_numbers = [3,23,5,7,11,13,19,17,29] > > prime_numbers.each{|x| primeService.IsPrime(x).should == true} > > end > > end > > > Is this the normal way of writing unit test BDD style using Spec and IronRuby > or am I missing something? > -- > 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 Tue Jul 7 14:27:15 2009 From: lists at ruby-forum.com (Mohammad Azam) Date: Tue, 7 Jul 2009 20:27:15 +0200 Subject: [Ironruby-core] assert_throws Problem Message-ID: <825ae28e7c854e9d48abd9fa226ffcc3@ruby-forum.com> Hi, I want to say that whatever exception is thrown just pass the test. class When_a_negative_number_is_passed_to_the_prime_service < TestCase def test_should_throw_an_exception primeService = PrimeService.new primeService.IsPrime(-2) assert_throws System::Exception end end The exception thrown from the C# side is ArgumentException -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Tue Jul 7 14:44:27 2009 From: lists at ruby-forum.com (Kevin Radcliffe) Date: Tue, 7 Jul 2009 20:44:27 +0200 Subject: [Ironruby-core] RSpec Test Format In-Reply-To: <9752a502e8b92eed2fdecd9383e99316@ruby-forum.com> References: <9752a502e8b92eed2fdecd9383e99316@ruby-forum.com> Message-ID: Mohammad Azam wrote: > I have done BDD in C# and my question is that how Spec in IronRuby makes > it easier. Here is what my test looks like: > > Is this the normal way of writing unit test BDD style using Spec and > IronRuby or am I missing something? I'm definitely no BDD expert, but I'll try to take a stab at it. Apologies if I put my foot in my mouth. People actually using BDD full-time, please chime in and/or shoot me down. Personally, I believe that some of this is just aesthetics, and some of it is actually aiming to make you think about making your libraries' intent as clear as possible. I think you can refactor as you go, and when the specifications read close to natural language, you've gotten somewhere. Re: Your specific question about what RSpec brings that C# can't achieve.. I think it's the same as most ruby vs. C# issues, ruby gets out of our way, where C# simply isn't able to. I'd say the closest you get (arguably) in C# is MSpec: http://codebetter.com/blogs/aaron.jensen/archive/2008/05/08/introducing-machine-specifications-or-mspec-for-short.aspx http://github.com/machine/machine.specifications/tree/master Where you have to work around what the C# compiler needs, you have to write things like: Because of = () => fromAccount.Transfer(1m, toAccount); Check here for a simple MSpec example: http://github.com/machine/machine.specifications/blob/0db4d72c93fdc4f5775d9b1eb6239b64a76ad562/Source/Machine.Specifications.Example/BankingSpecs.cs I'm not trying to knock MSpec at all, but if you look at what you've written above to achieve the same context/specification style, I think you might agree ruby does a better job getting out of your way to let you do what you intend. The C# compiler needs a lot more to be happy, so MSpec does its very best to get around that. There is a lot of good material around RSpec and Cucumber, and the art of writing specifications for it as well. -- Posted via http://www.ruby-forum.com/. From ivan at flanders.co.nz Tue Jul 7 14:44:08 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Tue, 7 Jul 2009 20:44:08 +0200 Subject: [Ironruby-core] assert_throws Problem In-Reply-To: <825ae28e7c854e9d48abd9fa226ffcc3@ruby-forum.com> References: <825ae28e7c854e9d48abd9fa226ffcc3@ruby-forum.com> Message-ID: you have to wrap that in a lambda lambda { PrimeService.new.is_prime -2 }.assert_throws System::Exception you can't assert code that has already been executed. Basically anything that asserts exceptions needs to be able to execute the code later because, and this is true for any language, in the end the code looks a little like this class Proc def assert_throws( expected_exception) begin self.call rescue expected_exception return true end return false end end --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Tue, Jul 7, 2009 at 8:27 PM, Mohammad Azam wrote: > Hi, > > I want to say that whatever exception is thrown just pass the test. > > class When_a_negative_number_is_passed_to_the_prime_service < TestCase > > def test_should_throw_an_exception > > primeService = PrimeService.new > primeService.IsPrime(-2) > assert_throws System::Exception > > end > > end > > The exception thrown from the C# side is ArgumentException > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Tue Jul 7 14:48:14 2009 From: lists at ruby-forum.com (Mohammad Azam) Date: Tue, 7 Jul 2009 20:48:14 +0200 Subject: [Ironruby-core] RSpec Test Format In-Reply-To: References: <9752a502e8b92eed2fdecd9383e99316@ruby-forum.com> Message-ID: <73c4cf7fa082729687b35881e01a8c74@ruby-forum.com> Thanks Kevin for the detailed answer. I agree that Spec makes easier to perform BDD style testing. Although I have never used MSpec for C#. I usually write my C# BDD style test manually without any tools. Like the following: public class when_1_is_passed_to_the_prime_service { public void should_make_sure_true_is_returned() { } } Thanks for the input! -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Tue Jul 7 18:00:25 2009 From: lists at ruby-forum.com (Mohammad Azam) Date: Wed, 8 Jul 2009 00:00:25 +0200 Subject: [Ironruby-core] Spec and calling other examples Message-ID: Hi, When performing BDD there are few occasions when a certain example (BDD test) depends on other context/example. Here is one example: describe Person do before do @person = Person.new @person.Age = 19 end it "should be able to vote" do @person.CanVote().should == true end describe "19 years old" do it "should be able to vote" # does not work end end The context of "19 years old" fails since it requires to put the "voting" context as a shared example which I don't want to do. If we can just call other contexts within the parent context then it would be great. I think it would be great if the above example just works. -- Posted via http://www.ruby-forum.com/. From Jimmy.Schementi at microsoft.com Tue Jul 7 18:32:49 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Tue, 7 Jul 2009 22:32:49 +0000 Subject: [Ironruby-core] Spec and calling other examples In-Reply-To: References: Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC18B0E161@tk5ex14mbxc106.redmond.corp.microsoft.com> Which library is this? Some support what you're asking for, some don't. I think bacon supports it ... test-spec doesn't. Not sure about rspec. If you're are that concerned about it, please post this message to the cooresponding project's mailing list ... this isn't part of IronRuby, it's just a Ruby library. ________________________________________ From: ironruby-core-bounces at rubyforge.org [ironruby-core-bounces at rubyforge.org] on behalf of Mohammad Azam [lists at ruby-forum.com] Sent: Tuesday, July 07, 2009 3:00 PM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] Spec and calling other examples Hi, When performing BDD there are few occasions when a certain example (BDD test) depends on other context/example. Here is one example: describe Person do before do @person = Person.new @person.Age = 19 end it "should be able to vote" do @person.CanVote().should == true end describe "19 years old" do it "should be able to vote" # does not work end end The context of "19 years old" fails since it requires to put the "voting" context as a shared example which I don't want to do. If we can just call other contexts within the parent context then it would be great. I think it would be great if the above example just works. -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From ivan at flanders.co.nz Wed Jul 8 06:44:14 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Wed, 8 Jul 2009 12:44:14 +0200 Subject: [Ironruby-core] IR 0.6.0 error loading a c# class In-Reply-To: <772AA8D6-2015-49FF-B656-0756DBAEED0B@gmail.com> References: <772AA8D6-2015-49FF-B656-0756DBAEED0B@gmail.com> Message-ID: Could you share the code that is in the assemblies? or at least show the namespaces etc? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Wed, Jul 8, 2009 at 6:44 AM, Mario A Chavez wrote: > Hi; > I have a custom C# Assembly1 which have interface ISomething and a C# > Assembly2 which have class Something, and this class implements the > interface like: > > public class Something : ISomething { } > > Using iirb I try to create an instace of that class but it complains about > the class not being defined, I do use iirb as follow: > > requiere 'mscorlib' > requiere 'System' > > require File.dirname(__FILE__) + '/build/assembly1.dll' > require File.dirname(__FILE__) + '/build/assembly2.dll' > > include Assembly1 > include Assembly2 > > @s = Something.new > <-- Here it fails telling me that the class is not defined, but if I remove > the code that implements the interface, it just works fine. My guess is that > somehow is not resolving the interface, but I'm not sure how can I fix this. > > Thanks > > Mario Alberto Ch?vez > mario.chavez at gmail.com > http://mario-chavez.blogspot.com/ > > > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Wed Jul 8 21:56:29 2009 From: lists at ruby-forum.com (Kevin Radcliffe) Date: Thu, 9 Jul 2009 03:56:29 +0200 Subject: [Ironruby-core] Spec and calling other examples In-Reply-To: References: Message-ID: <2e4ee556757f99ef901b89b58098edfd@ruby-forum.com> Mohammad Azam wrote: > > The context of "19 years old" fails since it requires to put the > "voting" context as a shared example which I don't want to do. If we can > just call other contexts within the parent context then it would be > great. I think it would be great if the above example just works. I'm not quite sure what you're expecting in this case. I can understand if you are expecting the parent context to be passed down to the child, but the code: it "should be able to vote" # does not work Is only saying "here is a description about what I want to test... I'm getting ready to test something.... and ... nothing" I'd imagine based on a conversation we had that you "might" be expecting the implicit method calling/subject setup mentioned in the post here: http://blog.davidchelimsky.net/2009/01/13/rspec-1-1-12-is-released/ However, for that, you'd actually need the following syntax (which is probably using some magic shortcuts behind the scenes): it { should be_able_to_vote } You'd also need to add (perhaps monkey-patch if you're dealing with an existing C# dll) the method that RSpec will be looking for (namely: able_to_vote? ) Since you already have CanVote, you could actually just alias it like this: class Person alias_method :able_to_vote?, :CanVote end Let us/me know if this helps, and how far you get from here If you'd like to discuss further personally, please email or direct message me. Thanks -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Jul 9 01:05:06 2009 From: lists at ruby-forum.com (Aaron Clauson) Date: Thu, 9 Jul 2009 07:05:06 +0200 Subject: [Ironruby-core] Interrupt Execution Message-ID: Hi, I'm still searching for a way to halt or interrupt the execution of an IronRuby script. At the moment I do it by executing each script on a separate thread and call Thread.Abort but that is resulting in a memory and thread leak in my server application. As things have got busier on the server the leak has reduced the time the server can stay up from days to half a day or less. I came across the DLR hosting document on CodePlex http://dlr.codeplex.com/Wiki/View.aspx?title=Docs%20and%20specs and was wondering if there is anything in the IronRuby pipeline regarding "Interrupt Execution" (chapter 3.4 page 27 of the spec)? It's exactly what I'm after and also describes the exact issue I'm encountering with the rude thread aborts. I've quoted the relevant text below for interested parties. Other than that is it possible to execute an IronRuby script line by line? I have been able to execute individual expressions but as soon as I try something like a multi-line expression like a case statement I haven't been able to find a way. "Interrupt Execution: Language supports DLR mechanisms for host to abort execution cleanly so that host can interrupt runaway code. If we allow languages to avoid this work, then those langs cannot be used in the host's process, cannot support in-situ REPLs for interactive development, etc. If the language uses DLR compilation or interpretation, they should not need to do anything. This is important because if the host has to stop execution by calling Thread.Abort or other rude abort, the thread could have transitioned into an unsafe portion of the host's code. This could happen via the script code calling back on the host OM which in turn calls an internal API not coded for rude aborts." Thanks, Aaron Clauson -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Jul 9 12:03:20 2009 From: lists at ruby-forum.com (Mohammad Azam) Date: Thu, 9 Jul 2009 18:03:20 +0200 Subject: [Ironruby-core] win32console and color Message-ID: <5a36636c449b108f9501a02a1489c68c@ruby-forum.com> Hi, I am trying to color my spec results when running specification unit tests. I am using the following: C:> spec test_prime.rb --format nested --color But it tells me to install gem "win32console". So, I installed the gem using: C:> igem install win32console But still it gives me the same message that I need to install win32console gem. -- Posted via http://www.ruby-forum.com/. From ivan at flanders.co.nz Thu Jul 9 12:07:15 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Thu, 9 Jul 2009 18:07:15 +0200 Subject: [Ironruby-core] win32console and color In-Reply-To: <5a36636c449b108f9501a02a1489c68c@ruby-forum.com> References: <5a36636c449b108f9501a02a1489c68c@ruby-forum.com> Message-ID: win32console needs to be implemented for .NET it uses some C stuff. I believe Nick Ricketts has done some work in that area so maybe he's listening and can point you in the right direction. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Thu, Jul 9, 2009 at 6:03 PM, Mohammad Azam wrote: > Hi, > > I am trying to color my spec results when running specification unit > tests. I am using the following: > > C:> spec test_prime.rb --format nested --color > > But it tells me to install gem "win32console". So, I installed the gem > using: > > C:> igem install win32console > > But still it gives me the same message that I need to install > win32console gem. > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan at flanders.co.nz Thu Jul 9 13:08:14 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Thu, 9 Jul 2009 19:08:14 +0200 Subject: [Ironruby-core] win32console and color In-Reply-To: <5a36636c449b108f9501a02a1489c68c@ruby-forum.com> References: <5a36636c449b108f9501a02a1489c68c@ruby-forum.com> Message-ID: This may help, I got the people mixed up it was Will Green who has been working on it: http://github.com/hotgazpacho/iron-term-ansicolor/ I guess you'd have to fork it and make it more stable if necessary. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Thu, Jul 9, 2009 at 6:03 PM, Mohammad Azam wrote: > Hi, > > I am trying to color my spec results when running specification unit > tests. I am using the following: > > C:> spec test_prime.rb --format nested --color > > But it tells me to install gem "win32console". So, I installed the gem > using: > > C:> igem install win32console > > But still it gives me the same message that I need to install > win32console gem. > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Thu Jul 9 19:44:26 2009 From: lists at ruby-forum.com (Aaron Clauson) Date: Fri, 10 Jul 2009 01:44:26 +0200 Subject: [Ironruby-core] Interrupt Execution In-Reply-To: References: Message-ID: <50ad0a39b148c91bfc9a7bf49bd27349@ruby-forum.com> After spending a few hours delving into the DLR source I suspect the "interrupt execution" implementation is more related to the DLR core than IronRuby so I've posted a question over there http://dlr.codeplex.com/Thread/View.aspx?ThreadId=62052. Regards, Aaron -- Posted via http://www.ruby-forum.com/. From CDurfee at tsys.com Fri Jul 10 11:54:07 2009 From: CDurfee at tsys.com (CDurfee at tsys.com) Date: Fri, 10 Jul 2009 09:54:07 -0600 Subject: [Ironruby-core] Use of case operator In-Reply-To: <02a101ca0174$b4d51ce0$1e7f56a0$@com> Message-ID: Agreed, only nil and false are false. In my scenario, I take the result of the Ruby function and feed it back to C#. Here's where it is nice to have either an instance of the TrueClass or FalseClass; otherwise, I need to teach my C# application the Ruby rules for converting an integer to a Boolean, or I need to convert the integer to a Boolean in Ruby. -- Chuck -- Chuck Durfee Sr. Internet Software Developer TSYS iSolutions, Golden Email cdurfee at tsys.com "Pete Bacon Darwin" Sent by: ironruby-core-bounces at rubyforge.org 07/10/2009 09:40 AM Please respond to ironruby-core at rubyforge.org To cc Subject Re: [Ironruby-core] Use of case operator That?s OK because in Ruby 0 is true! (Only nil and false are false) From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of CDurfee at tsys.com Sent: 10 July 2009 16:21 To: ironruby-core at rubyforge.org Cc: ironruby-core at rubyforge.org; ironruby-core-bounces at rubyforge.org Subject: Re: [Ironruby-core] Use of case operator Sorry, yes, I know about the =~ operator, but I believe that returns an integer (the position of the first match) or nil, not a Boolean as I require. -- Chuck -- Chuck Durfee Sr. Internet Software Developer TSYS iSolutions, Golden Email cdurfee at tsys.com Kibiz0r Sent by: ironruby-core-bounces at rubyforge.org 07/10/2009 09:07 AM Please respond to ironruby-core at rubyforge.org To ironruby-core at rubyforge.org cc Subject Re: [Ironruby-core] Use of case operator Chuck, Yes, there's an operator just for this scenario! The regular expression operator: =~ Mike On Fri, Jul 10, 2009 at 10:34 AM, wrote: I'm fairly new to Ruby, and I have a usage question. There are times when I want to know if a regular expression matches a given input. For example: class String def containsVowel? /[AEIOU]/i === self end end Is there a common Ruby idiom for this, or is using the case operator this way the norm? -- Chuck -- Chuck Durfee Sr. Internet Software Developer TSYS iSolutions, Golden Email cdurfee at tsys.com The information contained in this communication (including any attachments hereto) is confidential and is intended solely for the personal and confidential use of the individual or entity to whom it is addressed. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, copying, or unauthorized use of this information, or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. Thank you _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core -- Michael Harrington | Software Apprentice Atomic Object | http://atomicobject.com [Ph] +1 616 776 6020 [Fx] +1 616 776 6015 _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core The information contained in this communication (including any attachments hereto) is confidential and is intended solely for the personal and confidential use of the individual or entity to whom it is addressed. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, copying, or unauthorized use of this information, or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. Thank you Checked by AVG - www.avg.com Version: 8.5.375 / Virus Database: 270.13.5/2220 - Release Date: 07/09/09 18:07:00_______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core ----------------------------------------- The information contained in this communication (including any attachments hereto) is confidential and is intended solely for the personal and confidential use of the individual or entity to whom it is addressed. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, copying, or unauthorized use of this information, or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. Thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: From ryan.riley at panesofglass.org Fri Jul 10 12:00:48 2009 From: ryan.riley at panesofglass.org (Ryan Riley) Date: Fri, 10 Jul 2009 11:00:48 -0500 Subject: [Ironruby-core] Use of case operator In-Reply-To: References: <02a101ca0174$b4d51ce0$1e7f56a0$@com> Message-ID: Not sure, but this thread may shed some light: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/103216. You could get the result from the =~ operation, then transform using the .to_bool extension suggested above. Ryan Riley ryan.riley at panesofglass.org http://panesofglass.org/ http://wizardsofsmart.net/ On Fri, Jul 10, 2009 at 10:54 AM, wrote: > > Agreed, only nil and false are false. > > In my scenario, I take the result of the Ruby function and feed it back to > C#. Here's where it is nice to have either an instance of the TrueClass or > FalseClass; otherwise, I need to teach my C# application the Ruby rules for > converting an integer to a Boolean, or I need to convert the integer to a > Boolean in Ruby. > > -- Chuck > > -- > Chuck Durfee > Sr. Internet Software Developer > TSYS iSolutions, Golden > Email cdurfee at tsys.com > > > > *"Pete Bacon Darwin" * > Sent by: ironruby-core-bounces at rubyforge.org > > 07/10/2009 09:40 AM > Please respond to > ironruby-core at rubyforge.org > > To > cc > Subject > Re: [Ironruby-core] Use of case operator > > > > > That?s OK because in Ruby 0 is true! (Only nil and false are false) > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *CDurfee at tsys.com* > Sent:* 10 July 2009 16:21* > To:* ironruby-core at rubyforge.org* > Cc:* ironruby-core at rubyforge.org; ironruby-core-bounces at rubyforge.org* > Subject:* Re: [Ironruby-core] Use of case operator > > > Sorry, yes, I know about the =~ operator, but I believe that returns an > integer (the position of the first match) or nil, not a Boolean as I > require. > > -- Chuck > > -- > Chuck Durfee > Sr. Internet Software Developer > TSYS iSolutions, Golden > Email cdurfee at tsys.com > > *Kibiz0r * > Sent by: ironruby-core-bounces at rubyforge.org > > 07/10/2009 09:07 AM > > > Please respond to > ironruby-core at rubyforge.org > > > To > ironruby-core at rubyforge.org cc > Subject > Re: [Ironruby-core] Use of case operator > > > > > > > > > Chuck, > > Yes, there's an operator just for this scenario! > > The regular expression operator: =~ > > Mike > > On Fri, Jul 10, 2009 at 10:34 AM, <*CDurfee at tsys.com* > > wrote: > > I'm fairly new to Ruby, and I have a usage question. > > There are times when I want to know if a regular expression matches a given > input. For example: > > class String > def containsVowel? > /[AEIOU]/i === self > end > end > > Is there a common Ruby idiom for this, or is using the case operator this > way the norm? > > -- Chuck > > -- > Chuck Durfee > Sr. Internet Software Developer > TSYS iSolutions, Golden > Email *cdurfee at tsys.com* > ------------------------------ > > *The information contained in this communication (including any > attachments hereto) is confidential and is intended solely for the personal > and confidential use of the individual or entity to whom it is addressed. If > the reader of this message is not the intended recipient or an agent > responsible for delivering it to the intended recipient, you are hereby > notified that you have received this communication in error and that any > review, dissemination, copying, or unauthorized use of this information, or > the taking of any action in reliance on the contents of this information is > strictly prohibited. If you have received this communication in error, > please notify us immediately by e-mail, and delete the original message. > Thank you * > > > _______________________________________________ > Ironruby-core mailing list* > **Ironruby-core at rubyforge.org* * > **http://rubyforge.org/mailman/listinfo/ironruby-core* > > > > > -- > Michael Harrington | Software Apprentice > Atomic Object | *http://atomicobject.com* > [Ph] +1 616 776 6020 [Fx] +1 616 776 6015 > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > ------------------------------ > > *The information contained in this communication (including any > attachments hereto) is confidential and is intended solely for the personal > and confidential use of the individual or entity to whom it is addressed. If > the reader of this message is not the intended recipient or an agent > responsible for delivering it to the intended recipient, you are hereby > notified that you have received this communication in error and that any > review, dissemination, copying, or unauthorized use of this information, or > the taking of any action in reliance on the contents of this information is > strictly prohibited. If you have received this communication in error, > please notify us immediately by e-mail, and delete the original message. > Thank you * > > Checked by AVG - www.avg.com > Version: 8.5.375 / Virus Database: 270.13.5/2220 - Release Date: 07/09/09 > 18:07:00_______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > ------------------------------ > > * The information contained in this communication (including any > attachments hereto) is confidential and is intended solely for the personal > and confidential use of the individual or entity to whom it is addressed. If > the reader of this message is not the intended recipient or an agent > responsible for delivering it to the intended recipient, you are hereby > notified that you have received this communication in error and that any > review, dissemination, copying, or unauthorized use of this information, or > the taking of any action in reliance on the contents of this information is > strictly prohibited. If you have received this communication in error, > please notify us immediately by e-mail, and delete the original message. > Thank you * > > _______________________________________________ > 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 Fri Jul 10 12:08:54 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Fri, 10 Jul 2009 18:08:54 +0200 Subject: [Ironruby-core] Use of case operator In-Reply-To: References: <02a101ca0174$b4d51ce0$1e7f56a0$@com> Message-ID: you can always do something like!!(/[AEIOU]/i =~ self) That will return true or false --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Fri, Jul 10, 2009 at 5:54 PM, wrote: > > Agreed, only nil and false are false. > > In my scenario, I take the result of the Ruby function and feed it back to > C#. Here's where it is nice to have either an instance of the TrueClass or > FalseClass; otherwise, I need to teach my C# application the Ruby rules for > converting an integer to a Boolean, or I need to convert the integer to a > Boolean in Ruby. > > -- Chuck > > -- > Chuck Durfee > Sr. Internet Software Developer > TSYS iSolutions, Golden > Email cdurfee at tsys.com > > > > *"Pete Bacon Darwin" * > Sent by: ironruby-core-bounces at rubyforge.org > > 07/10/2009 09:40 AM > Please respond to > ironruby-core at rubyforge.org > > To > cc > Subject > Re: [Ironruby-core] Use of case operator > > > > > That?s OK because in Ruby 0 is true! (Only nil and false are false) > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *CDurfee at tsys.com* > Sent:* 10 July 2009 16:21* > To:* ironruby-core at rubyforge.org* > Cc:* ironruby-core at rubyforge.org; ironruby-core-bounces at rubyforge.org* > Subject:* Re: [Ironruby-core] Use of case operator > > > Sorry, yes, I know about the =~ operator, but I believe that returns an > integer (the position of the first match) or nil, not a Boolean as I > require. > > -- Chuck > > -- > Chuck Durfee > Sr. Internet Software Developer > TSYS iSolutions, Golden > Email cdurfee at tsys.com > > *Kibiz0r * > Sent by: ironruby-core-bounces at rubyforge.org > > 07/10/2009 09:07 AM > > > Please respond to > ironruby-core at rubyforge.org > > > To > ironruby-core at rubyforge.org cc > Subject > Re: [Ironruby-core] Use of case operator > > > > > > > > > Chuck, > > Yes, there's an operator just for this scenario! > > The regular expression operator: =~ > > Mike > > On Fri, Jul 10, 2009 at 10:34 AM, <*CDurfee at tsys.com* > > wrote: > > I'm fairly new to Ruby, and I have a usage question. > > There are times when I want to know if a regular expression matches a given > input. For example: > > class String > def containsVowel? > /[AEIOU]/i === self > end > end > > Is there a common Ruby idiom for this, or is using the case operator this > way the norm? > > -- Chuck > > -- > Chuck Durfee > Sr. Internet Software Developer > TSYS iSolutions, Golden > Email *cdurfee at tsys.com* > ------------------------------ > > *The information contained in this communication (including any > attachments hereto) is confidential and is intended solely for the personal > and confidential use of the individual or entity to whom it is addressed. If > the reader of this message is not the intended recipient or an agent > responsible for delivering it to the intended recipient, you are hereby > notified that you have received this communication in error and that any > review, dissemination, copying, or unauthorized use of this information, or > the taking of any action in reliance on the contents of this information is > strictly prohibited. If you have received this communication in error, > please notify us immediately by e-mail, and delete the original message. > Thank you * > > > _______________________________________________ > Ironruby-core mailing list* > **Ironruby-core at rubyforge.org* * > **http://rubyforge.org/mailman/listinfo/ironruby-core* > > > > > -- > Michael Harrington | Software Apprentice > Atomic Object | *http://atomicobject.com* > [Ph] +1 616 776 6020 [Fx] +1 616 776 6015 > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > ------------------------------ > > *The information contained in this communication (including any > attachments hereto) is confidential and is intended solely for the personal > and confidential use of the individual or entity to whom it is addressed. If > the reader of this message is not the intended recipient or an agent > responsible for delivering it to the intended recipient, you are hereby > notified that you have received this communication in error and that any > review, dissemination, copying, or unauthorized use of this information, or > the taking of any action in reliance on the contents of this information is > strictly prohibited. If you have received this communication in error, > please notify us immediately by e-mail, and delete the original message. > Thank you * > > Checked by AVG - www.avg.com > Version: 8.5.375 / Virus Database: 270.13.5/2220 - Release Date: 07/09/09 > 18:07:00_______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > ------------------------------ > > * The information contained in this communication (including any > attachments hereto) is confidential and is intended solely for the personal > and confidential use of the individual or entity to whom it is addressed. If > the reader of this message is not the intended recipient or an agent > responsible for delivering it to the intended recipient, you are hereby > notified that you have received this communication in error and that any > review, dissemination, copying, or unauthorized use of this information, or > the taking of any action in reliance on the contents of this information is > strictly prohibited. If you have received this communication in error, > please notify us immediately by e-mail, and delete the original message. > Thank you * > > > _______________________________________________ > 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 Sat Jul 11 00:17:00 2009 From: will at hotgazpacho.org (Will Green) Date: Sat, 11 Jul 2009 00:17:00 -0400 Subject: [Ironruby-core] win32console and color In-Reply-To: References: <5a36636c449b108f9501a02a1489c68c@ruby-forum.com> Message-ID: <398d3e0e0907102117g50d1ca55g26ed8168f659e326@mail.gmail.com> Though it's not gemified, it does work for very simple strings (one control code), and only for Kernel#print. Overriding Kernel#puts would be very similar. What I could really use help on is parsing the ANSI control codes, for more complex strings (like setting both foreground and background). Sadly, my Regex-fu is not very strong. -- Will Green http://willgreen.mp/ On Thu, Jul 9, 2009 at 1:08 PM, Ivan Porto Carrero wrote: > This may help, I got the people mixed up it was Will Green who has been > working on it: > http://github.com/hotgazpacho/iron-term-ansicolor/ > I guess you'd have to fork it and make it more stable if necessary. > > > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > > > On Thu, Jul 9, 2009 at 6:03 PM, Mohammad Azam wrote: > >> Hi, >> >> I am trying to color my spec results when running specification unit >> tests. I am using the following: >> >> C:> spec test_prime.rb --format nested --color >> >> But it tells me to install gem "win32console". So, I installed the gem >> using: >> >> C:> igem install win32console >> >> But still it gives me the same message that I need to install >> win32console gem. >> -- >> 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 lists at ruby-forum.com Sat Jul 11 01:52:07 2009 From: lists at ruby-forum.com (Kevin Radcliffe) Date: Sat, 11 Jul 2009 07:52:07 +0200 Subject: [Ironruby-core] IronRuby "Fusion" (VB6 , VBScript, Javascript) Message-ID: In the same vein as VB "Fusion": http://msdn.microsoft.com/en-us/vbrun/ms788241.aspx I've found that creating a COM-callable wrapper that hosts IronRuby is pretty easy to put together. I actually was initially trying to be able to execute IronRuby from VB6 (using vbScript) and I got that working. >From there, since the ActiveX wrapper now existed, I was able to get classic ASP pages (through both server-side VBScript and Javascript) to use IronRuby. Javascript seems a little better fit, as you can create some dynamic objects on the js side, send them to IronRuby, and have those objects updated with results based on the script you're executing. Just wanted to give a heads up here in case someone else finds this interesting. Please let me know through the forum/mailing list if you would like some tips getting this up and running. -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Sat Jul 11 02:03:29 2009 From: lists at ruby-forum.com (Kevin Radcliffe) Date: Sat, 11 Jul 2009 08:03:29 +0200 Subject: [Ironruby-core] Sinatra, and web enabling existing .NET codebases Message-ID: <810f5fd80b266c5cc693918b978a1806@ruby-forum.com> Aaron Quint gave a very interesting talk at GoGaRuCo: http://pivotallabs.com/gogaruco/talks/51-sinatra-the-framework-within About using sinatra to quickly and easily REST-enable libraries. I think this might be a very good fit where we'd like to web/REST enable our existing .NET codebase assets. It looks like RESTClient is not quite ready to run from IronRuby (at least from my tests), but personally, I think this looks quite compelling as a IronRuby use case. There are other alternatives for giving a REST interface to our .NET libs - REST service through WCF, or OpenRasta: http://trac.caffeine-it.com/openrasta But I think Sinatra/RESTClient may be faster/easier/less configuration than the more statically-oriented existing solutions. Thoughts? Anyone already working on something like this? and if so, could you provide any insight into the best way to expose library functionality in this fashion? -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Sat Jul 11 11:17:45 2009 From: lists at ruby-forum.com (Shay Friedman) Date: Sat, 11 Jul 2009 17:17:45 +0200 Subject: [Ironruby-core] .Net Events in IR Message-ID: Hi there, I know that I can register and handle .Net events in IronRuby in the following way: klass.some_event { |sender, args| puts "Hello!" } Is this the only way of doing so or are there more ways? Thanks! Shay. ---------------------------- Shay Friedman http://www.ironshay.com Follow me: http://twitter.com/ironshay -- Posted via http://www.ruby-forum.com/. From thibaut.barrere at gmail.com Sat Jul 11 11:36:31 2009 From: thibaut.barrere at gmail.com (thibaut.barrere at gmail.com) Date: Sat, 11 Jul 2009 17:36:31 +0200 Subject: [Ironruby-core] .Net Events in IR In-Reply-To: References: Message-ID: <32C39E2F-2F76-4416-B53E-225D36F9F3D5@gmail.com> Quite similarly you can send a Proc as the event value: http://github.com/thbar/magic/blob/fd51bcd6f4c713fdb8b4bbb60b1c18ca84804c3a/lib/magic/instance_creator.rb#L50 Hth, -- Thibaut Le 11 juil. 2009 ? 17:17, Shay Friedman a ?crit : > Hi there, > > I know that I can register and handle .Net events in IronRuby in the > following way: > klass.some_event { |sender, args| puts "Hello!" } > > Is this the only way of doing so or are there more ways? > > Thanks! > Shay. > ---------------------------- > Shay Friedman > http://www.ironshay.com > Follow me: http://twitter.com/ironshay > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core From jdeville at microsoft.com Sat Jul 11 14:36:31 2009 From: jdeville at microsoft.com (Jim Deville) Date: Sat, 11 Jul 2009 18:36:31 +0000 Subject: [Ironruby-core] .Net Events in IR Message-ID: These and any future changes will be in the specs at Merlin/Main/Languages/Ruby/Tests/Interop/net/events Sent from my Windows? phone. build 21215.5.0.0 -----Original Message----- From: thibaut.barrere at gmail.com Sent: Saturday, July 11, 2009 10:39 AM To: ironruby-core at rubyforge.org Cc: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] .Net Events in IR Quite similarly you can send a Proc as the event value: http://github.com/thbar/magic/blob/fd51bcd6f4c713fdb8b4bbb60b1c18ca84804c3a/lib/magic/instance_creator.rb#L50 Hth, -- Thibaut Le 11 juil. 2009 ? 17:17, Shay Friedman a ?crit : > Hi there, > > I know that I can register and handle .Net events in IronRuby in the > following way: > klass.some_event { |sender, args| puts "Hello!" } > > Is this the only way of doing so or are there more ways? > > Thanks! > Shay. > ---------------------------- > Shay Friedman > http://www.ironshay.com > Follow me: http://twitter.com/ironshay > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From lists at ruby-forum.com Sat Jul 11 19:43:14 2009 From: lists at ruby-forum.com (Kevin Radcliffe) Date: Sun, 12 Jul 2009 01:43:14 +0200 Subject: [Ironruby-core] .Net Events in IR In-Reply-To: References: Message-ID: <9e31386208c90314d5d6aa5eeefecff2@ruby-forum.com> Shay Friedman wrote: > Hi there, > > I know that I can register and handle .Net events in IronRuby in the > following way: > klass.some_event { |sender, args| puts "Hello!" } > > Is this the only way of doing so or are there more ways? > > Thanks! > Shay. > ---------------------------- > Shay Friedman > http://www.ironshay.com > Follow me: http://twitter.com/ironshay What are you looking to do currently, is there something specific you want to accomplish? You are sending a block, so this could be multi-line with do/end . Also, (depending on the context of your program), you could forgo the |sender, args| : button.click do puts "Something..." puts "Very interesting.." end I've attached a very simple Windows Forms app which shows this method of hooking up an event, firing it manually through code, and then bringing up the GUI... -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Sat Jul 11 19:46:06 2009 From: lists at ruby-forum.com (Kevin Radcliffe) Date: Sun, 12 Jul 2009 01:46:06 +0200 Subject: [Ironruby-core] .Net Events in IR In-Reply-To: <9e31386208c90314d5d6aa5eeefecff2@ruby-forum.com> References: <9e31386208c90314d5d6aa5eeefecff2@ruby-forum.com> Message-ID: <16fe6b57e0ffdcc37db4fa3a67586bfb@ruby-forum.com> I couldn't attach the specified file, as the forum would give me an Application Error, will try to send to Shay directly.. Please feel free to direct message me if anyone else comes across this and wants a copy of the file. Otherwise, I'd suggest a better resource for writing windows apps with IronRuby is Thibaut Barr?re's "magic": http://github.com/thbar/magic/tree/master -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Sun Jul 12 14:22:44 2009 From: lists at ruby-forum.com (Kevin Radcliffe) Date: Sun, 12 Jul 2009 20:22:44 +0200 Subject: [Ironruby-core] .NET RIA Services, IronRuby alternatives? Message-ID: <95cf9720621eed7d4b30bf695d4aa19a@ruby-forum.com> I have just been checking out the docs from the .NET RIA Services July 2009 preview: http://www.microsoft.com/downloads/details.aspx?FamilyID=76bb3a07-3846-4564-b0c3-27972bcaabce&displaylang=en It seems pretty complicated, and there is a lot of magic (shared files, attributes, generated code - with more attributes in it) Since dynamic Silverlight already exists, I was wondering if anyone has had success using a simpler approach using that? Specifically, I am looking to enable simple CRUD against a db backend using Silverlight. I would imagine that using REST/Sinatra would result in a much much simpler, but arguably equally effective solution for Silverlight apps. (.NET RIA Services does seem to have some nice (but not intuitive) stuff for validations though) Anyone already trying .NET RIA Services and/or Dynamic Silverlight? Thanks -- Posted via http://www.ruby-forum.com/. From ivan at flanders.co.nz Sun Jul 12 15:41:18 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Sun, 12 Jul 2009 21:41:18 +0200 Subject: [Ironruby-core] .NET RIA Services, IronRuby alternatives? In-Reply-To: <95cf9720621eed7d4b30bf695d4aa19a@ruby-forum.com> References: <95cf9720621eed7d4b30bf695d4aa19a@ruby-forum.com> Message-ID: ActiveResource? But it would be the data binding that will be hard if the class is defined in ruby unless something has changed. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Sun, Jul 12, 2009 at 8:22 PM, Kevin Radcliffe wrote: > I have just been checking out the docs from the .NET RIA Services July > 2009 preview: > > > http://www.microsoft.com/downloads/details.aspx?FamilyID=76bb3a07-3846-4564-b0c3-27972bcaabce&displaylang=en > > It seems pretty complicated, and there is a lot of magic (shared files, > attributes, generated code - with more attributes in it) > > Since dynamic Silverlight already exists, I was wondering if anyone has > had success using a simpler approach using that? > > Specifically, I am looking to enable simple CRUD against a db backend > using Silverlight. > > I would imagine that using REST/Sinatra would result in a much much > simpler, but arguably equally effective solution for Silverlight apps. > (.NET RIA Services does seem to have some nice (but not intuitive) stuff > for validations though) > > Anyone already trying .NET RIA Services and/or Dynamic Silverlight? > Thanks > -- > 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 Sun Jul 12 23:27:17 2009 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Sun, 12 Jul 2009 20:27:17 -0700 Subject: [Ironruby-core] Interrupt Execution In-Reply-To: <50ad0a39b148c91bfc9a7bf49bd27349@ruby-forum.com> References: <50ad0a39b148c91bfc9a7bf49bd27349@ruby-forum.com> Message-ID: There is currently no support for execution interruption in DLR or IronRuby. It is not sufficient to insert termination checks in DLR interpreter. You need to add checks on other places too. And it's better not to do it in the interpreter because interpreted code gets compiled after a while (or even immediately if it contains loops) and then your checks are gone. It is also not sufficient to look for loops in DLR trees produced by IronRuby (e.g. "loop" method performs the looping inside C# code). The easiest way how to make this work is to place check into - WhileLoopExpression.cs: inside the infinite loop (AstFactory.Infinite...) - this ensures that all while loops in Ruby code are can be interrupted. - BlockDefinition.cs: right after Ast.Label(redoLabel). This makes any block-based loops interruptible. This should allow you to interrupt any Ruby loop. Note that interrupting Ruby code can corrupt the state of the VM (ScriptRuntime) so you should probably not reuse that Runtime for other executions. Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Aaron Clauson Sent: Thursday, July 09, 2009 4:44 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Interrupt Execution After spending a few hours delving into the DLR source I suspect the "interrupt execution" implementation is more related to the DLR core than IronRuby so I've posted a question over there http://dlr.codeplex.com/Thread/View.aspx?ThreadId=62052. Regards, Aaron -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From robert.brotherus at napa.fi Mon Jul 13 06:01:43 2009 From: robert.brotherus at napa.fi (Robert Brotherus) Date: Mon, 13 Jul 2009 13:01:43 +0300 Subject: [Ironruby-core] Accessing 32-bit native DLL:s when running IR on Vista64 In-Reply-To: <16fe6b57e0ffdcc37db4fa3a67586bfb@ruby-forum.com> References: <9e31386208c90314d5d6aa5eeefecff2@ruby-forum.com> <16fe6b57e0ffdcc37db4fa3a67586bfb@ruby-forum.com> Message-ID: <16A7DD08F0425648AB80B28A3453C40B24A151@NW60R2.napa.fi> We are building IronRuby top-layer on a legacy application that consist, in part, of Windows 32-bit native dll:s. These native DLL:s are accessed by C# code via P/Invoke and our IronRuby code subsequently calls the C# code. We start our app by running: ie.exe main.rb Things are going fine on Windows XP/Vista 32-bit. On 64-bit Vista, the native DLL:s fail to load and application execution fails. This is because 64-bit Vista uses by default 64-bit version of MS.NET framework (in c:\Windows\Microsoft.NET\Framework64). This executes in a 64-bit process that cannot load 32-bit dll:s. Vista64 has also 32-bit version of ms.net (in c:\Windows\Microsoft.NET\Framework). When our app is run with this version of the framework, it executes fine (loading 32-bit native dll:s) on Vista64. However, the only way we have found out to run a dotnet-exe with the 32-bit dotnet-framework on Vista64 is to compile the dotnet-exe with having "Platfowm target"-setting to be "x86" instead of the default "Any CPU". This means that currenlty we are forced to use our own compilation of ir.exe instead of working with the out-of-the-box ironruby-installations at http://www.ironruby.net/Download. Is there a way to start a dotnet-exe that has been built with "Any CPU" setting explicitly with 32-bit version of dotnet framework? Something like: c:\work> launch32 ir.exe main.rb If no, would it make sense for ir installation packages to contain out-of-the-box three versions of the main exe: ie.exe (Any CPU), ir32.exe and ir64.exe ? Robert Brotherus Napa Inc. From lists at ruby-forum.com Mon Jul 13 12:07:40 2009 From: lists at ruby-forum.com (Shay Friedman) Date: Mon, 13 Jul 2009 18:07:40 +0200 Subject: [Ironruby-core] IsRubyMethod Message-ID: <0fe6330474d03d63eb01359272a3cc2a@ruby-forum.com> Hi, I remember Tomas has posted a code review about IsRubyMethod some time ago. I was looking for it in the code but i couldn't find it. Is it still there? Thanks, Shay. ---------------------------- Shay Friedman http://www.ironshay.com Follow me: http://twitter.com/ironshay -- Posted via http://www.ruby-forum.com/. From wilkins.mark at gmail.com Mon Jul 13 12:52:41 2009 From: wilkins.mark at gmail.com (Mark Wilkins) Date: Mon, 13 Jul 2009 12:52:41 -0400 Subject: [Ironruby-core] IronRuby + Sinatra isn't working for me Message-ID: <1127fc0f0907130952k3b1b6a12t51cba22b132396f8@mail.gmail.com> After finally watching John Lam's PDC presentation, I thought I'd take my IronRuby a step farther and try using it to run Sinatra. I've used Sinatra a bit with MRI, but the behavior I'm getting with IronRuby seems a bit odd. Here's what's currently installed on my machine: IronRuby 0.6.0.0 Sinatra 0.9.2 (installed via igem install) so, given a simple app like: #myapp.rb require 'rubygems' require 'sinatra' get '/' do 'hello' end and from the command line, running: $ ir myapp.rb rather than getting the expected, "==Sinatra has taken the stage...", I get: $ir -v myapp.rb IronRuby 0.6.0.0 on .NET 2.0.0.0 [E:\@archive\devlocal\ir_dev] $ and there is no server running at localhost:4567. Anyone have any ideas? Thanks, Mark From ivan at flanders.co.nz Mon Jul 13 13:10:29 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Mon, 13 Jul 2009 19:10:29 +0200 Subject: [Ironruby-core] IronRuby + Sinatra isn't working for me In-Reply-To: <1127fc0f0907130952k3b1b6a12t51cba22b132396f8@mail.gmail.com> References: <1127fc0f0907130952k3b1b6a12t51cba22b132396f8@mail.gmail.com> Message-ID: I can't offer any help but I can confirm that it doesn't work for me either. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero On Mon, Jul 13, 2009 at 6:52 PM, Mark Wilkins wrote: > After finally watching John Lam's PDC presentation, I thought I'd take > my IronRuby a step farther and try using it to run Sinatra. I've used > Sinatra a bit with MRI, but the behavior I'm getting with IronRuby > seems a bit odd. > > Here's what's currently installed on my machine: > IronRuby 0.6.0.0 > Sinatra 0.9.2 (installed via igem install) > > so, given a simple app like: > #myapp.rb > require 'rubygems' > require 'sinatra' > > get '/' do > 'hello' > end > > and from the command line, running: > $ ir myapp.rb > > rather than getting the expected, "==Sinatra has taken the stage...", I > get: > > $ir -v myapp.rb > IronRuby 0.6.0.0 on .NET 2.0.0.0 > > [E:\@archive\devlocal\ir_dev] > $ > > and there is no server running at localhost:4567. > > Anyone have any ideas? > > Thanks, > > Mark > _______________________________________________ > 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 wilkins.mark at gmail.com Mon Jul 13 13:21:36 2009 From: wilkins.mark at gmail.com (Mark Wilkins) Date: Mon, 13 Jul 2009 13:21:36 -0400 Subject: [Ironruby-core] IronRuby + Sinatra isn't working for me In-Reply-To: <1127fc0f0907130952k3b1b6a12t51cba22b132396f8@mail.gmail.com> References: <1127fc0f0907130952k3b1b6a12t51cba22b132396f8@mail.gmail.com> Message-ID: <1127fc0f0907131021h404f44cn6efd6cc45b274474@mail.gmail.com> On Mon, Jul 13, 2009 at 12:52 PM, Mark Wilkins wrote: > ... > and from the command line, running: > $ ir myapp.rb > > rather than getting the expected, "==Sinatra has taken the stage...", I get: > > $ir -v myapp.rb > IronRuby 0.6.0.0 on .NET 2.0.0.0 > > [E:\@archive\devlocal\ir_dev] > $ > ... So I just tried this, and it seems to work. I created a config.ru file: #config.ru require 'myapp' run Sinatra::Application and then started the app this way: $irackup config.ru (note: irackup, not rackup) [2009-07-13 13:05:42] INFO WEBrick 1.3.1 [2009-07-13 13:05:42] INFO ruby 1.8.6 (2008-05-28) [i386-mswin32] [2009-07-13 13:05:42] INFO WEBrick::HTTPServer#start: pid=2964 port=9292 ... So, I'm happy with that. Thanks, Mark From Jimmy.Schementi at microsoft.com Mon Jul 13 13:21:47 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Mon, 13 Jul 2009 17:21:47 +0000 Subject: [Ironruby-core] IronRuby + Sinatra isn't working for me In-Reply-To: References: <1127fc0f0907130952k3b1b6a12t51cba22b132396f8@mail.gmail.com> Message-ID: See the Sinatra page on the website (http://ironruby.net/documentation). You need to apply two small changes since Sinatra depends on stack traces to find the entry point script. I consider this a incorrect way to do things, so anyone who'd like to clean this patch up and get it fixed in Sinatra? ~Jimmy Sent from my phone On Jul 13, 2009, at 10:11 AM, "Ivan Porto Carrero" > wrote: I can't offer any help but I can confirm that it doesn't work for me either. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero On Mon, Jul 13, 2009 at 6:52 PM, Mark Wilkins <wilkins.mark at gmail.com> wrote: After finally watching John Lam's PDC presentation, I thought I'd take my IronRuby a step farther and try using it to run Sinatra. I've used Sinatra a bit with MRI, but the behavior I'm getting with IronRuby seems a bit odd. Here's what's currently installed on my machine: IronRuby 0.6.0.0 Sinatra 0.9.2 (installed via igem install) so, given a simple app like: #myapp.rb require 'rubygems' require 'sinatra' get '/' do 'hello' end and from the command line, running: $ ir myapp.rb rather than getting the expected, "==Sinatra has taken the stage...", I get: $ir -v myapp.rb IronRuby 0.6.0.0 on .NET 2.0.0.0 [E:\@archive\devlocal\ir_dev] $ and there is no server running at localhost:4567. Anyone have any ideas? Thanks, Mark _______________________________________________ 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 wilkins.mark at gmail.com Mon Jul 13 13:27:57 2009 From: wilkins.mark at gmail.com (Mark Wilkins) Date: Mon, 13 Jul 2009 13:27:57 -0400 Subject: [Ironruby-core] IronRuby + Sinatra isn't working for me In-Reply-To: References: <1127fc0f0907130952k3b1b6a12t51cba22b132396f8@mail.gmail.com> Message-ID: <1127fc0f0907131027v648c61e6q2f6f97cf2861a778@mail.gmail.com> On Mon, Jul 13, 2009 at 1:21 PM, Jimmy Schementi wrote: > See the Sinatra page on the website (http://ironruby.net/documentation). You > need to apply two small changes since Sinatra depends on stack traces to > find the entry point script. I consider this a incorrect way to do things, > so anyone who'd like to clean this patch up and get it fixed in Sinatra? D'oh! Sorry, Jimmy. I should have seen that. Thanks. Mark From Jimmy.Schementi at microsoft.com Mon Jul 13 14:08:03 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Mon, 13 Jul 2009 18:08:03 +0000 Subject: [Ironruby-core] IronRuby + Sinatra isn't working for me In-Reply-To: <1127fc0f0907131021h404f44cn6efd6cc45b274474@mail.gmail.com> References: <1127fc0f0907130952k3b1b6a12t51cba22b132396f8@mail.gmail.com> <1127fc0f0907131021h404f44cn6efd6cc45b274474@mail.gmail.com> Message-ID: <82F4945F-B57D-4197-ADD0-7425484FCD3A@microsoft.com> Yep, that will bypass the need for Sinatra to use stack traces to find the entry point script, so using a config.ru will work unpatched. ~Jimmy Sent from my phone On Jul 13, 2009, at 10:22 AM, "Mark Wilkins" wrote: > On Mon, Jul 13, 2009 at 12:52 PM, Mark > Wilkins wrote: >> ... >> and from the command line, running: >> $ ir myapp.rb >> >> rather than getting the expected, "==Sinatra has taken the >> stage...", I get: >> >> $ir -v myapp.rb >> IronRuby 0.6.0.0 on .NET 2.0.0.0 >> >> [E:\@archive\devlocal\ir_dev] >> $ >> ... > > > So I just tried this, and it seems to work. > > I created a config.ru file: > > #config.ru > require 'myapp' > run Sinatra::Application > > and then started the app this way: > > $irackup config.ru (note: irackup, not rackup) > [2009-07-13 13:05:42] INFO WEBrick 1.3.1 > [2009-07-13 13:05:42] INFO ruby 1.8.6 (2008-05-28) [i386-mswin32] > [2009-07-13 13:05:42] INFO WEBrick::HTTPServer#start: pid=2964 > port=9292 > ... > > So, I'm happy with that. > > Thanks, > > Mark > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > From Shri.Borde at microsoft.com Mon Jul 13 14:30:04 2009 From: Shri.Borde at microsoft.com (Shri Borde) Date: Mon, 13 Jul 2009 11:30:04 -0700 Subject: [Ironruby-core] Accessing 32-bit native DLL:s when running IR on Vista64 In-Reply-To: <16A7DD08F0425648AB80B28A3453C40B24A151@NW60R2.napa.fi> References: <9e31386208c90314d5d6aa5eeefecff2@ruby-forum.com> <16fe6b57e0ffdcc37db4fa3a67586bfb@ruby-forum.com> <16A7DD08F0425648AB80B28A3453C40B24A151@NW60R2.napa.fi> Message-ID: <9A92D7D99FC1564D8C8F18008B08098F499CA348D8@NA-EXMSG-C118.redmond.corp.microsoft.com> Its trivial to implement "launch32". Just use AppDomain.ExecuteAssembly (http://msdn.microsoft.com/en-us/library/system.appdomain.executeassembly.aspx) to launch ir.exe in the same process. Now the launch32.exe wrapper program needs to be compiled using /platform:x86. The bitness of the process will be determined by the bitness of launch32.exe, not any exes it launches in-process using ExecuteAssembly. That said, it *will* be useful to include platform-specific versions of ir.exe in the release. F# does this, and IronPython has recently started doing this. The main reason to do this is that startup is very slow on 64-bit machines. See http://stackoverflow.com/questions/1015076/why-is-ironpython-startup-time-so-slow. So having ir.exe be a 32-bit executable prevents people from naively hitting the slow startup, while including ir64.exe still enables the folks who need 64-bit processes (mainly because they are manipulating large data sets and need more than 2^32 address space) Thanks, Shri -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Robert Brotherus Sent: Monday, July 13, 2009 3:02 AM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] Accessing 32-bit native DLL:s when running IR on Vista64 We are building IronRuby top-layer on a legacy application that consist, in part, of Windows 32-bit native dll:s. These native DLL:s are accessed by C# code via P/Invoke and our IronRuby code subsequently calls the C# code. We start our app by running: ie.exe main.rb Things are going fine on Windows XP/Vista 32-bit. On 64-bit Vista, the native DLL:s fail to load and application execution fails. This is because 64-bit Vista uses by default 64-bit version of MS.NET framework (in c:\Windows\Microsoft.NET\Framework64). This executes in a 64-bit process that cannot load 32-bit dll:s. Vista64 has also 32-bit version of ms.net (in c:\Windows\Microsoft.NET\Framework). When our app is run with this version of the framework, it executes fine (loading 32-bit native dll:s) on Vista64. However, the only way we have found out to run a dotnet-exe with the 32-bit dotnet-framework on Vista64 is to compile the dotnet-exe with having "Platfowm target"-setting to be "x86" instead of the default "Any CPU". This means that currenlty we are forced to use our own compilation of ir.exe instead of working with the out-of-the-box ironruby-installations at http://www.ironruby.net/Download. Is there a way to start a dotnet-exe that has been built with "Any CPU" setting explicitly with 32-bit version of dotnet framework? Something like: c:\work> launch32 ir.exe main.rb If no, would it make sense for ir installation packages to contain out-of-the-box three versions of the main exe: ie.exe (Any CPU), ir32.exe and ir64.exe ? Robert Brotherus Napa Inc. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From lists at ruby-forum.com Tue Jul 14 11:46:16 2009 From: lists at ruby-forum.com (Kevin Radcliffe) Date: Tue, 14 Jul 2009 17:46:16 +0200 Subject: [Ironruby-core] IsRubyMethod In-Reply-To: <0fe6330474d03d63eb01359272a3cc2a@ruby-forum.com> References: <0fe6330474d03d63eb01359272a3cc2a@ruby-forum.com> Message-ID: Shay Friedman wrote: > I remember Tomas has posted a code review about IsRubyMethod some time > ago. > I was looking for it in the code but i couldn't find it. Is it still > there? Shay, I couldn't find it in the source either (unless it is called something else) In the meantime, perhaps we could come up with a method that does something similar that will meet your needs.. What are you trying to accomplish? -- Posted via http://www.ruby-forum.com/. From ivan at flanders.co.nz Tue Jul 14 13:39:28 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Tue, 14 Jul 2009 19:39:28 +0200 Subject: [Ironruby-core] IsRubyMethod In-Reply-To: References: <0fe6330474d03d63eb01359272a3cc2a@ruby-forum.com> Message-ID: I guess this could be one way to do it class Class def ruby_method?(name) begin self.class.clr_member name.to_sym return false rescue return true end end end or something along those lines. I have a thing against relying on exceptions for these kinds of methods but that will work. Exceptions are meant for exceptional cases and this isn't an exceptional case :) You could also check if the type is a clr type and if it is enumerate the clr methods with reflection something like this class String # converts a camel cased word to an underscored word def underscore self.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end end if ctype = MyClass.to_clr_type members = ctype.get_methods + ctype.get_properties !members.collect { |mem| mem.to_s.underscore }.include? :my_method else return true end --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Tue, Jul 14, 2009 at 5:46 PM, Kevin Radcliffe wrote: > Shay Friedman wrote: > > I remember Tomas has posted a code review about IsRubyMethod some time > > ago. > > I was looking for it in the code but i couldn't find it. Is it still > > there? > > Shay, I couldn't find it in the source either (unless it is called > something else) > In the meantime, perhaps we could come up with a method that does > something similar that will meet your needs.. > What are you trying to accomplish? > > -- > 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 ben2004uk at googlemail.com Tue Jul 14 13:56:25 2009 From: ben2004uk at googlemail.com (Ben Hall) Date: Tue, 14 Jul 2009 18:56:25 +0100 Subject: [Ironruby-core] IronRuby 0.6 and Rails Message-ID: Hello, I'm trying to re-use the same demo I used on IronRuby 0.3 however on 0.6 I'm getting the following error: IronRuby::Builtins::EncodingCompatibilityError in Posts#index Showing app/views/posts/index.html.erb where line #12 raised: incompatible character encodings: utf-8 (KCODE) and utf-8 The code does this: <% @posts.each do |p| %> <%= p.Title %> <% end %> p is a Post C# object, Title is a string populated by a C# framework. Please help! Thanks Ben From Jimmy.Schementi at microsoft.com Tue Jul 14 15:12:34 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Tue, 14 Jul 2009 19:12:34 +0000 Subject: [Ironruby-core] IronRuby 0.6 and Rails In-Reply-To: References: Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC18B3A205@tk5ex14mbxc106.redmond.corp.microsoft.com> Have you read the documentation on how to get IronRuby running Rails? http://ironruby.net/Documentation/Real_Ruby_Applications/Rails Here's the relevant info: 8. Rails by default uses UTF-8 encoding, but IronRuby has issues when mixing this encoding with UTF-8 strings from .NET. For now, you can disable encoding by removing the method body of Rails::Initializer#initialize_encoding in rails-2.3.2\lib\initializer.rb. ________________________________________ From: ironruby-core-bounces at rubyforge.org [ironruby-core-bounces at rubyforge.org] on behalf of Ben Hall [ben2004uk at googlemail.com] Sent: Tuesday, July 14, 2009 10:56 AM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] IronRuby 0.6 and Rails Hello, I'm trying to re-use the same demo I used on IronRuby 0.3 however on 0.6 I'm getting the following error: IronRuby::Builtins::EncodingCompatibilityError in Posts#index Showing app/views/posts/index.html.erb where line #12 raised: incompatible character encodings: utf-8 (KCODE) and utf-8 The code does this: <% @posts.each do |p| %> <%= p.Title %> <% end %> p is a Post C# object, Title is a string populated by a C# framework. Please help! Thanks Ben _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From ben2004uk at googlemail.com Tue Jul 14 16:14:47 2009 From: ben2004uk at googlemail.com (Ben Hall) Date: Tue, 14 Jul 2009 21:14:47 +0100 Subject: [Ironruby-core] How to run 'spec' on an individual sample ? In-Reply-To: <4a68b8cf0907141246tdd644e7ocbf9b746cdf82cd9@mail.gmail.com> References: <4a68b8cf0907141235k6c26d28at36ad1e38ebbad9cd@mail.gmail.com> <0047ECBFA2E0DF4A834AA369282A5AFC18B3A29C@tk5ex14mbxc106.redmond.corp.microsoft.com> <4a68b8cf0907141246tdd644e7ocbf9b746cdf82cd9@mail.gmail.com> Message-ID: ir my_spec.rb used to work, but in either 0.6 or 1.2.7 no information is wrote to the console. What I did was added C:\ironruby\lib\IronRuby\gems\1.8\bin to my path variable, make sure its before the MRI path and then you can do spec my_spec and it will work against IR.... On Tue, Jul 14, 2009 at 8:46 PM, Thibaut Barr?re wrote: >> Doesn't ir.exe my_spec.rb work also? You won't get any configuration >> benefits "spec" gives you, but it should still run. If not, then just?copy >> "spec" and "spec.bat" from the ruby bin directory (usually C:\ruby\bin) to >> where ir.exe is located, rename them to "ispec", and edit ispec.bat to run >> ispec with IronRuby. > > > Not sure if it's rpsec 1.2.7 specific or not, but if I just run ir.exe > my_spec.rb, nothing happens (either in MRI or IronRuby). > > About your solution: I just came out with the same idea! > > My ispec.bat: > > ir C:\ironruby\lib\IronRuby\gems\1.8\gems\rspec-1.2.7\bin\spec %* > > -- Thibaut > > >> >> ~js >> ________________________________ >> From: ironruby-core-bounces at rubyforge.org >> [ironruby-core-bounces at rubyforge.org] on behalf of Thibaut Barr?re >> [thibaut.barrere at gmail.com] >> Sent: Tuesday, July 14, 2009 12:35 PM >> To: ironruby-core >> Subject: [Ironruby-core] How to run 'spec' on an individual sample ? >> >> Hi, >> >> is there a specific trick to be able to launch a single rspec example when >> working with IronRuby ? >> >> The regular way of doing this is to call "spec my_spec.rb", which defaults >> to using MRI afaik. >> >> Are other people patching the spec script manually, or is there a cleaner >> alternative ? >> >> -- Thibaut >> _______________________________________________ >> Ironruby-core mailing list >> Ironruby-core at rubyforge.org >> http://rubyforge.org/mailman/listinfo/ironruby-core >> > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > From ben2004uk at googlemail.com Tue Jul 14 16:22:40 2009 From: ben2004uk at googlemail.com (Ben Hall) Date: Tue, 14 Jul 2009 21:22:40 +0100 Subject: [Ironruby-core] IronRuby 0.6 and Rails In-Reply-To: <0047ECBFA2E0DF4A834AA369282A5AFC18B3A205@tk5ex14mbxc106.redmond.corp.microsoft.com> References: <0047ECBFA2E0DF4A834AA369282A5AFC18B3A205@tk5ex14mbxc106.redmond.corp.microsoft.com> Message-ID: hmmm, I made the change but now it is erroring around <%= yield %> IronRuby::Builtins::EncodingCompatibilityError in Posts#index Showing app/views/layouts/posts.html.erb where line #15 raised: incompatible character encodings: utf-8 (KCODE) and utf-8 On Tue, Jul 14, 2009 at 8:12 PM, Jimmy Schementi wrote: > Have you read the documentation on how to get IronRuby running Rails? > http://ironruby.net/Documentation/Real_Ruby_Applications/Rails > > Here's the relevant info: > 8. Rails by default uses UTF-8 encoding, but IronRuby has issues when mixing this encoding with UTF-8 strings from .NET. For now, you can disable encoding by removing the method body of Rails::Initializer#initialize_encoding in rails-2.3.2\lib\initializer.rb. > ________________________________________ > From: ironruby-core-bounces at rubyforge.org [ironruby-core-bounces at rubyforge.org] on behalf of Ben Hall [ben2004uk at googlemail.com] > Sent: Tuesday, July 14, 2009 10:56 AM > To: ironruby-core at rubyforge.org > Subject: [Ironruby-core] IronRuby 0.6 and Rails > > Hello, > > I'm trying to re-use the same demo I used on IronRuby 0.3 however on > 0.6 I'm getting the following error: > > IronRuby::Builtins::EncodingCompatibilityError in Posts#index > > Showing app/views/posts/index.html.erb where line #12 raised: > > incompatible character encodings: utf-8 (KCODE) and utf-8 > > The code does this: > <% @posts.each do |p| %> > ? > ? ?<%= p.Title %> > ? > <% end %> > > p is a Post C# object, Title is a string populated by a C# framework. > > Please help! > > Thanks > > Ben > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > From Jimmy.Schementi at microsoft.com Tue Jul 14 16:24:48 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Tue, 14 Jul 2009 20:24:48 +0000 Subject: [Ironruby-core] IronRuby 0.6 and Rails In-Reply-To: References: <0047ECBFA2E0DF4A834AA369282A5AFC18B3A205@tk5ex14mbxc106.redmond.corp.microsoft.com>, Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC18B3B35F@tk5ex14mbxc106.redmond.corp.microsoft.com> Do a <% puts $KCODE %> or something near the yield (or even in the template that it yields to) to see when KCODE is being set. KCODE will be set if it encounters a utf-8 encoded file. Also, if you can get the demo to me, I'd be more than happy to take a look myself rather than debugging over email. ________________________________________ From: ironruby-core-bounces at rubyforge.org [ironruby-core-bounces at rubyforge.org] on behalf of Ben Hall [ben2004uk at googlemail.com] Sent: Tuesday, July 14, 2009 1:22 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] IronRuby 0.6 and Rails hmmm, I made the change but now it is erroring around <%= yield %> IronRuby::Builtins::EncodingCompatibilityError in Posts#index Showing app/views/layouts/posts.html.erb where line #15 raised: incompatible character encodings: utf-8 (KCODE) and utf-8 On Tue, Jul 14, 2009 at 8:12 PM, Jimmy Schementi wrote: > Have you read the documentation on how to get IronRuby running Rails? > http://ironruby.net/Documentation/Real_Ruby_Applications/Rails > > Here's the relevant info: > 8. Rails by default uses UTF-8 encoding, but IronRuby has issues when mixing this encoding with UTF-8 strings from .NET. For now, you can disable encoding by removing the method body of Rails::Initializer#initialize_encoding in rails-2.3.2\lib\initializer.rb. > ________________________________________ > From: ironruby-core-bounces at rubyforge.org [ironruby-core-bounces at rubyforge.org] on behalf of Ben Hall [ben2004uk at googlemail.com] > Sent: Tuesday, July 14, 2009 10:56 AM > To: ironruby-core at rubyforge.org > Subject: [Ironruby-core] IronRuby 0.6 and Rails > > Hello, > > I'm trying to re-use the same demo I used on IronRuby 0.3 however on > 0.6 I'm getting the following error: > > IronRuby::Builtins::EncodingCompatibilityError in Posts#index > > Showing app/views/posts/index.html.erb where line #12 raised: > > incompatible character encodings: utf-8 (KCODE) and utf-8 > > The code does this: > <% @posts.each do |p| %> > > <%= p.Title %> > > <% end %> > > p is a Post C# object, Title is a string populated by a C# framework. > > Please help! > > Thanks > > Ben > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From lists at ruby-forum.com Tue Jul 14 16:32:47 2009 From: lists at ruby-forum.com (Shay Friedman) Date: Tue, 14 Jul 2009 22:32:47 +0200 Subject: [Ironruby-core] IsRubyMethod In-Reply-To: References: <0fe6330474d03d63eb01359272a3cc2a@ruby-forum.com> Message-ID: I thought it would be a smooth way of figuring out whether a method is a pure Ruby one or a CLR one. I found the post I was talking about (look at the last paragraph): http://www.ruby-forum.com/topic/189940 I guess it was removed somewhere along the way. Thanks! Shay. ---------------------------- Shay Friedman http://www.ironshay.com Follow me: http://twitter.com/ironshay -- Posted via http://www.ruby-forum.com/. From Tomas.Matousek at microsoft.com Tue Jul 14 16:42:29 2009 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Tue, 14 Jul 2009 13:42:29 -0700 Subject: [Ironruby-core] IsRubyMethod In-Reply-To: References: <0fe6330474d03d63eb01359272a3cc2a@ruby-forum.com> Message-ID: It's called IsRubyMember now and it's an internal property on RubyMemberInfo. Would it help to expose it on Method and UnboundMethod? It could be called e.g. "clr_member?". What would be the use case for such a method? Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shay Friedman Sent: Tuesday, July 14, 2009 1:33 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] IsRubyMethod I thought it would be a smooth way of figuring out whether a method is a pure Ruby one or a CLR one. I found the post I was talking about (look at the last paragraph): http://www.ruby-forum.com/topic/189940 I guess it was removed somewhere along the way. Thanks! Shay. ---------------------------- Shay Friedman http://www.ironshay.com Follow me: http://twitter.com/ironshay -- 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 Tue Jul 14 16:42:25 2009 From: lists at ruby-forum.com (Shay Friedman) Date: Tue, 14 Jul 2009 22:42:25 +0200 Subject: [Ironruby-core] C# Overloads and IronRuby Classes Message-ID: Hi there, The next scenario worked for me on older versions but now the behavior changed and I'd like to know if the change is a bug or by design. This is my C# code: public class MyClass { public void A() { A(1); } public void A(int val) { A(val, "foo"); } public void A(int val, string str) { Console.WriteLine("{0} - {1}", val, str); } } And now in IR: class IronRubyRulez < MyClass; end test = IronRubyRulez.new test.a # Prints "1 - foo" test.a(5) # Prints "5 - foo" test.a(7, "boom") # Prints "7 - boom" So far so good... but now I'd like to override the method "a": class IronRubyRulez < MyClass def a super(12) end end test = IronRubyRulez.new test.a # Error! wrong number of arguments (2 for 0) This worked on older versions and resulted with "12 - foo". Bug or by design? Thanks! Shay. ---------------------------- Shay Friedman http://www.ironshay.com Follow me: http://twitter.com/ironshay -- Posted via http://www.ruby-forum.com/. From Tomas.Matousek at microsoft.com Tue Jul 14 16:57:48 2009 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Tue, 14 Jul 2009 13:57:48 -0700 Subject: [Ironruby-core] C# Overloads and IronRuby Classes In-Reply-To: References: Message-ID: Looks like a bug. Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shay Friedman Sent: Tuesday, July 14, 2009 1:42 PM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] C# Overloads and IronRuby Classes Hi there, The next scenario worked for me on older versions but now the behavior changed and I'd like to know if the change is a bug or by design. This is my C# code: public class MyClass { public void A() { A(1); } public void A(int val) { A(val, "foo"); } public void A(int val, string str) { Console.WriteLine("{0} - {1}", val, str); } } And now in IR: class IronRubyRulez < MyClass; end test = IronRubyRulez.new test.a # Prints "1 - foo" test.a(5) # Prints "5 - foo" test.a(7, "boom") # Prints "7 - boom" So far so good... but now I'd like to override the method "a": class IronRubyRulez < MyClass def a super(12) end end test = IronRubyRulez.new test.a # Error! wrong number of arguments (2 for 0) This worked on older versions and resulted with "12 - foo". Bug or by design? Thanks! Shay. ---------------------------- Shay Friedman http://www.ironshay.com Follow me: http://twitter.com/ironshay -- 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 Tue Jul 14 21:12:27 2009 From: lists at ruby-forum.com (Kevin Radcliffe) Date: Wed, 15 Jul 2009 03:12:27 +0200 Subject: [Ironruby-core] C# Overloads and IronRuby Classes In-Reply-To: References: Message-ID: Shay Friedman wrote: > Hi there, > ...code snipped... > This worked on older versions and resulted with "12 - foo". > Bug or by design? > Besides compiling the C# file, and requiring the resulting library, I was able to run your code without modification. Are you passing any special arguments to ir.exe when running the program? I am using the latest pre-compiled 0.6v from the codeplex site: http://ironruby.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=29640 Out of curiosity, you could try with a different method name, in case there is possibly a conflict somewhere with another "A" If the forum allows me, I'll be attaching the exact files I used from your example. Otherwise, I'll email them to you. Attachments: http://www.ruby-forum.com/attachment/3878/testlib.zip -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Wed Jul 15 02:40:20 2009 From: lists at ruby-forum.com (Shay Friedman) Date: Wed, 15 Jul 2009 08:40:20 +0200 Subject: [Ironruby-core] C# Overloads and IronRuby Classes In-Reply-To: References: Message-ID: <13553f186c9fa145b46bdd162a6c9e2b@ruby-forum.com> Well, I tried again and it now works... can't tell what was wrong the other day... Thanks for the help! Shay. -- Posted via http://www.ruby-forum.com/. From ivan at flanders.co.nz Wed Jul 15 03:24:19 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Wed, 15 Jul 2009 09:24:19 +0200 Subject: [Ironruby-core] How to run 'spec' on an individual sample ? In-Reply-To: <4a68b8cf0907141348x12b6b7aje7e2284d275c0379@mail.gmail.com> References: <4a68b8cf0907141235k6c26d28at36ad1e38ebbad9cd@mail.gmail.com> <0047ECBFA2E0DF4A834AA369282A5AFC18B3A29C@tk5ex14mbxc106.redmond.corp.microsoft.com> <4a68b8cf0907141246tdd644e7ocbf9b746cdf82cd9@mail.gmail.com> <4a68b8cf0907141348x12b6b7aje7e2284d275c0379@mail.gmail.com> Message-ID: yes you can but you have to create a different batch script. ispec.bat to use ir my_spec.rb you would alsi need to have require 'rubygems' require 'spec' in your spec_helper or something. by default require 'rubygems' isn't there. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Tue, Jul 14, 2009 at 10:48 PM, Thibaut Barr?re wrote: > What I did was added C:\ironruby\lib\IronRuby\gems\1.8\bin to my path >> variable, make sure its before the MRI path and then you can do spec >> my_spec and it will work against IR.... > > > Nifty - will try that :) > > -- Thibaut > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan at flanders.co.nz Wed Jul 15 05:15:42 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Wed, 15 Jul 2009 11:15:42 +0200 Subject: [Ironruby-core] databinding for Silverlight and/or WPF Message-ID: Hi are there .NET properties generated in the underlying CLR type when you define an attribute on a ruby class? class Photo attr_accessor :id, :title, :secret, :farm, :server end would that generate a CLR class that has those attributes as properties? Will that work in silverlight too? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) -------------- next part -------------- An HTML attachment was scrubbed... URL: From Tomas.Matousek at microsoft.com Wed Jul 15 11:29:20 2009 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Wed, 15 Jul 2009 08:29:20 -0700 Subject: [Ironruby-core] databinding for Silverlight and/or WPF In-Reply-To: References: Message-ID: No, it won?t generate CLR class unless your class implements an interface or derives from a CLR type. And even if it does attributes don?t define CLR properties. We don?t support defining CLR members on a Ruby class yet, but we should in future. Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Wednesday, July 15, 2009 2:16 AM To: ironruby-core Subject: [Ironruby-core] databinding for Silverlight and/or WPF Hi are there .NET properties generated in the underlying CLR type when you define an attribute on a ruby class? class Photo attr_accessor :id, :title, :secret, :farm, :server end would that generate a CLR class that has those attributes as properties? Will that work in silverlight too? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jimmy.Schementi at microsoft.com Wed Jul 15 12:55:52 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Wed, 15 Jul 2009 16:55:52 +0000 Subject: [Ironruby-core] databinding for Silverlight and/or WPF In-Reply-To: References: Message-ID: Though you can databind against ruby attributes on the desktop: take a look at my railsconf blogpost ... There's a section about databinding against active record. This does not work in Silverlight though. It might work in SL4 since WPF 4 has specific databinding support for dynamic objects, and that code will most likely be ported over. ~Jimmy Sent from my phone On Jul 15, 2009, at 8:30 AM, "Tomas Matousek" > wrote: No, it won?t generate CLR class unless your class implements an interface or derives from a CLR type. And even if it does attributes don?t define CLR properties. We don?t support defining CLR members on a Ruby class yet, but we should in future. Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Wednesday, July 15, 2009 2:16 AM To: ironruby-core Subject: [Ironruby-core] databinding for Silverlight and/or WPF Hi are there .NET properties generated in the underlying CLR type when you define an attribute on a ruby class? class Photo attr_accessor :id, :title, :secret, :farm, :server end would that generate a CLR class that has those attributes as properties? Will that work in silverlight too? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jimmy.Schementi at microsoft.com Wed Jul 15 12:58:09 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Wed, 15 Jul 2009 16:58:09 +0000 Subject: [Ironruby-core] Pull on Friday In-Reply-To: References: Message-ID: <0F831ED6-A2E4-441D-8116-C4D599EE449F@microsoft.com> Shri and I do (my stuff will be in master today). Welcome back :) On Jul 15, 2009, at 9:48 AM, "Jim Deville" wrote: > I?d like to do a pull on Friday, so I?d like to find out who has > code ready for it. > > > > Thanks, > > > > JD > > > > ?there is no try > > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core From suppakilla at gmail.com Wed Jul 15 14:09:42 2009 From: suppakilla at gmail.com (Daniele Alessandri) Date: Wed, 15 Jul 2009 20:09:42 +0200 Subject: [Ironruby-core] Pull on Friday In-Reply-To: References: Message-ID: <3bf20550907151109y654aa9d3n676db4089c13ecbd@mail.gmail.com> Hmmm I have only a few trivial fixes for failing specs in core/string on my local repo (I have resumed playing a bit with IronRuby just yesterday). Reviewing them would take about 15 seconds, so I was waiting for a more substantial amount of commits to push on my remote repository :) On Wed, Jul 15, 2009 at 18:46, Jim Deville wrote: > I?d like to do a pull on Friday, so I?d like to find out who has code ready > for it. > > > > Thanks, > > > > JD > > > > ?there is no try > > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > -- Daniele Alessandri http://www.clorophilla.net/blog/ http://twitter.com/JoL1hAHN From jdeville at microsoft.com Wed Jul 15 14:26:23 2009 From: jdeville at microsoft.com (Jim Deville) Date: Wed, 15 Jul 2009 18:26:23 +0000 Subject: [Ironruby-core] Pull on Friday In-Reply-To: <3bf20550907151109y654aa9d3n676db4089c13ecbd@mail.gmail.com> References: <3bf20550907151109y654aa9d3n676db4089c13ecbd@mail.gmail.com> Message-ID: Feel free to send it in. I don't mind small changes ;) JD ?there is no try > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > bounces at rubyforge.org] On Behalf Of Daniele Alessandri > Sent: Wednesday, July 15, 2009 11:10 AM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Pull on Friday > > Hmmm I have only a few trivial fixes for failing specs in core/string on my > local repo (I have resumed playing a bit with IronRuby just yesterday). > Reviewing them would take about 15 seconds, so I was waiting for a more > substantial amount of commits to push on my remote repository :) > > > On Wed, Jul 15, 2009 at 18:46, Jim Deville wrote: > > I?d like to do a pull on Friday, so I?d like to find out who has code > > ready for it. > > > > > > > > Thanks, > > > > > > > > JD > > > > > > > > ?there is no try > > > > > > > > _______________________________________________ > > Ironruby-core mailing list > > Ironruby-core at rubyforge.org > > http://rubyforge.org/mailman/listinfo/ironruby-core > > > > > > > > -- > Daniele Alessandri > http://www.clorophilla.net/blog/ > http://twitter.com/JoL1hAHN > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core From Tomas.Matousek at microsoft.com Wed Jul 15 14:37:33 2009 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Wed, 15 Jul 2009 11:37:33 -0700 Subject: [Ironruby-core] Code Review: RandAndRfc In-Reply-To: <1A472770E042064698CB5ADC83A12ACD0347806A@TK5EX14MBXC116.redmond.corp.microsoft.com> References: <1A472770E042064698CB5ADC83A12ACD0347806A@TK5EX14MBXC116.redmond.corp.microsoft.com> Message-ID: Sure. -----Original Message----- From: Dino Viehland Sent: Wednesday, July 15, 2009 11:17 AM To: Tomas Matousek; IronRuby External Code Reviewers; Rowan Code Reviewers Cc: ironruby-core at rubyforge.org Subject: RE: Code Review: RandAndRfc Could we make this an extension method on Random instead? > -----Original Message----- > From: Tomas Matousek > Sent: Wednesday, July 15, 2009 11:12 AM > To: IronRuby External Code Reviewers; Rowan Code Reviewers > Cc: ironruby-core at rubyforge.org > Subject: Code Review: RandAndRfc > > tfpt review /shelveset:RandAndRfc;REDMOND\tomat > Comment : > DLR: > Adds a simple random number generator for BigIntegers. > > Ruby: > Implements Kernel#rand, Kernel#srand. > Improves scope allocation perf. > > Tomas > From jdeville at microsoft.com Wed Jul 15 17:59:30 2009 From: jdeville at microsoft.com (Jim Deville) Date: Wed, 15 Jul 2009 21:59:30 +0000 Subject: [Ironruby-core] Code Review: bm_and_gitpushes In-Reply-To: References: Message-ID: F2F with Jimmy JD ...there is no try > -----Original Message----- > From: Jim Deville > Sent: Wednesday, July 15, 2009 2:39 PM > To: IronRuby External Code Reviewers > Cc: ironruby-core at rubyforge.org > Subject: Code Review: bm_and_gitpushes > > tfpt review "/shelveset:bm_and_gitpushes;REDMOND\jdeville" > Comment : > Combination shelveset: > modifications to the benchmarks to get a larger range of values to test > against, and to bring some of the extremely long running benchmarks under > control > > Various powershell scripts to automate git pushing: > new-rubysync.ps1: > Automates the setting up of a rubysync git/tfs enlistment. > Usage: > new-rubysync -dir /path/to/repo [-name workspacename (default > rubysync)] [-server tfsserver (default vstfdevdiv)] [-get] > > The get flag tells the script whether to do a "tf get /overwrite" after setting > up the workspace. > > merlin.psm1: > A powershell module (thus Powershell V2 only) that includes a powershell > vsvars, dev.bat and a few helper functions for the other scripts > > dev.ps1: dev.bat equivalant > > update-git.ps1: > updates the local enlistment and performs a push. Takes a powershell > command string that will get it set into the correct enlistment (for example, > the path to the Rubysync's dev.ps1 would work). > From suppakilla at gmail.com Thu Jul 16 02:54:37 2009 From: suppakilla at gmail.com (Daniele Alessandri) Date: Thu, 16 Jul 2009 08:54:37 +0200 Subject: [Ironruby-core] Pull on Friday In-Reply-To: References: <3bf20550907151109y654aa9d3n676db4089c13ecbd@mail.gmail.com> Message-ID: <3bf20550907152354m7d0dbb3fyb9ed1dfd2c22090e@mail.gmail.com> OK I'm going to push on my repository later this evening (CEST), I committed a few more things to make the push a little bit more worth it :) On Wed, Jul 15, 2009 at 20:26, Jim Deville wrote: > Feel free to send it in. I don't mind small changes ;) > > JD > > ?there is no try > >> -----Original Message----- >> From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- >> bounces at rubyforge.org] On Behalf Of Daniele Alessandri >> Sent: Wednesday, July 15, 2009 11:10 AM >> To: ironruby-core at rubyforge.org >> Subject: Re: [Ironruby-core] Pull on Friday >> >> Hmmm I have only a few trivial fixes for failing specs in core/string on my >> local repo (I have resumed playing a bit with IronRuby just yesterday). >> Reviewing them would take about 15 seconds, so I was waiting for a more >> substantial amount of commits to push on my remote repository :) >> >> >> On Wed, Jul 15, 2009 at 18:46, Jim Deville wrote: >> > I?d like to do a pull on Friday, so I?d like to find out who has code >> > ready for it. >> > >> > >> > >> > Thanks, >> > >> > >> > >> > JD >> > >> > >> > >> > ?there is no try >> > >> > >> > >> > _______________________________________________ >> > Ironruby-core mailing list >> > Ironruby-core at rubyforge.org >> > http://rubyforge.org/mailman/listinfo/ironruby-core >> > >> > >> >> >> >> -- >> Daniele Alessandri >> http://www.clorophilla.net/blog/ >> http://twitter.com/JoL1hAHN >> _______________________________________________ >> Ironruby-core mailing list >> Ironruby-core at rubyforge.org >> http://rubyforge.org/mailman/listinfo/ironruby-core > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > -- Daniele Alessandri http://www.clorophilla.net/blog/ http://twitter.com/JoL1hAHN From Jimmy.Schementi at microsoft.com Thu Jul 16 03:09:32 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Thu, 16 Jul 2009 07:09:32 +0000 Subject: [Ironruby-core] Pull on Friday In-Reply-To: <3bf20550907152354m7d0dbb3fyb9ed1dfd2c22090e@mail.gmail.com> References: <3bf20550907151109y654aa9d3n676db4089c13ecbd@mail.gmail.com> , <3bf20550907152354m7d0dbb3fyb9ed1dfd2c22090e@mail.gmail.com> Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC18B513EE@tk5ex14mbxc105.redmond.corp.microsoft.com> Make sure you pull from the main repo first, we just pushed a ton of stuff out from last week, so make sure you work with the latest first =) ________________________________________ From: ironruby-core-bounces at rubyforge.org [ironruby-core-bounces at rubyforge.org] on behalf of Daniele Alessandri [suppakilla at gmail.com] Sent: Wednesday, July 15, 2009 11:54 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Pull on Friday OK I'm going to push on my repository later this evening (CEST), I committed a few more things to make the push a little bit more worth it :) On Wed, Jul 15, 2009 at 20:26, Jim Deville wrote: > Feel free to send it in. I don't mind small changes ;) > > JD > > ?there is no try > >> -----Original Message----- >> From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- >> bounces at rubyforge.org] On Behalf Of Daniele Alessandri >> Sent: Wednesday, July 15, 2009 11:10 AM >> To: ironruby-core at rubyforge.org >> Subject: Re: [Ironruby-core] Pull on Friday >> >> Hmmm I have only a few trivial fixes for failing specs in core/string on my >> local repo (I have resumed playing a bit with IronRuby just yesterday). >> Reviewing them would take about 15 seconds, so I was waiting for a more >> substantial amount of commits to push on my remote repository :) >> >> >> On Wed, Jul 15, 2009 at 18:46, Jim Deville wrote: >> > I?d like to do a pull on Friday, so I?d like to find out who has code >> > ready for it. >> > >> > >> > >> > Thanks, >> > >> > >> > >> > JD >> > >> > >> > >> > ?there is no try >> > >> > >> > >> > _______________________________________________ >> > Ironruby-core mailing list >> > Ironruby-core at rubyforge.org >> > http://rubyforge.org/mailman/listinfo/ironruby-core >> > >> > >> >> >> >> -- >> Daniele Alessandri >> http://www.clorophilla.net/blog/ >> http://twitter.com/JoL1hAHN >> _______________________________________________ >> Ironruby-core mailing list >> Ironruby-core at rubyforge.org >> http://rubyforge.org/mailman/listinfo/ironruby-core > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > -- Daniele Alessandri http://www.clorophilla.net/blog/ http://twitter.com/JoL1hAHN _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From suppakilla at gmail.com Thu Jul 16 16:22:33 2009 From: suppakilla at gmail.com (Daniele Alessandri) Date: Thu, 16 Jul 2009 22:22:33 +0200 Subject: [Ironruby-core] Review: misc fixes to MutableStringOps.cs Message-ID: <3bf20550907161322n270fbb55ma743b4d84958cc0f@mail.gmail.com> Hi, I pushed a bunch of fixes to my repository. In the end I had to hold back a couple of more commits staged in a local branch because I'm still not convinced about them, I'll push them in the next few days for a future review. http://github.com/nrk/ironruby/commit/74c47076ab82f357e58ca604331701cae40a9b6a >From the commit message: - Implemented 'V' and 'v' directives for String#unpack. - Implemented 'B' and 'b' directives for String#unpack. - Cleared all the failing expectations in core/string related to an unthrown TypeError exception when calling in-place methods on frozen strings. The absence of 'V', 'v', 'B' and 'b' directives in String#unpack was preventing me to use the wmainfo-rb gem. See also the attached diff. Thanks, Daniele -- Daniele Alessandri http://www.clorophilla.net/blog/ http://twitter.com/JoL1hAHN -------------- next part -------------- diff --git a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/capitalize_tags.txt b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/capitalize_tags.txt deleted file mode 100644 index c2f8309..0000000 --- a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/capitalize_tags.txt +++ /dev/null @@ -1 +0,0 @@ -fails:String#capitalize! raises a TypeError when self is frozen diff --git a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/delete_tags.txt b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/delete_tags.txt deleted file mode 100644 index 1e7d568..0000000 --- a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/delete_tags.txt +++ /dev/null @@ -1 +0,0 @@ -fails:String#delete! raises a TypeError when self is frozen diff --git a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/downcase_tags.txt b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/downcase_tags.txt deleted file mode 100644 index b16d1d8..0000000 --- a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/downcase_tags.txt +++ /dev/null @@ -1 +0,0 @@ -fails:String#downcase! raises a TypeError when self is frozen diff --git a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/next_tags.txt b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/next_tags.txt deleted file mode 100644 index 1f3bca2..0000000 --- a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/next_tags.txt +++ /dev/null @@ -1 +0,0 @@ -fails:String#next! raises a TypeError if self is frozen diff --git a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/split_tags.txt b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/split_tags.txt deleted file mode 100644 index e7bf2f6..0000000 --- a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/split_tags.txt +++ /dev/null @@ -1,2 +0,0 @@ -fails:String#split with Regexp splits between characters when regexp matches a zero-length string -fails:String#split with Regexp includes all captures in the result array diff --git a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/succ_tags.txt b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/succ_tags.txt deleted file mode 100644 index d10eac2..0000000 --- a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/succ_tags.txt +++ /dev/null @@ -1 +0,0 @@ -fails:String#succ! raises a TypeError if self is frozen diff --git a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/swapcase_tags.txt b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/swapcase_tags.txt deleted file mode 100644 index 729201b..0000000 --- a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/swapcase_tags.txt +++ /dev/null @@ -1 +0,0 @@ -fails:String#swapcase! raises a TypeError when self is frozen diff --git a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/unpack_tags.txt b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/unpack_tags.txt index 2eef04f..d0ab5e9 100644 --- a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/unpack_tags.txt +++ b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/unpack_tags.txt @@ -1,16 +1,14 @@ fails:String#unpack returns an array by decoding self according to the format string fails:String#unpack with 'Z' directive returns an array by decoding self according to the format string fails:String#unpack with 'N' and 'n' directives returns an array by decoding self according to the format string -fails:String#unpack with 'V' and 'v' directives returns an array by decoding self according to the format string fails:String#unpack with 'Q' and 'q' directives returns an array in little-endian (native format) order by decoding self according to the format string fails:String#unpack with 'Q' and 'q' directives returns Bignums for big numeric values on little-endian platforms fails:String#unpack with 'Q' and 'q' directives returns Fixnums for small numeric values fails:String#unpack with 'a', 'X' and 'x' directives returns an array by decoding self according to the format string fails:String#unpack with 'DdEeFfGg' directives returns an array by decoding self according to the format string fails:String#unpack with 'DdEeFfGg' directives returns an array by decoding self in little-endian order according to the format string -fails:String#unpack with 'B' and 'b' directives returns an array by decoding self according to the format string fails:String#unpack with 'U' directive returns an array by decoding self according to the format string fails:String#unpack with '@' directive returns an array by decoding self according to the format string fails:String#unpack with 'M' directive returns an array by decoding self according to the format string fails:String#unpack with 'm' directive returns an array by decoding self according to the format string fails:String#unpack with 'w' directive produces a BER-compressed integer diff --git a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/upcase_tags.txt b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/upcase_tags.txt deleted file mode 100644 index 93de75c..0000000 --- a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/upcase_tags.txt +++ /dev/null @@ -1 +0,0 @@ -fails:String#upcase! raises a TypeError when self is frozen diff --git a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/MutableStringOps.cs b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/MutableStringOps.cs index 3878e0f..31555e5 100644 --- a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/MutableStringOps.cs +++ b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/MutableStringOps.cs @@ -54,30 +54,36 @@ namespace IronRuby.Builtins { } private static bool InExclusiveRangeNormalized(MutableString/*!*/ str, ref int index) { if (index < 0) { index = index + str.Length; } return index >= 0 && index < str.Length; } private static bool InInclusiveRangeNormalized(MutableString/*!*/ str, ref int index) { if (index < 0) { index = index + str.Length; } return index >= 0 && index <= str.Length; } + + private static void RequiresNotFrozenString(MutableString/*!*/ self) { + if (self.IsFrozen) { + throw RubyExceptions.CreateTypeError("can't modify frozen string"); + } + } // Parses interval strings that are of this form: // // abc # abc // abc-efg-h # abcdefgh // ^abc # all characters in range 0-255 except abc // \x00-0xDD # all characters in hex range public class IntervalParser { private readonly MutableString/*!*/ _range; private int _pos; private bool _rangeStarted; private int _startRange; public IntervalParser(MutableString/*!*/ range) { _range = range; @@ -838,66 +844,70 @@ namespace IronRuby.Builtins { [RubyMethod("casecmp")] public static int Casecmp(MutableString/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ other) { return Compare(DownCase(self), DownCase(other)); } [RubyMethod("capitalize")] public static MutableString/*!*/ Capitalize(MutableString/*!*/ self) { MutableString result = self.Clone(); CapitalizeMutableString(result); return result; } [RubyMethod("capitalize!")] public static MutableString CapitalizeInPlace(MutableString/*!*/ self) { + RequiresNotFrozenString(self); return CapitalizeMutableString(self) ? self : null; } [RubyMethod("downcase")] public static MutableString/*!*/ DownCase(MutableString/*!*/ self) { MutableString result = self.Clone(); DownCaseMutableString(result); return result; } [RubyMethod("downcase!")] public static MutableString DownCaseInPlace(MutableString/*!*/ self) { + RequiresNotFrozenString(self); return DownCaseMutableString(self) ? self : null; } [RubyMethod("swapcase")] public static MutableString/*!*/ SwapCase(MutableString/*!*/ self) { MutableString result = self.Clone(); SwapCaseMutableString(result); return result; } [RubyMethod("swapcase!")] public static MutableString SwapCaseInPlace(MutableString/*!*/ self) { + RequiresNotFrozenString(self); return SwapCaseMutableString(self) ? self : null; } [RubyMethod("upcase")] public static MutableString/*!*/ UpCase(MutableString/*!*/ self) { MutableString result = self.Clone(); UpCaseMutableString(result); return result; } [RubyMethod("upcase!")] public static MutableString UpCaseInPlace(MutableString/*!*/ self) { + RequiresNotFrozenString(self); return UpCaseMutableString(self) ? self : null; } #endregion #region center private static readonly MutableString _DefaultPadding = MutableString.Create(" ").Freeze(); [RubyMethod("center")] public static MutableString/*!*/ Center(MutableString/*!*/ self, [DefaultProtocol]int length, [Optional, DefaultProtocol]MutableString padding) { @@ -1736,30 +1746,32 @@ namespace IronRuby.Builtins { return self; } [RubyMethod("delete")] public static MutableString/*!*/ Delete(RubyContext/*!*/ context, MutableString/*!*/ self, [DefaultProtocol, NotNull, NotNullItems]params MutableString/*!*/[]/*!*/ strs) { if (strs.Length == 0) { throw RubyExceptions.CreateArgumentError("wrong number of arguments"); } return InternalDelete(self, strs); } [RubyMethod("delete!")] public static MutableString/*!*/ DeleteInPlace(RubyContext/*!*/ context, MutableString/*!*/ self, [DefaultProtocol, NotNull, NotNullItems]params MutableString/*!*/[]/*!*/ strs) { + RequiresNotFrozenString(self); + if (strs.Length == 0) { throw RubyExceptions.CreateArgumentError("wrong number of arguments"); } return InternalDeleteInPlace(self, strs); } #endregion #region count private static object InternalCount(MutableString/*!*/ self, MutableString[]/*!*/ ranges) { BitArray map = new RangeParser(ranges).Parse(); int count = 0; for (int i = 0; i < self.Length; i++) { if (map.Get(self.GetChar(i))) @@ -1956,30 +1968,32 @@ namespace IronRuby.Builtins { if (c == 255) { str.SetByte(index, 0); if (index > 0) { IncrementChar(str, index - 1); } else { str.Insert(0, 1); } } else { str.SetByte(index, unchecked((byte)(c + 1))); } } [RubyMethod("succ!")] [RubyMethod("next!")] public static MutableString/*!*/ SuccInPlace(MutableString/*!*/ self) { + RequiresNotFrozenString(self); + if (self.IsEmpty) { return self; } int index = GetIndexOfRightmostAlphaNumericCharacter(self, self.Length - 1); if (index == -1) { IncrementChar(self, self.Length - 1); } else { IncrementAlphaNumericChar(self, index); } return self; } [RubyMethod("succ")] @@ -2391,30 +2405,35 @@ namespace IronRuby.Builtins { self.Append(other); return self.TaintBy(other); } [RubyMethod("reverse")] public static MutableString/*!*/ GetReversed(MutableString/*!*/ self) { return self.Clone().Reverse(); } [RubyMethod("reverse!")] public static MutableString/*!*/ Reverse(MutableString/*!*/ self) { if (self.Encoding.IsKCoding) { throw new NotImplementedException("TODO: KCODE"); } + if (self.Length == 0) { + return self; + } + RequiresNotFrozenString(self); + // TODO: MRI 1.9: allows invalid characters return self.Reverse(); } #endregion #region tr, tr_s internal static MutableString/*!*/ Translate(MutableString/*!*/ src, MutableString/*!*/ from, MutableString/*!*/ to, bool inplace, bool squeeze, out bool anyCharacterMaps) { Assert.NotNull(src, from, to); if (from.IsEmpty) { anyCharacterMaps = false; @@ -2448,49 +2467,51 @@ namespace IronRuby.Builtins { } // encoding aware, TODO: KCODE [RubyMethod("tr")] public static MutableString/*!*/ GetTranslated(MutableString/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ from, [DefaultProtocol, NotNull]MutableString/*!*/ to) { bool _; return Translate(self, from, to, false, false, out _); } // encoding aware, TODO: KCODE [RubyMethod("tr!")] public static MutableString Translate(MutableString/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ from, [DefaultProtocol, NotNull]MutableString/*!*/ to) { + RequiresNotFrozenString(self); bool anyCharacterMaps; self.RequireNotFrozen(); Translate(self, from, to, true, false, out anyCharacterMaps); return anyCharacterMaps ? self : null; } // encoding aware, TODO: KCODE [RubyMethod("tr_s")] public static MutableString/*!*/ TrSqueeze(MutableString/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ from, [DefaultProtocol, NotNull]MutableString/*!*/ to) { bool _; return Translate(self, from, to, false, true, out _); } // encoding aware, TODO: KCODE [RubyMethod("tr_s!")] public static MutableString TrSqueezeInPlace(MutableString/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ from, [DefaultProtocol, NotNull]MutableString/*!*/ to) { + RequiresNotFrozenString(self); bool anyCharacterMaps; self.RequireNotFrozen(); Translate(self, from, to, true, true, out anyCharacterMaps); return anyCharacterMaps ? self : null; } #endregion #region ljust [RubyMethod("ljust")] public static MutableString/*!*/ LeftJustify(MutableString/*!*/ self, [DefaultProtocol]int width) { // TODO: is this correct? Is it just a space or is this some configurable whitespace thing? return LeftJustify(self, width, _DefaultPadding); @@ -2612,30 +2633,65 @@ namespace IronRuby.Builtins { } buffer = reader.ReadBytes(count); str = MutableString.CreateBinary(buffer); if (directive.Directive == 'A') { // TODO: efficiency? for (int pos = count - 1; pos >= 0; pos--) { if (buffer[pos] != 0 && buffer[pos] != 0x20) { break; } str.Remove(pos, 1); } } result.Add(str); break; + case 'B': + case 'b': + if (stream.Length - stream.Position != 0) { + count = directive.Count.HasValue ? directive.Count.Value : (int)(stream.Length - stream.Position) * 8; + buffer = reader.ReadBytes((int)Math.Ceiling((double)count / 8)); + if (count > buffer.Length * 8) { + count = buffer.Length * 8; + } + str = MutableString.CreateBinary(count); + + if ((directive.Directive == 'B' && BitConverter.IsLittleEndian) || (directive.Directive == 'b' && !BitConverter.IsLittleEndian)) { + for (int i = 0; i < buffer.Length; i++) { + byte b = buffer[i]; + int r = (b >> 4) | ((b & 0x0F) << 4); + r = ((r & 0xCC) >> 2) | ((r & 0x33) << 2); + r = ((r & 0xAA) >> 1) | ((r & 0x55) << 1); + buffer[i] = (byte)r; + } + } + + for (int b = 0, i = 0; b < count; b++) { + if (b == 8) { + i++; + b = 0; + count -= 8; + } + str.Append(((buffer[i] & (1 << b)) != 0 ? '1' : '0')); + } + } + else { + str = MutableString.CreateEmpty(); + } + result.Add(str); + break; + case 'Z': maxCount = (int)(stream.Length - stream.Position); count = directive.Count.HasValue ? directive.Count.Value : maxCount; if (count > maxCount) { count = maxCount; } buffer = reader.ReadBytes(count); str = MutableString.CreateBinary(buffer); for (int pos = 0; pos < count; pos++) { if (buffer[pos] == 0) { str.Remove(pos, count - pos); break; } } result.Add(str); @@ -2664,30 +2720,61 @@ namespace IronRuby.Builtins { break; case 'I': case 'L': count = CalculateCounts(stream, directive.Count, sizeof(uint), out nilCount); for (int j = 0; j < count; j++) { uint value = reader.ReadUInt32(); if (value <= Int32.MaxValue) { result.Add((int)value); } else { result.Add((BigInteger)value); } } break; + case 'v': + count = CalculateCounts(stream, directive.Count, sizeof(ushort), out nilCount); + for (int j = 0; j < count; j++) { + ushort value = reader.ReadUInt16(); + if (!BitConverter.IsLittleEndian) { + value = (ushort)(0x00FF & (value >> 8) | + 0xFF00 & (value << 8)); + } + result.Add((int)value); + } + break; + + case 'V': + count = CalculateCounts(stream, directive.Count, sizeof(uint), out nilCount); + for (int j = 0; j < count; j++) { + uint value = reader.ReadUInt32(); + if (!BitConverter.IsLittleEndian) { + value = (0x000000FF & (value >> 24) | + 0x0000FF00 & (value >> 8) | + 0x00FF0000 & (value << 8) | + 0xFF000000 & (value << 24)); + } + if (value <= Int32.MaxValue) { + result.Add((int)value); + } + else { + result.Add((BigInteger)value); + } + } + break; + case 'm': // TODO: Recognize "==" as end of base 64 encoding int len = (int)(stream.Length - stream.Position); char[] base64 = reader.ReadChars(len); byte[] data = Convert.FromBase64CharArray(base64, 0, len); result.Add(MutableString.CreateBinary(data)); break; case 's': count = CalculateCounts(stream, directive.Count, sizeof(short), out nilCount); for (int j = 0; j < count; j++) { result.Add((int)reader.ReadInt16()); } break; From Jimmy.Schementi at microsoft.com Thu Jul 16 16:56:24 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Thu, 16 Jul 2009 20:56:24 +0000 Subject: [Ironruby-core] [Code Review] IronRuby Tutorial in Silverlight Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC18B52D0B@tk5ex14mbxc105.redmond.corp.microsoft.com> Get's the IronRuby tutorial working in Silverlight. It currently starts and works through the beginnings of the tutorials. Formatted text isn't there yet, scrolling is a little wonkey (including scroll wheel doesn't work), there are some alignment issue, and not all the tutorial content works in Silverlight for good reasons (WinForms, WPF, FileSystemWatcher, etc) and not so good reasons (thread doesn't work simply because I didn't copy the thread library, for example). Also the SL version loads completely different XAML files than the desktop; they will be merged shorly. Notable Ruby and SL changes: - http://github.com/jschementi/ironruby/commit/ffef26a418310ace70af782b0fd51d4900344da4#diff-5 o Merlin/Main/Languages/Ruby/Ruby/Builtins/RubyEncoding.cs - comparing System.Text.UTF8Encoding to itself in Silverlight fails. Compare to ToString instead (maybe better to compare the WebName, but this works for now) - http://github.com/jschementi/ironruby/commit/ffef26a418310ace70af782b0fd51d4900344da4#diff-1 o Merlin/Main/Hosts/SilverLight/Microsoft.Scripting.SilverLight/BrowserVirtualFilesystem.cs - Make BrowserVirtualFilesytem.NormalizePath virtual so children can override it - http://github.com/jschementi/ironruby/commit/ffef26a418310ace70af782b0fd51d4900344da4#diff-2 o Merlin/Main/Hosts/SilverLight/Microsoft.Scripting.SilverLight/DynamicEngine.cs - Make sure console is loaded after the ScriptEngine And here are the actual commit-diffs: - http://github.com/jschementi/ironruby/commit/51563a0a4b54f3c2cddb29b8f989e1fc61e9db3b o Default to Segoe UI in Silverlight, so fonts look closer to desktop. Fix newline/whitespace in SL. - http://github.com/jschementi/ironruby/commit/4266772b1c098d5f5f875b2c6aa0b1314e16927f o Ignore IronRuby.Tests.VS bin folder - http://github.com/jschementi/ironruby/commit/ffef26a418310ace70af782b0fd51d4900344da4 o first crack at the ironruby tutorial in Silverlight: - design/TutorialSL ... needs to be merged with original - scripts for launching sl and wpf versions - refactor wpf_tutorial.rb into gui_tutorial.rb, and then wpf_tutorial.rb and sl_tutorial.rb launch in the respective technology - various tweaks to get SL working -- but doesn't have rich text yet - adds erb.rb and stringio.rb to Libs so SL can get them. - Tweak Chiron so it won't copy binaries to testsuites dir if not present - Tweak to RubyEncoding to utf-8 works in SL - Make sure console is loaded after the ScriptEngine - Make BrowserVirtualFilesytem.NormalizePath virtual so children can override it - http://github.com/jschementi/ironruby/commit/de4dd18760df2d4f3f41b326449fcf605ab1bde3 o Build Silverlight.sln aliases (bsd/bsr), get Chiron building, and remove JS/TestConsoleHost from Silverlight.sln From Shri.Borde at microsoft.com Thu Jul 16 17:25:56 2009 From: Shri.Borde at microsoft.com (Shri Borde) Date: Thu, 16 Jul 2009 14:25:56 -0700 Subject: [Ironruby-core] Review: misc fixes to MutableStringOps.cs In-Reply-To: <3bf20550907161322n270fbb55ma743b4d84958cc0f@mail.gmail.com> References: <3bf20550907161322n270fbb55ma743b4d84958cc0f@mail.gmail.com> Message-ID: <9A92D7D99FC1564D8C8F18008B08098F499CAF084C@NA-EXMSG-C118.redmond.corp.microsoft.com> Could you update BlockReplaceInPlace in MutableStrinOps.cs to also use RequiresNotFrozenString? Otherwise looks good! -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Daniele Alessandri Sent: Thursday, July 16, 2009 1:23 PM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] Review: misc fixes to MutableStringOps.cs Hi, I pushed a bunch of fixes to my repository. In the end I had to hold back a couple of more commits staged in a local branch because I'm still not convinced about them, I'll push them in the next few days for a future review. http://github.com/nrk/ironruby/commit/74c47076ab82f357e58ca604331701cae40a9b6a >From the commit message: - Implemented 'V' and 'v' directives for String#unpack. - Implemented 'B' and 'b' directives for String#unpack. - Cleared all the failing expectations in core/string related to an unthrown TypeError exception when calling in-place methods on frozen strings. The absence of 'V', 'v', 'B' and 'b' directives in String#unpack was preventing me to use the wmainfo-rb gem. See also the attached diff. Thanks, Daniele -- Daniele Alessandri http://www.clorophilla.net/blog/ http://twitter.com/JoL1hAHN From suppakilla at gmail.com Thu Jul 16 17:38:56 2009 From: suppakilla at gmail.com (Daniele Alessandri) Date: Thu, 16 Jul 2009 23:38:56 +0200 Subject: [Ironruby-core] Review: misc fixes to MutableStringOps.cs In-Reply-To: <9A92D7D99FC1564D8C8F18008B08098F499CAF084C@NA-EXMSG-C118.redmond.corp.microsoft.com> References: <3bf20550907161322n270fbb55ma743b4d84958cc0f@mail.gmail.com> <9A92D7D99FC1564D8C8F18008B08098F499CAF084C@NA-EXMSG-C118.redmond.corp.microsoft.com> Message-ID: <3bf20550907161438n2737806k1b8972e1532de503@mail.gmail.com> On Thu, Jul 16, 2009 at 23:25, Shri Borde wrote: > Could you update BlockReplaceInPlace in MutableStrinOps.cs to also use RequiresNotFrozenString? BlockReplaceInPlace seems correct as is to me, String#gsub! raises a RuntimeError instead of a TypeError when self is frozen. -- Daniele Alessandri http://www.clorophilla.net/blog/ http://twitter.com/JoL1hAHN From Shri.Borde at microsoft.com Thu Jul 16 17:42:22 2009 From: Shri.Borde at microsoft.com (Shri Borde) Date: Thu, 16 Jul 2009 14:42:22 -0700 Subject: [Ironruby-core] Review: misc fixes to MutableStringOps.cs In-Reply-To: <3bf20550907161438n2737806k1b8972e1532de503@mail.gmail.com> References: <3bf20550907161322n270fbb55ma743b4d84958cc0f@mail.gmail.com> <9A92D7D99FC1564D8C8F18008B08098F499CAF084C@NA-EXMSG-C118.redmond.corp.microsoft.com> <3bf20550907161438n2737806k1b8972e1532de503@mail.gmail.com> Message-ID: <9A92D7D99FC1564D8C8F18008B08098F499CAF0873@NA-EXMSG-C118.redmond.corp.microsoft.com> I see. OK then. -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Daniele Alessandri Sent: Thursday, July 16, 2009 2:39 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Review: misc fixes to MutableStringOps.cs On Thu, Jul 16, 2009 at 23:25, Shri Borde wrote: > Could you update BlockReplaceInPlace in MutableStrinOps.cs to also use RequiresNotFrozenString? BlockReplaceInPlace seems correct as is to me, String#gsub! raises a RuntimeError instead of a TypeError when self is frozen. -- Daniele Alessandri http://www.clorophilla.net/blog/ http://twitter.com/JoL1hAHN _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From Tomas.Matousek at microsoft.com Thu Jul 16 18:02:25 2009 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Thu, 16 Jul 2009 15:02:25 -0700 Subject: [Ironruby-core] Review: misc fixes to MutableStringOps.cs In-Reply-To: <9A92D7D99FC1564D8C8F18008B08098F499CAF0873@NA-EXMSG-C118.redmond.corp.microsoft.com> References: <3bf20550907161322n270fbb55ma743b4d84958cc0f@mail.gmail.com> <9A92D7D99FC1564D8C8F18008B08098F499CAF084C@NA-EXMSG-C118.redmond.corp.microsoft.com> <3bf20550907161438n2737806k1b8972e1532de503@mail.gmail.com> <9A92D7D99FC1564D8C8F18008B08098F499CAF0873@NA-EXMSG-C118.redmond.corp.microsoft.com> Message-ID: MutableString already has RequireNotFrozen method. You don't need to add it to MutableStringOps. There already is a check in Translate and TrSequezeInPlace: self.RequireNotFrozen(); Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shri Borde Sent: Thursday, July 16, 2009 2:42 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Review: misc fixes to MutableStringOps.cs I see. OK then. -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Daniele Alessandri Sent: Thursday, July 16, 2009 2:39 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Review: misc fixes to MutableStringOps.cs On Thu, Jul 16, 2009 at 23:25, Shri Borde wrote: > Could you update BlockReplaceInPlace in MutableStrinOps.cs to also use RequiresNotFrozenString? BlockReplaceInPlace seems correct as is to me, String#gsub! raises a RuntimeError instead of a TypeError when self is frozen. -- Daniele Alessandri http://www.clorophilla.net/blog/ http://twitter.com/JoL1hAHN _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From suppakilla at gmail.com Thu Jul 16 18:49:03 2009 From: suppakilla at gmail.com (Daniele Alessandri) Date: Fri, 17 Jul 2009 00:49:03 +0200 Subject: [Ironruby-core] Review: misc fixes to MutableStringOps.cs In-Reply-To: References: <3bf20550907161322n270fbb55ma743b4d84958cc0f@mail.gmail.com> <9A92D7D99FC1564D8C8F18008B08098F499CAF084C@NA-EXMSG-C118.redmond.corp.microsoft.com> <3bf20550907161438n2737806k1b8972e1532de503@mail.gmail.com> <9A92D7D99FC1564D8C8F18008B08098F499CAF0873@NA-EXMSG-C118.redmond.corp.microsoft.com> Message-ID: <3bf20550907161549k5771a725o2967842ed345de41@mail.gmail.com> I was really starting to feel completely stupid, but then I discovered that MutableString.RequireNotFrozen (and that self.RequireNotFrozen() line in MutableString.Translate / MutableString.TrSequezeInPlace) "appeared" on github after the latest push. I just blindly applied the same changes that I had prepared the day before without noticing this. Now I'm relieved: I am only partially stupid ;-) Anyway I pushed a fix and rebased everything into a single commit. http://github.com/nrk/ironruby/commit/6f32be3294cbd4a814066d08a30b51f4f6ea5c3a Thanks, Daniele On Fri, Jul 17, 2009 at 00:02, Tomas Matousek wrote: > MutableString already has RequireNotFrozen method. You don't need to add it to MutableStringOps. > > There already is a check in Translate and TrSequezeInPlace: self.RequireNotFrozen(); > > Tomas > > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shri Borde > Sent: Thursday, July 16, 2009 2:42 PM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Review: misc fixes to MutableStringOps.cs > > I see. OK then. > > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Daniele Alessandri > Sent: Thursday, July 16, 2009 2:39 PM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Review: misc fixes to MutableStringOps.cs > > On Thu, Jul 16, 2009 at 23:25, Shri Borde wrote: > >> Could you update BlockReplaceInPlace in MutableStrinOps.cs to also use RequiresNotFrozenString? > > BlockReplaceInPlace seems correct as is to me, String#gsub! raises a RuntimeError instead of a TypeError when self is frozen. > > -- > Daniele Alessandri > http://www.clorophilla.net/blog/ > http://twitter.com/JoL1hAHN > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > -- Daniele Alessandri http://www.clorophilla.net/blog/ http://twitter.com/JoL1hAHN From lists at ruby-forum.com Sat Jul 18 12:12:25 2009 From: lists at ruby-forum.com (Shay Friedman) Date: Sat, 18 Jul 2009 18:12:25 +0200 Subject: [Ironruby-core] Data Binding to IronRuby Objects in WPF Message-ID: <92060bc2f2b10496da743f5e82f2e83f@ruby-forum.com> Hi there, I'm trying to databind IronRuby objects to a WPF listbox with no success My data is a Ruby array of objects. The array seems to be bound fine as I see the expected number of rows in the listbox. However, every object within the array fails to bind correctly. I tried the object to be a Ruby hash or a custom class without success? WPF wouldn't display the correct value. When I tried to create an array of CLR classes, it worked. Will it work in the future? Thanks, Shay. ---------------------------- Shay Friedman http://www.IronShay.com Follow me: http://twitter.com/ironshay -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Sat Jul 18 13:17:18 2009 From: lists at ruby-forum.com (Kevin Radcliffe) Date: Sat, 18 Jul 2009 19:17:18 +0200 Subject: [Ironruby-core] Why some mailing list items aren't showing up in forum? Message-ID: <0a4872249b4e78473818be919cbc503b@ruby-forum.com> I usually use the IronRuby forum interface (I find it easier to browse through): http://www.ruby-forum.com/forum/34 But I just noticed today that there are a number of items that are ONLY showing up in the normal mailing list/archive: http://rubyforge.org/pipermail/ironruby-core/2009-July/thread.html Any ideas on why this is occurring/if it was already a known issue? I just thought the mailing list traffic was slow lately. For now, I'll check the mailing list archive only, thanks. -- Posted via http://www.ruby-forum.com/. From ryan.riley at panesofglass.org Sat Jul 18 18:30:44 2009 From: ryan.riley at panesofglass.org (Ryan Riley) Date: Sat, 18 Jul 2009 17:30:44 -0500 Subject: [Ironruby-core] Data Binding to IronRuby Objects in WPF In-Reply-To: <92060bc2f2b10496da743f5e82f2e83f@ruby-forum.com> References: <92060bc2f2b10496da743f5e82f2e83f@ruby-forum.com> Message-ID: I believe this will work in WPF 4.0, but it doesn't work now. WPF 4.0 is supposed to support dynamic objects. I seem to recall Jimmy or Harry (DevHawk) noting this somewhere. Sent from my iPhone On Jul 18, 2009, at 11:12 AM, Shay Friedman wrote: > Hi there, > > I'm trying to databind IronRuby objects to a WPF listbox with no > success > > My data is a Ruby array of objects. The array seems to be bound fine > as > I see the expected number of rows in the listbox. However, every > object > within the array fails to bind correctly. I tried the object to be a > Ruby hash or a custom class without success? WPF wouldn't display t > he > correct value. > > When I tried to create an array of CLR classes, it worked. > > Will it work in the future? > > Thanks, > Shay. > > ---------------------------- > Shay Friedman > http://www.IronShay.com > Follow me: http://twitter.com/ironshay > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core From suppakilla at gmail.com Sun Jul 19 05:29:06 2009 From: suppakilla at gmail.com (Daniele Alessandri) Date: Sun, 19 Jul 2009 11:29:06 +0200 Subject: [Ironruby-core] Code review: String#unpack, Bignum and Array related stuff Message-ID: <3bf20550907190229u7cbac619rd4cd6327ef1bc080@mail.gmail.com> Hi first of all I am trying a different approach to submitting my patches: I created a code_review branch on my repository in which I am going to push all my fixes for review. Fixes that will pass review will be rebased (not merged) in my main branch (ready to get pulled into the ironruby repository), the others will remain staged in my code_review branch for further works until they are "approved". I am just experimenting a different git workflow :-) Anyway, let's move on to the new commits: * http://github.com/nrk/ironruby/commit/48a4a02b5b47d61f2f7a3f3887ea4bf02d63edb4 - More fixes for String#unpack: o Fixed errors when unpacking data with 'Z' and '@' directives o Implemented 'Q' and 'q' directives * http://github.com/nrk/ironruby/commit/17b5edab64967b0200370edf6657321a0f79953d - Array related fixes: o Array#== does not call #to_ary on its argument but it calls #to_a (it basically performs a conversion of the argument rather than casting it to a ruby array) o Array#zip calls #to_ary to cast the argument to an Array, therefore it overrides Enumerable#zip in which the argument is converted by calling #to_a. * http://github.com/nrk/ironruby/commit/547d810c78b38afc34e728855ab7d0c20f499719 - Bignum related fixes: o Changed the signature for ClrBigInteger.ToString(self,radix), now Bignum#to_s works as expected raising an ArgumentException if base is less than 2 or higher than 36. o Fixed Bignum#divmod, Bignum#remainder, Bignum#% and Bignum#modulo to work with Float values as argument. o Fixed Bignum#/ and Bignum#div as they behave differently with each other when Float values are passed as argument. Note: Now bignum does not fail any of the expectations in core/bignum. See also the attached diff. Thanks, Daniele -- Daniele Alessandri http://www.clorophilla.net/blog/ http://twitter.com/JoL1hAHN -------------- next part -------------- diff --git a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/array/equal_value_tags.txt b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/array/equal_value_tags.txt index bf03ad0..17d97a5 100644 --- a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/array/equal_value_tags.txt +++ b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/array/equal_value_tags.txt @@ -1,2 +1 @@ fails:Array#== returns true if corresponding elements are #== -fails:Array#== does not call #to_ary on its argument diff --git a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/array/zip_tags.txt b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/array/zip_tags.txt deleted file mode 100644 index f863d32..0000000 --- a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/array/zip_tags.txt +++ /dev/null @@ -1 +0,0 @@ -fails:Array#zip calls #to_ary to convert the argument to an Array diff --git a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/bignum/div_tags.txt b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/bignum/div_tags.txt deleted file mode 100644 index a4b2900..0000000 --- a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/bignum/div_tags.txt +++ /dev/null @@ -1,2 +0,0 @@ -fails:Bignum#div returns a result of integer division of self by a float argument -fails:Bignum#div raises FloatDomainError if the argument is a float zero diff --git a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/bignum/divmod_tags.txt b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/bignum/divmod_tags.txt deleted file mode 100644 index f8a72c1..0000000 --- a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/bignum/divmod_tags.txt +++ /dev/null @@ -1 +0,0 @@ -fails:Bignum#divmod returns an Array containing quotient and modulus obtained from dividing self by the given argument diff --git a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/bignum/modulo_tags.txt b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/bignum/modulo_tags.txt deleted file mode 100644 index d64c330..0000000 --- a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/bignum/modulo_tags.txt +++ /dev/null @@ -1,2 +0,0 @@ -fails:Bignum#% returns the modulus obtained from dividing self by the given argument -fails:Bignum#modulo returns the modulus obtained from dividing self by the given argument diff --git a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/bignum/remainder_tags.txt b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/bignum/remainder_tags.txt deleted file mode 100644 index 0867179..0000000 --- a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/bignum/remainder_tags.txt +++ /dev/null @@ -1 +0,0 @@ -fails:Bignum#remainder returns the remainder of dividing self by other diff --git a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/bignum/to_s_tags.txt b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/bignum/to_s_tags.txt deleted file mode 100644 index d14bd59..0000000 --- a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/bignum/to_s_tags.txt +++ /dev/null @@ -1 +0,0 @@ -fails:Bignum#to_s when given a base raises an ArgumentError if the base is less than 2 or higher than 36 diff --git a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/unpack_tags.txt b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/unpack_tags.txt index d0ab5e9..0e5968d 100644 --- a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/unpack_tags.txt +++ b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/string/unpack_tags.txt @@ -1,14 +1,9 @@ fails:String#unpack returns an array by decoding self according to the format string -fails:String#unpack with 'Z' directive returns an array by decoding self according to the format string fails:String#unpack with 'N' and 'n' directives returns an array by decoding self according to the format string -fails:String#unpack with 'Q' and 'q' directives returns an array in little-endian (native format) order by decoding self according to the format string -fails:String#unpack with 'Q' and 'q' directives returns Bignums for big numeric values on little-endian platforms -fails:String#unpack with 'Q' and 'q' directives returns Fixnums for small numeric values fails:String#unpack with 'a', 'X' and 'x' directives returns an array by decoding self according to the format string fails:String#unpack with 'DdEeFfGg' directives returns an array by decoding self according to the format string fails:String#unpack with 'DdEeFfGg' directives returns an array by decoding self in little-endian order according to the format string fails:String#unpack with 'U' directive returns an array by decoding self according to the format string -fails:String#unpack with '@' directive returns an array by decoding self according to the format string fails:String#unpack with 'M' directive returns an array by decoding self according to the format string fails:String#unpack with 'm' directive returns an array by decoding self according to the format string fails:String#unpack with 'w' directive produces a BER-compressed integer diff --git a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ArrayOps.cs b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ArrayOps.cs index e2c3ee9..5f1c44c 100644 --- a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ArrayOps.cs +++ b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ArrayOps.cs @@ -215,34 +215,45 @@ namespace IronRuby.Builtins { if (!_native.TryGetValue(c, out tmp)) { throw RubyExceptions.CreateArgumentError("'_' allowed only after types sSiIlL"); } c = tmp; i++; c2 = (i < format.Length) ? format[i] : '\0'; } if (Char.IsDigit(c2)) { int pos1 = i; i++; while (i < format.Length && Char.IsDigit(format[i])) { i++; } count = Int32.Parse(format.Substring(pos1, (i - pos1))); i--; + } else if (c == '@' && c2 == '-') { + int pos1 = i; + i += 2; + while (i < format.Length && Char.IsDigit(format[i])) { + i++; + } + count = Int32.Parse(format.Substring(pos1, (i - pos1))); + i--; } else if (c2 == '*') { count = null; } else { i--; + if (c == '@') { + count = 0; + } } yield return new FormatDirective(c, count); } } } #endregion #region pack [RubyMethod("pack")] public static MutableString/*!*/ Pack( ConversionStorage/*!*/ integerConversion, ConversionStorage/*!*/ stringCast, diff --git a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/MutableStringOps.cs b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/MutableStringOps.cs index 06cec4b..c420cb8 100644 --- a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/MutableStringOps.cs +++ b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/MutableStringOps.cs @@ -2601,31 +2601,39 @@ namespace IronRuby.Builtins { } } [RubyMethod("unpack")] public static RubyArray/*!*/ Unpack(RubyContext/*!*/ context, MutableString/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ format) { RubyArray result = new RubyArray(1 + self.Length / 2); using (MutableStringStream stream = new MutableStringStream(self)) { BinaryReader reader = new BinaryReader(stream); foreach (ArrayOps.FormatDirective directive in ArrayOps.FormatDirective.Enumerate(format.ToString())) { int count, maxCount; byte[] buffer; MutableString str; int nilCount = 0; switch (directive.Directive) { case '@': - stream.Position = directive.Count.HasValue ? directive.Count.Value : stream.Position; + if (directive.Count.HasValue) { + if (directive.Count.Value > stream.Length) { + throw RubyExceptions.CreateArgumentError("@ outside of string"); + } + stream.Position = directive.Count.Value > 0 ? directive.Count.Value : 0; + } + else { + stream.Position = stream.Length; + } break; case 'A': case 'a': maxCount = (int)(stream.Length - stream.Position); count = directive.Count.HasValue ? directive.Count.Value : maxCount; if (count > maxCount) { count = maxCount; } buffer = reader.ReadBytes(count); str = MutableString.CreateBinary(buffer); if (directive.Directive == 'A') { // TODO: efficiency? for (int pos = count - 1; pos >= 0; pos--) { if (buffer[pos] != 0 && buffer[pos] != 0x20) { @@ -2671,30 +2679,33 @@ namespace IronRuby.Builtins { } result.Add(str); break; case 'Z': maxCount = (int)(stream.Length - stream.Position); count = directive.Count.HasValue ? directive.Count.Value : maxCount; if (count > maxCount) { count = maxCount; } buffer = reader.ReadBytes(count); str = MutableString.CreateBinary(buffer); for (int pos = 0; pos < count; pos++) { if (buffer[pos] == 0) { str.Remove(pos, count - pos); + if (!directive.Count.HasValue) { + stream.Seek(pos - count + 1, SeekOrigin.End); + } break; } } result.Add(str); break; case 'c': count = CalculateCounts(stream, directive.Count, sizeof(sbyte), out nilCount); for (int j = 0; j < count; j++) { result.Add((int)reader.ReadSByte()); } break; case 'C': count = CalculateCounts(stream, directive.Count, sizeof(byte), out nilCount); @@ -2743,30 +2754,79 @@ namespace IronRuby.Builtins { if (!BitConverter.IsLittleEndian) { value = (0x000000FF & (value >> 24) | 0x0000FF00 & (value >> 8) | 0x00FF0000 & (value << 8) | 0xFF000000 & (value << 24)); } if (value <= Int32.MaxValue) { result.Add((int)value); } else { result.Add((BigInteger)value); } } break; + case 'q': + count = CalculateCounts(stream, directive.Count, sizeof(long), out nilCount); + for (int j = 0; j < count; j++) { + long value = reader.ReadInt64(); + if (!BitConverter.IsLittleEndian) { + ulong uvalue = (ulong)value; + uvalue = (0x00000000000000FF & (uvalue >> 56)) | + (0x000000000000FF00 & (uvalue >> 40)) | + (0x0000000000FF0000 & (uvalue >> 24)) | + (0x00000000FF000000 & (uvalue >> 8)) | + (0x000000FF00000000 & (uvalue << 8)) | + (0x0000FF0000000000 & (uvalue << 24)) | + (0x00FF000000000000 & (uvalue << 40)) | + (0xFF00000000000000 & (uvalue << 56)); + value = (long)uvalue; + } + if (value <= Int32.MaxValue && value >= Int32.MinValue) { + result.Add((int)value); + } + else { + result.Add((BigInteger)value); + } + } + break; + + case 'Q': + count = CalculateCounts(stream, directive.Count, sizeof(ulong), out nilCount); + nilCount = 0; + for (int j = 0; j < count; j++) { + ulong value = reader.ReadUInt64(); + if (!BitConverter.IsLittleEndian) { + value = (0xFF00000000000000 & (value << 56)) | + (0x00FF000000000000 & (value >> 40)) | + (0x0000FF0000000000 & (value >> 24)) | + (0x000000FF00000000 & (value >> 8)) | + (0x00000000FF000000 & (value << 8)) | + (0x0000000000FF0000 & (value << 24)) | + (0x000000000000FF00 & (value << 40)) | + (0x00000000000000FF & (value << 56)); + } + if (value <= Int32.MaxValue) { + result.Add((int)value); + } + else { + result.Add((BigInteger)value); + } + } + break; + case 'm': // TODO: Recognize "==" as end of base 64 encoding int len = (int)(stream.Length - stream.Position); char[] base64 = reader.ReadChars(len); byte[] data = Convert.FromBase64CharArray(base64, 0, len); result.Add(MutableString.CreateBinary(data)); break; case 's': count = CalculateCounts(stream, directive.Count, sizeof(short), out nilCount); for (int j = 0; j < count; j++) { result.Add((int)reader.ReadInt16()); } break; diff --git a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/ClrBigInteger.cs b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/ClrBigInteger.cs index 25a9fee..e1f5069 100644 --- a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/ClrBigInteger.cs +++ b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/ClrBigInteger.cs @@ -160,36 +160,45 @@ namespace IronRuby.Builtins { /// /// Divides self by other, where other is Bignum or Fixnum /// /// self / other /// Uses DivMod to do the division (directly). Normalizes to a Fixnum if necessary [RubyMethod("/"), RubyMethod("div")] public static object Divide(BigInteger/*!*/ self, [NotNull]BigInteger/*!*/ other) { return DivMod(self, other)[0]; } /// /// Divides self by other, where other is Float /// /// self / other as Float - [RubyMethod("/"), RubyMethod("div")] - public static object Divide(BigInteger/*!*/ self, double other) { + [RubyMethod("/")] + public static object DivideOp(BigInteger/*!*/ self, double other) { return self.ToFloat64() / other; } /// + /// Divides self by other, where other is Float + /// + /// self divided by other as Float + [RubyMethod("div")] + public static object Divide(BigInteger/*!*/ self, double other) { + return DivMod(self, other)[0]; + } + + /// /// Divides self by other, where other is not a Float, Fixnum or Bignum /// /// self / other /// Coerces self and other using other.coerce(self) then dynamically invokes / [RubyMethod("/")] public static object Divide(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, object/*!*/ self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "/", self, other); } /// /// Divides self by other, where other is not a Float, Fixnum or Bignum /// /// self.div(other) /// Coerces self and other using other.coerce(self) then dynamically invokes div [RubyMethod("div")] @@ -288,30 +297,44 @@ namespace IronRuby.Builtins { #region modulo, % /// /// Returns self modulo other, where other is Fixnum or Bignum. /// /// self modulo other, as Fixnum or Bignum /// Calls divmod directly to get the modulus. [RubyMethod("%"), RubyMethod("modulo")] public static object Modulo(BigInteger/*!*/ self, [NotNull]BigInteger/*!*/ other) { RubyArray result = DivMod(self, other); return result[1]; } /// + /// Returns self modulo other, where other is Float. + /// + /// self modulo other, as Float + /// Calls divmod directly to get the modulus. + [RubyMethod("%"), RubyMethod("modulo")] + public static object Modulo(BigInteger/*!*/ self, double other) { + if (other == 0.0) { + return Double.NaN; + } + RubyArray result = DivMod(self, other); + return result[1]; + } + + /// /// Returns self % other, where other is not Fixnum or Bignum. /// /// self % other, as Fixnum or Bignum /// Coerces self and other using other.coerce(self) then dynamically invokes % [RubyMethod("%")] public static object ModuloOp(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, object/*!*/ self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "%", self, other); } /// /// Returns self modulo other, where other is not Fixnum or Bignum. /// /// self modulo other, as Fixnum or Bignum /// Coerces self and other using other.coerce(self) then dynamically invokes modulo [RubyMethod("modulo")] @@ -331,30 +354,51 @@ namespace IronRuby.Builtins { /// /// [self div other, self modulo other] as RubyArray /// Normalizes div and mod to Fixnum as necessary [RubyMethod("divmod")] public static RubyArray DivMod(BigInteger/*!*/ self, [NotNull]BigInteger/*!*/ other) { BigInteger mod; BigInteger div = BigInteger.DivRem(self, other, out mod); if (self.Sign != other.Sign && !mod.IsZero()) { div = div - 1; mod = mod + other; } return RubyOps.MakeArray2(Protocols.Normalize(div), Protocols.Normalize(mod)); } /// + /// Returns an array containing the quotient and modulus obtained by dividing self by other, where other is Float. + /// If q, r = x.divmod(y), then + /// q = floor(float(x)/float(y)) + /// x = q*y + r + /// + /// [self div other, self modulo other] as RubyArray + /// Normalizes div to Fixnum as necessary + [RubyMethod("divmod")] + public static RubyArray DivMod(BigInteger/*!*/ self, double other) { + if (other == 0.0) { + throw new FloatDomainError("NaN"); + } + + double selfFloat = self.ToFloat64(); + BigInteger div = BigInteger.Create(selfFloat / other); + double mod = selfFloat % other; + + return RubyOps.MakeArray2(Protocols.Normalize(div), mod); + } + + /// /// Returns an array containing the quotient and modulus obtained by dividing self by other, where other is not Fixnum or Bignum. /// If q, r = x.divmod(y), then /// q = floor(float(x)/float(y)) /// x = q*y + r /// /// Should return [self div other, self modulo other], but the divmod implementation is free to return an arbitrary object. /// Coerces self and other using other.coerce(self) then dynamically invokes divmod [RubyMethod("divmod")] public static object DivMod(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, object/*!*/ self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "divmod", self, other); } #endregion #region remainder @@ -362,36 +406,48 @@ namespace IronRuby.Builtins { /// /// Returns the remainder after dividing self by other, where other is Fixnum or Bignum. /// /// /// -1234567890987654321.remainder(13731) #=> -6966 /// /// Fixnum or Bignum [RubyMethod("remainder")] public static object Remainder(BigInteger/*!*/ self, [NotNull]BigInteger/*!*/ other) { BigInteger remainder; BigInteger.DivRem(self, other, out remainder); return Protocols.Normalize(remainder); } /// - /// Returns the remainder after dividing self by other, where other is not Fixnum or Bignum. + /// Returns the remainder after dividing self by other, where other is Float. /// /// /// -1234567890987654321.remainder(13731.24) #=> -9906.22531493148 /// - /// Float, Fixnum or Bignum + /// Float + [RubyMethod("remainder")] + public static double Remainder(BigInteger/*!*/ self, double other) { + return self.ToFloat64() % other; + } + + /// + /// Returns the remainder after dividing self by other, where other is not Fixnum or Bignum. + /// + /// + /// -1234567890987654321.remainder(13731) #=> -6966 + /// + /// Fixnum or Bignum /// Coerces self and other using other.coerce(self) then dynamically invokes remainder [RubyMethod("remainder")] public static object Remainder(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, object/*!*/ self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "remainder", self, other); } #endregion #endregion #region Comparisons #region <=> /// @@ -750,31 +806,31 @@ namespace IronRuby.Builtins { #region to_s /// /// Returns a string containing the representation of self base 10. /// [RubyMethod("to_s")] public static MutableString/*!*/ ToString(BigInteger/*!*/ self) { return MutableString.Create(self.ToString()); } /// /// Returns a string containing the representation of self base radix (2 through 36). /// /// An integer between 2 and 36 inclusive [RubyMethod("to_s")] - public static MutableString/*!*/ ToString(BigInteger/*!*/ self, uint radix) { + public static MutableString/*!*/ ToString(BigInteger/*!*/ self, int radix) { if (radix < 2 || radix > 36) { throw RubyExceptions.CreateArgumentError(String.Format("illegal radix {0}", radix)); } // TODO: Can we do the ToLower in BigInteger? return MutableString.Create(self.ToString((uint)radix).ToLower()); } #endregion #region coerce /// /// Attempts to coerce other to a Bignum. /// diff --git a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IListOps.cs b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IListOps.cs index 9ed59b8..ce53a97 100644 --- a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IListOps.cs +++ b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IListOps.cs @@ -15,30 +15,32 @@ using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Microsoft.Scripting; using Microsoft.Scripting.Generation; using Microsoft.Scripting.Runtime; using Microsoft.Scripting.Utils; using IronRuby.Runtime; using IronRuby.Runtime.Calls; +using EachSite = System.Func; + namespace IronRuby.Builtins { [RubyModule(Extends = typeof(IList), Restrictions = ModuleRestrictions.None)] [Includes(typeof(Enumerable))] public static class IListOps { #region Helpers // MRI: Some operations check frozen flag even if they don't change the array content. private static void RequireNotFrozen(IList/*!*/ self) { RubyArray array = self as RubyArray; if (array != null && array.IsFrozen) { throw RubyExceptions.CreateObjectFrozenError(); } } @@ -290,32 +292,32 @@ namespace IronRuby.Builtins { internal static int IndexOf(CallSite>/*!*/ equalitySite, IList/*!*/ self, object item) { for (int i = 0; i < self.Count; i++) { if (Protocols.IsTrue(equalitySite.Target(equalitySite, item, self[i]))) { return i; } } return -1; } #endregion #region ==, <=>, eql?, hash [RubyMethod("==")] - public static bool Equals(ConversionStorage/*!*/ arrayTryCast, BinaryOpStorage/*!*/ equals, IList/*!*/ self, object other) { - IList otherAsArray = Protocols.TryCastToArray(arrayTryCast, other); + public static bool Equals(ConversionStorage/*!*/ arrayTryConvert, BinaryOpStorage/*!*/ equals, IList/*!*/ self, object other) { + IList otherAsArray = Protocols.TryConvertToArray(arrayTryConvert, other); return otherAsArray != null ? Equals(equals, self, otherAsArray) : false; } [MultiRuntimeAware] private static RubyUtils.RecursionTracker _EqualsTracker = new RubyUtils.RecursionTracker(); [RubyMethod("==")] public static bool Equals(BinaryOpStorage/*!*/ equals, IList/*!*/ self, [NotNull]IList/*!*/ other) { Assert.NotNull(self, other); if (object.ReferenceEquals(self, other)) { return true; } if (self.Count != other.Count) { @@ -1521,17 +1523,32 @@ namespace IronRuby.Builtins { seen.Add(key, true); i++; } else if (key == null && !nilSeen) { nilSeen = true; i++; } else { self.RemoveAt(i); modified = true; } } return modified ? self : null; } #endregion + + #region zip + + [RubyMethod("zip")] + public static IList/*!*/ Zip(CallSiteStorage/*!*/ each, ConversionStorage/*!*/ tryToAry, BlockParam block, + object self, [NotNull]params object[] args) { + + IList[] otherArrays = new IList[args.Length]; + for (int i = 0; i < args.Length; i++) { + otherArrays[i] = args[i] as IList != null ? args[i] as IList : Protocols.TryCastToArray(tryToAry, args[i]); + } + return Enumerable.Zip(each, tryToAry, block, self, otherArrays); + } + + #endregion } } diff --git a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cs b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cs index 1fa3d06..c2dea59 100644 --- a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cs +++ b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cs @@ -1870,55 +1870,56 @@ namespace IronRuby.Builtins { new System.Func(IronRuby.Builtins.IronRubyOps.ClrOps.GetProfile), new System.Func(IronRuby.Builtins.IronRubyOps.ClrOps.GetProfile) ); } private static void LoadIronRuby__Clr__BigInteger_Instance(IronRuby.Builtins.RubyModule/*!*/ module) { module.DefineLibraryMethod("-", 0x51, new System.Func(IronRuby.Builtins.ClrBigInteger.Subtract), new System.Func(IronRuby.Builtins.ClrBigInteger.Subtract), new System.Func(IronRuby.Builtins.ClrBigInteger.Subtract) ); module.DefineLibraryMethod("%", 0x51, new System.Func(IronRuby.Builtins.ClrBigInteger.Modulo), + new System.Func(IronRuby.Builtins.ClrBigInteger.Modulo), new System.Func(IronRuby.Builtins.ClrBigInteger.ModuloOp) ); module.DefineLibraryMethod("&", 0x51, new System.Func(IronRuby.Builtins.ClrBigInteger.And), new System.Func(IronRuby.Builtins.ClrBigInteger.And), new System.Func(IronRuby.Builtins.ClrBigInteger.And) ); module.DefineLibraryMethod("*", 0x51, new System.Func(IronRuby.Builtins.ClrBigInteger.Multiply), new System.Func(IronRuby.Builtins.ClrBigInteger.Multiply), new System.Func(IronRuby.Builtins.ClrBigInteger.Multiply) ); module.DefineLibraryMethod("**", 0x51, new System.Func(IronRuby.Builtins.ClrBigInteger.Power), new System.Func(IronRuby.Builtins.ClrBigInteger.Power), new System.Func(IronRuby.Builtins.ClrBigInteger.Power), new System.Func(IronRuby.Builtins.ClrBigInteger.Power) ); module.DefineLibraryMethod("/", 0x51, new System.Func(IronRuby.Builtins.ClrBigInteger.Divide), - new System.Func(IronRuby.Builtins.ClrBigInteger.Divide), + new System.Func(IronRuby.Builtins.ClrBigInteger.DivideOp), new System.Func(IronRuby.Builtins.ClrBigInteger.Divide) ); module.DefineLibraryMethod("-@", 0x51, new System.Func(IronRuby.Builtins.ClrBigInteger.Negate) ); module.DefineLibraryMethod("[]", 0x51, new System.Func(IronRuby.Builtins.ClrBigInteger.Bit), new System.Func(IronRuby.Builtins.ClrBigInteger.Bit) ); module.DefineLibraryMethod("^", 0x51, new System.Func(IronRuby.Builtins.ClrBigInteger.Xor), new System.Func(IronRuby.Builtins.ClrBigInteger.Xor), @@ -1970,66 +1971,69 @@ namespace IronRuby.Builtins { ); module.DefineLibraryMethod("coerce", 0x51, new System.Func(IronRuby.Builtins.ClrBigInteger.Coerce), new System.Func(IronRuby.Builtins.ClrBigInteger.Coerce) ); module.DefineLibraryMethod("div", 0x51, new System.Func(IronRuby.Builtins.ClrBigInteger.Divide), new System.Func(IronRuby.Builtins.ClrBigInteger.Divide), new System.Func(IronRuby.Builtins.ClrBigInteger.Div) ); module.DefineLibraryMethod("divmod", 0x51, new System.Func(IronRuby.Builtins.ClrBigInteger.DivMod), + new System.Func(IronRuby.Builtins.ClrBigInteger.DivMod), new System.Func(IronRuby.Builtins.ClrBigInteger.DivMod) ); module.DefineLibraryMethod("eql?", 0x51, new System.Func(IronRuby.Builtins.ClrBigInteger.Eql), new System.Func(IronRuby.Builtins.ClrBigInteger.Eql), new System.Func(IronRuby.Builtins.ClrBigInteger.Eql) ); module.DefineLibraryMethod("hash", 0x51, new System.Func(IronRuby.Builtins.ClrBigInteger.Hash) ); module.DefineLibraryMethod("modulo", 0x51, new System.Func(IronRuby.Builtins.ClrBigInteger.Modulo), + new System.Func(IronRuby.Builtins.ClrBigInteger.Modulo), new System.Func(IronRuby.Builtins.ClrBigInteger.Modulo) ); module.DefineLibraryMethod("quo", 0x51, new System.Func(IronRuby.Builtins.ClrBigInteger.Quotient), new System.Func(IronRuby.Builtins.ClrBigInteger.Quotient), new System.Func(IronRuby.Builtins.ClrBigInteger.Quotient) ); module.DefineLibraryMethod("remainder", 0x51, new System.Func(IronRuby.Builtins.ClrBigInteger.Remainder), + new System.Func(IronRuby.Builtins.ClrBigInteger.Remainder), new System.Func(IronRuby.Builtins.ClrBigInteger.Remainder) ); module.DefineLibraryMethod("to_f", 0x51, new System.Func(IronRuby.Builtins.ClrBigInteger.ToFloat) ); module.DefineLibraryMethod("to_s", 0x51, new System.Func(IronRuby.Builtins.ClrBigInteger.ToString), - new System.Func(IronRuby.Builtins.ClrBigInteger.ToString) + new System.Func(IronRuby.Builtins.ClrBigInteger.ToString) ); } private static void LoadIronRuby__Clr__FlagEnumeration_Instance(IronRuby.Builtins.RubyModule/*!*/ module) { module.DefineLibraryMethod("&", 0x51, new System.Func(IronRuby.Builtins.FlagEnumOps.BitwiseAnd) ); module.DefineLibraryMethod("^", 0x51, new System.Func(IronRuby.Builtins.FlagEnumOps.Xor) ); module.DefineLibraryMethod("|", 0x51, new System.Func(IronRuby.Builtins.FlagEnumOps.BitwiseOr) @@ -5397,30 +5401,34 @@ namespace IronRuby.Builtins { ); module.DefineLibraryMethod("uniq!", 0x51, new System.Func(IronRuby.Builtins.IListOps.UniqueSelf) ); module.DefineLibraryMethod("unshift", 0x51, new System.Func(IronRuby.Builtins.IListOps.Unshift), new System.Func(IronRuby.Builtins.IListOps.Unshift) ); module.DefineLibraryMethod("values_at", 0x51, new System.Func, IronRuby.Runtime.CallSiteStorage>, System.Collections.IList, System.Object[], IronRuby.Builtins.RubyArray>(IronRuby.Builtins.IListOps.ValuesAt) ); + module.DefineLibraryMethod("zip", 0x51, + new System.Func>, IronRuby.Runtime.ConversionStorage, IronRuby.Runtime.BlockParam, System.Object, System.Object[], System.Collections.IList>(IronRuby.Builtins.IListOps.Zip) + ); + } private static void LoadSystem__IComparable_Instance(IronRuby.Builtins.RubyModule/*!*/ module) { module.DefineLibraryMethod("<=>", 0x51, new System.Func(IronRuby.Builtins.IComparableOps.Compare) ); } private static void LoadSystem__Int16_Instance(IronRuby.Builtins.RubyModule/*!*/ module) { LoadIronRuby__Clr__Integer_Instance(module); module.DefineLibraryMethod("size", 0x51, new System.Func(IronRuby.Builtins.Int16Ops.Size) ); From curth at microsoft.com Mon Jul 20 10:10:30 2009 From: curth at microsoft.com (Curt Hagenlocher) Date: Mon, 20 Jul 2009 07:10:30 -0700 Subject: [Ironruby-core] Data Binding to IronRuby Objects in WPF In-Reply-To: <92060bc2f2b10496da743f5e82f2e83f@ruby-forum.com> References: <92060bc2f2b10496da743f5e82f2e83f@ruby-forum.com> Message-ID: This should work under desktop WPF (though not under Silverlight) because IronRuby objects implement ICustomTypeDescriptor. But consider the following code: class Drive def letter 'C' end def format # format the hard drive end end How do we know what the "properties" of Drive are? For obvious reasons, we would want to return "letter" but not "format". The way I protected against this was to return only those names which have both an arity 0 getter and an arity 1 setter. In other words, the above class would also need a def letter= value # raise some kind of "not supported" exception end in order for the ICustomTypeDescriptor implementation to recognize "letter" as a property. -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shay Friedman Sent: Saturday, July 18, 2009 9:12 AM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] Data Binding to IronRuby Objects in WPF Hi there, I'm trying to databind IronRuby objects to a WPF listbox with no success My data is a Ruby array of objects. The array seems to be bound fine as I see the expected number of rows in the listbox. However, every object within the array fails to bind correctly. I tried the object to be a Ruby hash or a custom class without success? WPF wouldn't display the correct value. When I tried to create an array of CLR classes, it worked. Will it work in the future? Thanks, Shay. ---------------------------- Shay Friedman http://www.IronShay.com Follow me: http://twitter.com/ironshay -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core From ryan.riley at panesofglass.org Mon Jul 20 10:16:30 2009 From: ryan.riley at panesofglass.org (Ryan Riley) Date: Mon, 20 Jul 2009 09:16:30 -0500 Subject: [Ironruby-core] Data Binding to IronRuby Objects in WPF In-Reply-To: References: <92060bc2f2b10496da743f5e82f2e83f@ruby-forum.com> Message-ID: Ryan Riley ryan.riley at panesofglass.org http://panesofglass.org/ http://wizardsofsmart.net/ On Mon, Jul 20, 2009 at 9:10 AM, Curt Hagenlocher wrote: > This should work under desktop WPF (though not under Silverlight) because > IronRuby objects implement ICustomTypeDescriptor. But consider the following > code: > > class Drive > def letter > 'C' > end > def format > # format the hard drive > end > end > > How do we know what the "properties" of Drive are? For obvious reasons, we > would want to return "letter" but not "format". The way I protected against > this was to return only those names which have both an arity 0 getter and an > arity 1 setter. In other words, the above class would also need a > > def letter= value > # raise some kind of "not supported" exception > end > > in order for the ICustomTypeDescriptor implementation to recognize "letter" > as a property. > > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] On Behalf Of Shay Friedman > Sent: Saturday, July 18, 2009 9:12 AM > To: ironruby-core at rubyforge.org > Subject: [Ironruby-core] Data Binding to IronRuby Objects in WPF > > Hi there, > > I'm trying to databind IronRuby objects to a WPF listbox with no success > > My data is a Ruby array of objects. The array seems to be bound fine as > I see the expected number of rows in the listbox. However, every object > within the array fails to bind correctly. I tried the object to be a > Ruby hash or a custom class without success? WPF wouldn't display the > correct value. > > When I tried to create an array of CLR classes, it worked. > > Will it work in the future? > > Thanks, > Shay. > > ---------------------------- > Shay Friedman > http://www.IronShay.com > Follow me: http://twitter.com/ironshay > -- > 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 ryan.riley at panesofglass.org Mon Jul 20 10:18:23 2009 From: ryan.riley at panesofglass.org (Ryan Riley) Date: Mon, 20 Jul 2009 09:18:23 -0500 Subject: [Ironruby-core] Data Binding to IronRuby Objects in WPF In-Reply-To: References: <92060bc2f2b10496da743f5e82f2e83f@ruby-forum.com> Message-ID: Ryan Riley ryan.riley at panesofglass.org http://panesofglass.org/ http://wizardsofsmart.net/ On Mon, Jul 20, 2009 at 9:16 AM, Ryan Riley wrote: > > > > Ryan Riley > ryan.riley at panesofglass.org > http://panesofglass.org/ > http://wizardsofsmart.net/ > > > > On Mon, Jul 20, 2009 at 9:10 AM, Curt Hagenlocher wrote: > >> This should work under desktop WPF (though not under Silverlight) because >> IronRuby objects implement ICustomTypeDescriptor. But consider the following >> code: >> >> class Drive >> def letter >> 'C' >> end >> def format >> # format the hard drive >> end >> end >> >> How do we know what the "properties" of Drive are? For obvious reasons, we >> would want to return "letter" but not "format". The way I protected against >> this was to return only those names which have both an arity 0 getter and an >> arity 1 setter. In other words, the above class would also need a >> >> def letter= value >> # raise some kind of "not supported" exception >> end >> >> in order for the ICustomTypeDescriptor implementation to recognize >> "letter" as a property. >> >> -----Original Message----- >> From: ironruby-core-bounces at rubyforge.org [mailto: >> ironruby-core-bounces at rubyforge.org] On Behalf Of Shay Friedman >> Sent: Saturday, July 18, 2009 9:12 AM >> To: ironruby-core at rubyforge.org >> Subject: [Ironruby-core] Data Binding to IronRuby Objects in WPF >> >> Hi there, >> >> I'm trying to databind IronRuby objects to a WPF listbox with no success >> >> My data is a Ruby array of objects. The array seems to be bound fine as >> I see the expected number of rows in the listbox. However, every object >> within the array fails to bind correctly. I tried the object to be a >> Ruby hash or a custom class without success? WPF wouldn't display the >> correct value. >> >> When I tried to create an array of CLR classes, it worked. >> >> Will it work in the future? >> >> Thanks, >> Shay. >> >> ---------------------------- >> Shay Friedman >> http://www.IronShay.com >> Follow me: http://twitter.com/ironshay >> -- >> 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 ivan at flanders.co.nz Mon Jul 20 10:26:48 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Mon, 20 Jul 2009 16:26:48 +0200 Subject: [Ironruby-core] Data Binding to IronRuby Objects in WPF In-Reply-To: References: <92060bc2f2b10496da743f5e82f2e83f@ruby-forum.com> Message-ID: but wouldn't linking those to attr_reader, attr_writer and attr_accessor work?At least then you know which things are meant to be properties. I don't mind using something like clrattr_reader etc. to get a different behavior and something to expand upon. because then it becomes inotify_attr_reader or something, later on for INotifyPropertyChanged implementations. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero GSM: +32.486.787.582 Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Mon, Jul 20, 2009 at 4:10 PM, Curt Hagenlocher wrote: > This should work under desktop WPF (though not under Silverlight) because > IronRuby objects implement ICustomTypeDescriptor. But consider the following > code: > > class Drive > def letter > 'C' > end > def format > # format the hard drive > end > end > > How do we know what the "properties" of Drive are? For obvious reasons, we > would want to return "letter" but not "format". The way I protected against > this was to return only those names which have both an arity 0 getter and an > arity 1 setter. In other words, the above class would also need a > > def letter= value > # raise some kind of "not supported" exception > end > > in order for the ICustomTypeDescriptor implementation to recognize "letter" > as a property. > > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] On Behalf Of Shay Friedman > Sent: Saturday, July 18, 2009 9:12 AM > To: ironruby-core at rubyforge.org > Subject: [Ironruby-core] Data Binding to IronRuby Objects in WPF > > Hi there, > > I'm trying to databind IronRuby objects to a WPF listbox with no success > > My data is a Ruby array of objects. The array seems to be bound fine as > I see the expected number of rows in the listbox. However, every object > within the array fails to bind correctly. I tried the object to be a > Ruby hash or a custom class without success? WPF wouldn't display the > correct value. > > When I tried to create an array of CLR classes, it worked. > > Will it work in the future? > > Thanks, > Shay. > > ---------------------------- > Shay Friedman > http://www.IronShay.com > Follow me: http://twitter.com/ironshay > -- > 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 curth at microsoft.com Mon Jul 20 11:01:49 2009 From: curth at microsoft.com (Curt Hagenlocher) Date: Mon, 20 Jul 2009 08:01:49 -0700 Subject: [Ironruby-core] Data Binding to IronRuby Objects in WPF In-Reply-To: References: <92060bc2f2b10496da743f5e82f2e83f@ruby-forum.com> Message-ID: Those are sufficient to flag a member as a property, but not necessary. There are plenty of cases when programmers use a bare method in a place where that they would still want to databind to it. Currently, attr_reader by itself won?t create a ?property?; it also needs the writer. This is arguably a bug. The combination (or attr_accessor) should work. From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Monday, July 20, 2009 7:27 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Data Binding to IronRuby Objects in WPF but wouldn't linking those to attr_reader, attr_writer and attr_accessor work? At least then you know which things are meant to be properties. I don't mind using something like clrattr_reader etc. to get a different behavior and something to expand upon. because then it becomes inotify_attr_reader or something, later on for INotifyPropertyChanged implementations. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero GSM: +32.486.787.582 Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Mon, Jul 20, 2009 at 4:10 PM, Curt Hagenlocher > wrote: This should work under desktop WPF (though not under Silverlight) because IronRuby objects implement ICustomTypeDescriptor. But consider the following code: class Drive def letter 'C' end def format # format the hard drive end end How do we know what the "properties" of Drive are? For obvious reasons, we would want to return "letter" but not "format". The way I protected against this was to return only those names which have both an arity 0 getter and an arity 1 setter. In other words, the above class would also need a def letter= value # raise some kind of "not supported" exception end in order for the ICustomTypeDescriptor implementation to recognize "letter" as a property. -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shay Friedman Sent: Saturday, July 18, 2009 9:12 AM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] Data Binding to IronRuby Objects in WPF Hi there, I'm trying to databind IronRuby objects to a WPF listbox with no success My data is a Ruby array of objects. The array seems to be bound fine as I see the expected number of rows in the listbox. However, every object within the array fails to bind correctly. I tried the object to be a Ruby hash or a custom class without success? WPF wouldn't display the correct value. When I tried to create an array of CLR classes, it worked. Will it work in the future? Thanks, Shay. ---------------------------- Shay Friedman http://www.IronShay.com Follow me: http://twitter.com/ironshay -- 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 lists at ruby-forum.com Mon Jul 20 13:45:13 2009 From: lists at ruby-forum.com (Shay Friedman) Date: Mon, 20 Jul 2009 19:45:13 +0200 Subject: [Ironruby-core] Data Binding to IronRuby Objects in WPF In-Reply-To: <92060bc2f2b10496da743f5e82f2e83f@ruby-forum.com> References: <92060bc2f2b10496da743f5e82f2e83f@ruby-forum.com> Message-ID: Hi, Well I reply in the forum even though I don't see the entire thread here for some reason. My emails do not reach the mailing list as well, so... Anyway, Curt - thanks for the clarification. What you've described works good with binding of textblocks and links, but when I try to bind an image to an IronRuby class attribute it doesn't work (this works with an equivalent C# class). Is it a bug? Thanks for the help! Shay. ---------------------------- Shay Friedman http://www.IronShay.com Follow me: http://twitter.com/ironshay -- Posted via http://www.ruby-forum.com/. From ivan at flanders.co.nz Mon Jul 20 13:47:42 2009 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Mon, 20 Jul 2009 19:47:42 +0200 Subject: [Ironruby-core] ENV['HOME'] is missing Message-ID: ENV['HOME'] returns nil in ironruby while in ruby it returns my home folder --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) -------------- next part -------------- An HTML attachment was scrubbed... URL: From curth at microsoft.com Mon Jul 20 14:21:42 2009 From: curth at microsoft.com (Curt Hagenlocher) Date: Mon, 20 Jul 2009 11:21:42 -0700 Subject: [Ironruby-core] Data Binding to IronRuby Objects in WPF In-Reply-To: References: <92060bc2f2b10496da743f5e82f2e83f@ruby-forum.com> Message-ID: What type of object are you returning? ICustomTypeDescriptor is very incompatible with the semantics of dynamic types. It wouldn't surprise me that it doesn't work in certain cases. -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shay Friedman Sent: Monday, July 20, 2009 10:45 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Data Binding to IronRuby Objects in WPF Hi, Well I reply in the forum even though I don't see the entire thread here for some reason. My emails do not reach the mailing list as well, so... Anyway, Curt - thanks for the clarification. What you've described works good with binding of textblocks and links, but when I try to bind an image to an IronRuby class attribute it doesn't work (this works with an equivalent C# class). Is it a bug? Thanks for the help! Shay. ---------------------------- Shay Friedman http://www.IronShay.com Follow me: http://twitter.com/ironshay -- 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 Mon Jul 20 15:53:08 2009 From: lists at ruby-forum.com (Shay Friedman) Date: Mon, 20 Jul 2009 21:53:08 +0200 Subject: [Ironruby-core] Data Binding to IronRuby Objects in WPF In-Reply-To: References: <92060bc2f2b10496da743f5e82f2e83f@ruby-forum.com> Message-ID: <98e4c815111cb5f0218f4d77794c5cf2@ruby-forum.com> I return a String. I have three attributes, all of them hold strings. Textblock that I bind to the strings work, but when I bind an Image element (the Source value) to the string, it doesn't work. Shay. ---------------------------- Shay Friedman http://www.IronShay.com Follow me: http://twitter.com/ironshay -- Posted via http://www.ruby-forum.com/. From Jimmy.Schementi at microsoft.com Tue Jul 21 05:13:57 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Tue, 21 Jul 2009 09:13:57 +0000 Subject: [Ironruby-core] [Code Review] Beginnings of "XAP-less" Silverlight application support Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC18B5A455@tk5ex14mbxc105.redmond.corp.microsoft.com> (This already went out to the IronPython mailing list, but for some reason it didn't get out to the IronRuby list ...) http://github.com/jschementi/ironruby/commit/da6b54e226adfd3a18d8ad98d618c2350ebd8351 Beginnings of "XAP-less" Silverlight application support. Adds a "downloadScripts" initParam to indicate whether paths to script files and XAML files should be resolved to the web-server (relative to the XAP), if the file is not found in the XAP. Also adds "downloadScriptsFrom" to customize what path they are based off of. Files are downloaded synchronously as code runs, by having the PlatformAdaptationLayer use a new BrowserVirtualFilesystem: HttpVirtualFilesystem. So when a language's include mechanism is used (require, load, import, etc), it will download the file by using XmlHttpRequest in synchronous mode. It will also cache each downloaded file's contents, so a file will only be downloaded once, even if it is included multiple times. Note: this change decreases the need for Chiron significantly. In this mode, Chiron only creates a XAP file with the necessary assemblies and AppManifest.xaml, if it doesn't exist already. One could imagine providing a XAP file for each language, and then Chiron wouldn't be needed for development. However, for using the latest language assemblies, and auto-detection of languages used, it's still useful. So some changes have been made to Chiron to support this better: A "localApplicationRoot" appSetting has been added to Chiron to adjust where it looks for script files (when determining what languages are used). This allows you to make sure Chiron is looking in the same place your application is downloading scripts or xaml from, so it can still generate a correct XAP file for you. "application/ruby" and "application/python" mime-types have been also added to Chrion also to enable downloading of those script files. All appSettings are now overridable as command-line switches: /u[rlPrefix], /e[xtUrlPrefix], /l[ocalAppRoot] See Merlin/Main/Hosts/SilverLight/Tests/tests/manual/test_foox for an example of how this works. Adds a stub for similar support through IsolatedStorage, but that will come later. Also tweaks the DynamicEngine.CreateRuntimeSetup method to better support other DLR-hosts in Silverlight. From Jimmy.Schementi at microsoft.com Tue Jul 21 05:21:56 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Tue, 21 Jul 2009 09:21:56 +0000 Subject: [Ironruby-core] [Code Review] Various SL and tutorial fixes Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC18B5A467@tk5ex14mbxc105.redmond.corp.microsoft.com> Note: all commits are in dev/filesoox branch. Once reviewed I will rebase them into master, and then they can be pulled into ironruby/ironruby. http://github.com/jschementi/ironruby/commit/6fd607b30e82aad4fd4fad09906f6385ff98c9fa Various SL and Tutorial fixes - Fix bug where an entryPoint isn't found when specified in initParams and using downloadScripts. - Tutorial now runs with downloadScripts, just as a test case. - Tutorial header and chapter navigations have the same animations that they had on the desktop - Tutorial chapter navigation works again o adds System.Windows.Controls.dll for TreeView in SL, and System.Windows.Controls.Toolkit.dll for a TreeViewExtensions.ExpandAll - wpf.rb extends FrameworkElement to look for resources by x:name as well as children element http://github.com/jschementi/ironruby/commit/4a7d5d6982d50cbc6c4895817759e90993368d42 Script for rewriting project files so they build in Visual C# Express - Note: it is preferred you not do this, and just build from the command line (if you can't find msbuild, it is in %windir%\Microsoft.NET\Framework\v3.5) http://github.com/jschementi/ironruby/commit/308eccad1422d8bcf72d7d11c3573fda983ad5af Tutorial: Clear chapters TreeView every time a tutorial is started http://github.com/jschementi/ironruby/commit/963b9e14c8744f5a786f870b31844352547ab49e Fixes for Moonlight (http://monoport.com/39313 and http://monoport.com/39314) From Jimmy.Schementi at microsoft.com Tue Jul 21 07:21:51 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Tue, 21 Jul 2009 11:21:51 +0000 Subject: [Ironruby-core] [IronPython] [Code Review] "XAP-less" Silverlight application support In-Reply-To: <4A658C48.5010001@voidspace.org.uk> References: <0047ECBFA2E0DF4A834AA369282A5AFC18B56732@tk5ex14mbxc105.redmond.corp.microsoft.com>, <4A658C48.5010001@voidspace.org.uk> Message-ID: <0047ECBFA2E0DF4A834AA369282A5AFC18B5A4FA@tk5ex14mbxc105.redmond.corp.microsoft.com> Michael, You just had to ask now =P ... I was going to blog about this more extensively tomorrow, but here's a preview of my thinking about this: My motivation behind xap-less is to make DLR Silverlight apps less complex, and more like how the web works. This change is just an experiment in that direction, and I'm very open to any opinions folks have about this. First things first though, this change make xap-less completely opt-in ... you have to use the "downloadScripts=true" InitParams setting to enable it. Without this param it will behave as it used to. Also, even with this setting it will not download the file if it exists in the XAP. I was very conservative about this change, as I'm just playing around with some ideas. Also, even if xap-less becomes the default, I'd make sure existing deployments did not break; in the xap will always be an option for deployment (and quite possibly the preferred way), but I want to get back to the place where we didn't need a XAP file and didn't need Chiron for development. Eh, I know that was the messaging around XAP files being compressed and faster for download times, but that's because they were synchronously downloaded and the browser can only handle one of those at once. If you use gzip-compression on your web-server and download each file asynchronously, I don't think you'll see much of a difference. However, "minifying" Ruby or Python like most JavaScript is really not possible, so people could always opt for a XAP file. But I really want to give back the text-only experience, even for deployment. There are still good ways to support asynchronous downloading of files that get imported (I'll talk about that below), so we should still explore those ... especially since this is the way browsers work today. Imagine if Ruby and Python in the browser felt not that much different than JavaScript, but allow for other deployment options if the app needs it. For example, a Python Silverlight Hello World app should just be this:
Very simple and clean. No need to start a web-server or install Mono on the Mac just to make a client-side page. The JS file hosts Silverlight, and then Microsoft.Scripting.Silverlight scans the HTML page looking for If an import failed against the XAP, it could look on the web-server. Though today's implementation is synchronous, that needs to change. So the guidance would be to either to put those files in the XAP, or allow the app-author to specify their dependencies up-front (like JavaScript does, it could even be with
Very simple and clean. No need to start a web-server or install Mono on the Mac just to make a client-side page. The JS file hosts Silverlight, and then Microsoft.Scripting.Silverlight scans the HTML page looking for If an import failed against the XAP, it could look on the web-server. Though today's implementation is synchronous, that needs to change. So the guidance would be to either to put those files in the XAP, or allow the app-author to specify their dependencies up-front (like JavaScript does, it could even be with